Document that package.json aliases may target only direct subfolders of src #21

Merged
temeddix merged 27 commits from alias-targets into main 2026-10-18 14:37:50 +00:00
4 changed files with 25 additions and 1 deletions
Showing only changes of commit 2e09945a6a - Show all commits
+17
View File
@@ -55,3 +55,20 @@ so they never reach package consumers.
Relative imports inside one directory (`./sibling.ts`) are fine, with the
`.ts` extension written out.
## `scripts/` is flat (user rule, 2026-10-16)
- `scripts/` has no subfolders and no `index.ts`. Barrels and `index.ts`
entries exist only inside `src/`; delete any `index.ts` outside it.
- Each tool is one file, `scripts/<name>.ts`, imported directly by file:
`import { decorators } from "./scripts/decorators.ts";` in
`vite.config.ts`.
- Code in a former `scripts/<tool>/` folder is merged or renamed into flat
`scripts/<name>.ts` files. Non-TS assets (HTML, images, fixtures) move to
where they belong (next to the tool's output, `.agents/`, or a gitignored
scratch dir). A subfolder that is really an app moves under `src/` as an
aliased folder.
- import-check 0.10.0+ checks folder layout only where the importer or the
target sits in a `#`-aliased folder, so `vite.config.ts` →
`./scripts/x.ts` passes without any override. Remove overrides that only
dodged import-check.
+3 -1
View File
@@ -11,7 +11,9 @@ practice.
off for `src/rules/index.ts`, the rule registry, which must import every
rule. It is not a precedent for apps.
- **`scripts/**`:** a narrow override is allowed when a tooling script truly
needs it, e.g. `no-console` in a CLI script.
needs it, e.g. `no-console` in a CLI script. Never one that only dodges
import-check (e.g. `no-relative-bypass` for `vite.config.ts`); import-check
ignores folders no `#` alias owns.
- **Generated files:** list them in `ignorePatterns`, never `overrides`.
- **Anything else needs the user's approval first.** When the user is away,
don't add it: refactor, or leave the violation failing and log the question.
@@ -40,6 +40,9 @@ with everything.
- [ ] Decorators stay standard with `accessor`; add `scripts/decorators.ts`
if the repo has any. Lit repos: `scripts/lit-check.ts` + `npm run
lit-check`.
- [ ] `scripts/` is flat: no subfolders, no `index.ts` (barrels live only in
`src/`); `vite.config.ts` imports `./scripts/<name>.ts` directly. A
scripts subfolder that is really an app moves under `src/`.
**Lint**
+2
View File
@@ -23,6 +23,8 @@ type-checks, and `vp test` runs Vitest. Unit tests sit next to the code as
and `scripts/` import each other relatively. If one is ever added, it may point
only at a direct subfolder of `src/` (its `index.ts`, or a `#x/*` pattern
inside it); never at `src/` itself, a deeper folder, or anything outside `src/`.
`scripts/` is flat: one file per tool, no subfolders and no `index.ts`
(barrels live only in `src/`), imported directly by file path.
The only config files are `package.json`, `tsconfig.json`, and
`vite.config.ts`, plus `package-lock.json`. Repo-local lint rules and the rule
2