This commit is contained in:
@@ -19,16 +19,20 @@ dependency. Keep the sources to erasable syntax and `.ts` imports, which
|
|||||||
type-checks, and `vp test` runs Vitest. Unit tests sit next to the code as
|
type-checks, and `vp test` runs Vitest. Unit tests sit next to the code as
|
||||||
`src/*.test.ts`; repository-level tests live in `tests/`.
|
`src/*.test.ts`; repository-level tests live in `tests/`.
|
||||||
|
|
||||||
An alias in `package.json` `imports` owns its target: a folder's `index.ts`
|
A `#` alias in `package.json` `imports` may point anywhere and owns its
|
||||||
owns that folder and everything below it, any other file owns only that file.
|
target: an alias to a folder's `index.ts` owns that folder and everything
|
||||||
No file may be owned by 2 aliases. Outside an area, only the exact alias
|
below it; an alias to any other file owns only that file. No overlap: no file
|
||||||
reaches it (no deeper `#` specifier, no relative path); inside it, relative
|
may be owned by 2 aliases, so no alias inside another alias's area and no 2
|
||||||
imports of siblings and subfolders are free. `../` is banned in every file
|
aliases with the same target. Outside an area, only the exact alias reaches
|
||||||
(`import/no-relative-parent-imports`). The one alias is `#testing`
|
it; a deeper alias specifier or a relative path into the area is a bypass.
|
||||||
(`./src/testing.ts`): every test imports it by alias, and `tests/` reaches
|
Inside an area, relative imports of siblings and subfolders are free. `../`
|
||||||
`src/` only through it. Other `src/` files import `./` siblings freely.
|
is banned in every file, owned or not
|
||||||
`scripts/` is flat: one file per tool, no subfolders and no `index.ts`
|
(`import/no-relative-parent-imports`). Files no alias owns need no `index.ts`
|
||||||
(barrels live only in `src/`), imported directly by file path.
|
and no alias, and import `./` siblings and subfolders freely. The one alias
|
||||||
|
is `#testing` (`./src/testing.ts`): every test imports it by alias, and
|
||||||
|
`tests/` reaches `src/` only through it. `scripts/` is flat: one file per
|
||||||
|
tool, no subfolders and no `index.ts`, imported directly by file path
|
||||||
|
([.agents/memory/imports-aliases-barrels.md](.agents/memory/imports-aliases-barrels.md)).
|
||||||
|
|
||||||
The only config files are `package.json`, `tsconfig.json`, and
|
The only config files are `package.json`, `tsconfig.json`, and
|
||||||
`vite.config.ts`, plus `package-lock.json`. Repo-local lint rules and the rule
|
`vite.config.ts`, plus `package-lock.json`. Repo-local lint rules and the rule
|
||||||
|
|||||||
Reference in New Issue
Block a user