Document that package.json aliases may target only direct subfolders of src #21
@@ -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
|
||||
`src/*.test.ts`; repository-level tests live in `tests/`.
|
||||
|
||||
An alias in `package.json` `imports` owns its target: a folder's `index.ts`
|
||||
owns that folder and everything below it, any other file owns only that file.
|
||||
No file may be owned by 2 aliases. Outside an area, only the exact alias
|
||||
reaches it (no deeper `#` specifier, no relative path); inside it, relative
|
||||
imports of siblings and subfolders are free. `../` is banned in every file
|
||||
(`import/no-relative-parent-imports`). The one alias is `#testing`
|
||||
(`./src/testing.ts`): every test imports it by alias, and `tests/` reaches
|
||||
`src/` only through it. Other `src/` files import `./` siblings freely.
|
||||
`scripts/` is flat: one file per tool, no subfolders and no `index.ts`
|
||||
(barrels live only in `src/`), imported directly by file path.
|
||||
A `#` alias in `package.json` `imports` may point anywhere and owns its
|
||||
target: an alias to a folder's `index.ts` owns that folder and everything
|
||||
below it; an alias to any other file owns only that file. No overlap: no file
|
||||
may be owned by 2 aliases, so no alias inside another alias's area and no 2
|
||||
aliases with the same target. Outside an area, only the exact alias reaches
|
||||
it; a deeper alias specifier or a relative path into the area is a bypass.
|
||||
Inside an area, relative imports of siblings and subfolders are free. `../`
|
||||
is banned in every file, owned or not
|
||||
(`import/no-relative-parent-imports`). Files no alias owns need no `index.ts`
|
||||
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)).
|
||||
|
||||
|
bot
commented
`AGENTS.md` says every test imports `#testing`, but `src/credentials.test.ts`, `src/opencode.test.ts`, and `src/profiles.test.ts` do not. Limit this to `tests/` (or make the statement true) so the alias policy stays accurate.
> Profile: `codex` · `gpt-5.6-terra`
|
||||
The only config files are `package.json`, `tsconfig.json`, and
|
||||
`vite.config.ts`, plus `package-lock.json`. Repo-local lint rules and the rule
|
||||
|
||||
Reference in New Issue
Block a user
This new rule says
../is banned in every file, but it remains intests/entrypoints.test.ts,tests/workflow.test.ts, andsrc/run.ts; the listed import rule does not check URL strings. Remove those traversals or narrow and enforce the rule to match its actual scope.