chore(template): clean-slate template snapshot from bb4a0c7
Curated, product-agnostic snapshot of the post-story-04 tree: demo content deleted, auth-only reference feature, web-next shell, all gates green. Product-specific docs, ADRs 027-029, PRDs/epics/archive, editor library traces, and product naming are curated out; generic template repairs (coverage provider devDeps, root test:coverage script, live lint fixes, root-only release-please) are kept. See TEMPLATE.md for provenance, curation list, and usage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016j8z4VHjedXDTjEDNg7qHK
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
import { describe, it } from "vitest";
|
||||
import { RuleTester } from "eslint";
|
||||
import rule from "./atomic-tier-import-direction.js";
|
||||
|
||||
const tester = new RuleTester({
|
||||
languageOptions: {
|
||||
parser: await import("@typescript-eslint/parser"),
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
parserOptions: { ecmaFeatures: { jsx: true } },
|
||||
},
|
||||
});
|
||||
|
||||
describe("atomic-tier-import-direction", () => {
|
||||
it("passes when an organism imports from atoms", () => {
|
||||
tester.run("atomic-tier-import-direction", rule, {
|
||||
valid: [
|
||||
{
|
||||
filename: "/repo/packages/core-ui/src/organisms/Card/Card.tsx",
|
||||
code: `import { Button } from "../../atoms/Button/Button";`,
|
||||
},
|
||||
],
|
||||
invalid: [],
|
||||
});
|
||||
});
|
||||
|
||||
it("fires when an atom imports from organisms", () => {
|
||||
tester.run("atomic-tier-import-direction", rule, {
|
||||
valid: [],
|
||||
invalid: [
|
||||
{
|
||||
filename: "/repo/packages/core-ui/src/atoms/Button/Button.tsx",
|
||||
code: `import { Card } from "../../organisms/Card/Card";`,
|
||||
errors: [
|
||||
{
|
||||
messageId: "wrongDirection",
|
||||
data: {
|
||||
fromTier: "atoms",
|
||||
toTier: "organisms",
|
||||
importPath: "../../organisms/Card/Card",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("is a no-op for files outside any tier folder", () => {
|
||||
tester.run("atomic-tier-import-direction", rule, {
|
||||
valid: [
|
||||
{
|
||||
filename:
|
||||
"/repo/packages/auth/src/application/use-cases/sign-in.use-case.ts",
|
||||
code: `export const x = 1;`,
|
||||
},
|
||||
],
|
||||
invalid: [],
|
||||
});
|
||||
});
|
||||
|
||||
it("passes for same-tier imports", () => {
|
||||
tester.run("atomic-tier-import-direction", rule, {
|
||||
valid: [
|
||||
{
|
||||
filename:
|
||||
"/repo/packages/core-ui/src/molecules/SearchBar/SearchBar.tsx",
|
||||
code: `import { FormField } from "../FormField/FormField";`,
|
||||
},
|
||||
],
|
||||
invalid: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user