This commit is contained in:
@@ -27,7 +27,9 @@ convention, see the last section):
|
|||||||
area (`./a/one.ts`, `no-relative-bypass`; `./b/f.ts` to a file alias,
|
area (`./a/one.ts`, `no-relative-bypass`; `./b/f.ts` to a file alias,
|
||||||
`prefer-alias-import`, fixed to the alias) are bypasses.
|
`prefer-alias-import`, fixed to the alias) are bypasses.
|
||||||
- **Inside an area, relative imports of siblings and subfolders are free.**
|
- **Inside an area, relative imports of siblings and subfolders are free.**
|
||||||
- **`../` is banned in every file**, owned or not (`no-parent-import`).
|
- **A `../` import is banned in every file**, owned or not (`no-parent-import`).
|
||||||
|
Runtime file URLs (`new URL("../prompt.md", import.meta.url)`) are not
|
||||||
|
imports and are allowed.
|
||||||
Anything above a file needs an alias.
|
Anything above a file needs an alias.
|
||||||
- **Files no alias owns** need no `index.ts` and no alias, and import `./`
|
- **Files no alias owns** need no `index.ts` and no alias, and import `./`
|
||||||
siblings and subfolders freely.
|
siblings and subfolders freely.
|
||||||
|
|||||||
@@ -29,16 +29,17 @@ 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
|
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
|
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.
|
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. `../`
|
Inside an area, relative imports of siblings and subfolders are free. A `../`
|
||||||
is banned in every file, owned or not
|
import is banned in every file, owned or not
|
||||||
(`import/no-relative-parent-imports`). Files no alias owns need no `index.ts`
|
(`import/no-relative-parent-imports`); runtime file URLs such as
|
||||||
and no alias, and import `./` siblings and subfolders freely. The one alias
|
`new URL("../prompt.md", import.meta.url)` are paths, not imports, and stay.
|
||||||
is `#testing` (`./src/testing/index.ts`): tests that use its helpers import
|
Files no alias owns need no `index.ts` and no alias, and import `./` siblings
|
||||||
it by alias, and `tests/` reaches `src/` only through it. Local convention, stricter than the
|
and subfolders freely. The one alias is `#testing` (`./src/testing/index.ts`):
|
||||||
general rule above: in this repo, aliases point only at a direct subfolder of
|
tests that use its helpers import it by alias, and `tests/` imports `src/`
|
||||||
`src/` (`"#helpers": "./src/helpers/index.ts"`), and code outside `src/` uses
|
only through it. Local convention, stricter than the general rule above: in
|
||||||
`./` relative imports. `scripts/` is flat: one file per
|
this repo, aliases point only at a direct subfolder of `src/`
|
||||||
tool, no subfolders and no `index.ts`, imported directly by file path
|
(`"#helpers": "./src/helpers/index.ts"`), and code outside `src/` uses `./`
|
||||||
|
relative imports. `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)).
|
([.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
|
||||||
|
|||||||
Reference in New Issue
Block a user