3 Commits

Author SHA1 Message Date
Danny Kim 2e09945a6a Document that scripts is flat with no subfolders or index files
Check / check (pull_request) Successful in 39s
2026-10-16 23:19:03 +09:00
Danny Kim 934a3cfd03 Remove Deno lint references from the project lint plugin comments
Check / check (pull_request) Successful in 38s
2026-10-16 23:15:37 +09:00
Danny Kim b170f25c7d Document that package.json aliases may target only direct subfolders of src
Agents / agent (pull_request) Has been skipped
Check / check (pull_request) Successful in 1m18s
2026-10-16 22:08:23 +09:00
6 changed files with 53 additions and 17 deletions
+27 -1
View File
@@ -6,7 +6,16 @@ description: Shared code comes through # aliases in package.json imports, each d
Shared code is imported through Node subpath imports declared in
`package.json` `imports`, never by a relative path that climbs out of a
directory:
directory.
**Targets (user rule, 2026-10-16):** an alias may point ONLY at a direct
subfolder of `src/`: its `index.ts` (`"#helpers": "./src/helpers/index.ts"`)
or a `#x/*` pattern inside that one folder. Never alias anything outside
`src/` (`scripts/`, root files), `src/` itself (no `#plugin` for
`./src/index.ts`), or a deeper folder (`./src/a/b/`). Code that would need
such an alias uses a relative import instead; `scripts/` and
`vite.config.ts` import each other relatively. Layer rules
(`enforce-layer-order`) must still pass, so reorder entries if needed.
```jsonc
"imports": {
@@ -46,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.
+3 -2
View File
@@ -11,8 +11,9 @@ Decided 2026-10-14 for all repos.
config needed. Packages publish only `dist/`, so colocated tests cost nothing
in the tarball.
- **Regression and integration tests** live in the top-level `tests/` folder
and use only the public entry point (an alias like `#plugin`), never
internals. `vp test tests` runs just these.
and use only the public entry point through a relative import
(`../src/index.ts`; no alias may target `src/` itself, see
[[imports-aliases-barrels]]), never internals. `vp test tests` runs just these.
- **No in-source tests** (`import.meta.vitest`).
- **`scripts/` gets no tests** (2026-10-15): it is repo tooling, not
production code (`project-lint.ts`, `decorators.ts`, `lit-check.ts`,
+6 -1
View File
@@ -27,7 +27,9 @@ with everything.
{ sortPackageJson: false }` and the category-based `lint` block.
- [ ] Delete `deno.json`, `deno.lock`, and Deno-only files. `mod.ts` →
`index.ts`; `deno.json` imports → `package.json` `imports` (`#x/*`
patterns for trailing-slash mappings); `jsr:`/`npm:` → npm packages.
patterns for trailing-slash mappings; aliases may target only direct
subfolders of `src/`, anything else becomes a relative import);
`jsr:`/`npm:` → npm packages.
**Code**
@@ -38,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**
+7
View File
@@ -19,6 +19,13 @@ 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/`.
`src/` is flat, so `package.json` has no `imports` aliases and modules, tests,
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
list live in `scripts/project-lint.ts`. Lint disable comments are not allowed;
+7 -12
View File
@@ -1,8 +1,6 @@
/**
* `project` — lint rules this repository holds its own source to. Deno lint
* ran here with its `recommended` rules and no plugins; the Oxlint categories
* in `vite.config.ts` plus the rule list below keep at least that coverage.
* Its rules of its own are `no-disable-comments` and `no-non-ts-imports`.
* `project` — lint rules this repository holds its own source to, on top of
* the Oxlint categories in `vite.config.ts`. Its rules of its own are `no-disable-comments` and `no-non-ts-imports`.
*
* Loaded by `vite.config.ts` as an Oxlint `jsPlugins` entry.
*
@@ -150,9 +148,8 @@ const noNonTsImportsRule: ProjectRule = {
};
/**
* This repository's own rule list, spread by `vite.config.ts`: Deno's
* `recommended` rules that sit outside the Oxlint categories, plus the
* template's extras. Built-in Oxlint rule ids sit here too, so
* This repository's own rule list, spread by `vite.config.ts`: rules that
* sit outside the Oxlint categories, plus the template's extras. Built-in Oxlint rule ids sit here too, so
* `vite.config.ts` lists no rule by name.
*/
const rules: DummyRuleMap = {
@@ -164,7 +161,7 @@ const rules: DummyRuleMap = {
"^_*[^_]*_*$|^[^a-z]*$",
{ properties: false, classFields: false, onlyDeclarations: false, ignoreDestructuring: true },
],
// Deno's `recommended` rules outside the categories.
// Rules outside the categories.
"no-array-constructor": "error",
"no-case-declarations": "error",
"no-empty": "error",
@@ -189,8 +186,7 @@ const rules: DummyRuleMap = {
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/triple-slash-reference": "error",
// Deno's `no-window`, `no-process-global`, and `no-node-globals`: on Node,
// these come from an explicit `node:` import instead of the global scope.
// On Node, these come from an explicit `node:` import instead of the global scope.
"no-restricted-globals": [
"error",
"window",
@@ -205,8 +201,7 @@ const rules: DummyRuleMap = {
"typescript/consistent-type-imports": "error",
"typescript/no-import-type-side-effects": "error",
"typescript/no-non-null-assertion": "error",
// Deno's `ban-untagged-ignore` and `ban-unused-ignore`, made stricter: no
// disable comments at all.
// No disable comments at all.
"project/no-disable-comments": "error",
"project/no-non-ts-imports": "error",
"unicorn/no-abusive-eslint-disable": "error",