@shivaedev/quality 0.53.0 → 0.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -2
- package/dist/baseline/cleanupMergeFiles.d.ts +4 -0
- package/dist/baseline/cleanupMergeFiles.d.ts.map +1 -0
- package/dist/baseline/cleanupMergeFiles.js +23 -0
- package/dist/baseline/cleanupMergeFiles.js.map +1 -0
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +2 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/imports/departures.d.ts.map +1 -1
- package/dist/imports/departures.js +13 -0
- package/dist/imports/departures.js.map +1 -1
- package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.js +5 -2
- package/dist/rules/files/namedAfterExport.js.map +1 -1
- package/dist/rules/imports/aliased.js +1 -1
- package/dist/rules/imports/aliased.js.map +1 -1
- package/package.json +2 -2
- package/src/baseline/cleanupMergeFiles.ts +27 -0
- package/src/cli/program.ts +2 -0
- package/src/imports/departures.ts +16 -0
- package/src/rules/files/namedAfterExport.ts +5 -2
- package/src/rules/imports/aliased.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.53.1 - 2026-11-01
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Allow specific admin file names such as `inboxRoutes.ts` inside a module's `client/admin/` and `server/admin/` folders without treating the module name as a repeated prefix. File names must still match their exports.
|
|
8
|
+
- Allow a module's client or server registration to import its own admin subtree through `./admin/…`. Other relative imports that leave their folder still require aliases.
|
|
9
|
+
- Remove untracked repository-root `.merge_file_*` leftovers older than five minutes when the baseline merge driver starts. Preserve the current merge's inputs, tracked files and recent files.
|
|
10
|
+
|
|
3
11
|
## 0.53.0 - 2026-11-01
|
|
4
12
|
|
|
5
13
|
### Added
|
package/README.md
CHANGED
|
@@ -285,8 +285,8 @@ For adoption, run `quality baseline write --rule code/unused --file src/legacy.t
|
|
|
285
285
|
- **Documentation:** `docs/references` checks every Markdown file in the sources except `CHANGELOG.md`, whose released history keeps the links of its release. Relative links, reference definitions and `href`/`src` attributes reach an existing file or folder inside the repository, and a heading anchor matches one GitHub forms from the target's headings. A link to the repository's own GitHub tree, named by the root `package.json` `repository` field, is checked like a relative one unless it is pinned to a commit or a release tag. A published workspace package's README is shown on npm without the repository around it, so its links that leave the package use absolute URLs. Imports in TypeScript and JavaScript code blocks, workspace module paths such as `@scope/lib/repository.ts` written as inline code, `` `name` from `module` `` phrases and a package README's API rows resolve through the owning package's `exports` to an exported module, and every named import exists in that module unless it re-exports another. A linked document such as `CLAUDE.md` beside `AGENTS.md` is checked once, through its target. `docs/unversioned-installs` rejects a version after a package name in install commands, in shell code blocks and inline code; the package's own version ranges decide what installs, and a written version goes stale with the next release. A dist-tag such as `latest` passes.
|
|
286
286
|
- **Hidden casts:** `suppressions/no-double-cast` also checks code outside `adapters/` and `test-support/` for concrete annotations on `JSON.parse` results, unchecked `Reflect.get` bindings, SQL tagged-template row generics, identity overloads whose implementation returns `unknown`, context retagging through `Context.makeUnsafe(...mapUnsafe)`, and writes to readonly properties or native Scope state. Keep untrusted values as `unknown` and decode them with `Schema.decodeUnknownEffect`; decode SQL rows with `SqlSchema` rather than declaring their shape. Give an identity implementation its declared return type, preserve the Context service type, and use native constructors or lifecycle operations instead of changing native fields. Constructor initialization, mutable object writes and extensions that do not replace readonly fields are accepted. These checks read syntax and TypeScript declarations; they do not prove that arbitrary helper functions validate their input.
|
|
287
287
|
- **Suppressions:** the `suppressions/*` rules reject inline lint and compiler directives, casts through `unknown`, `any` or `never`, Biome settings that weaken a check, recommended Biome rules the preset leaves below `error`, and `ignoreDeprecations`. None of them takes exceptions. A type test (`*.typecheck.test.ts`) may use `@ts-expect-error`; a test that must pass a rejected value at run time calls the API through `Reflect.apply`.
|
|
288
|
-
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports that leave their folder, production imports of test code, runtime folders and fences, as described above.
|
|
289
|
-
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. `files/named-after-export` accepts a file named after its single exported constant, such as `liveQueryWindow.ts` exporting `const liveQueryWindow`. It keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
288
|
+
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports that leave their folder (except a module’s client or server `registration.ts` or `registration.tsx` importing its own `./admin/` subtree), production imports of test code, runtime folders and fences, as described above.
|
|
289
|
+
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. `files/named-after-export` accepts a file named after its single exported constant, such as `liveQueryWindow.ts` exporting `const liveQueryWindow`. It keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. Inside a module’s `client/admin/` or `server/admin/` subtree, file names may repeat words from above `admin/`: `src/modules/inbox/client/admin/inboxRoutes.ts` may export `inboxRoutes`. Names must still match their exports and omit words repeated by folders within the admin subtree. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
290
290
|
- **React:** `react/jsx-conditionals` reports `&&` and ternaries in the JSX children a component returns, including nested decisions and returned `.map` items. Decisions in a `const` above the return, JSX built inside library callbacks and conditional attributes are accepted. A ternary with two plain string or number literal branches, such as `{on ? "On" : "Off"}`, is accepted; branches that select JSX, components or computed values still need a decision before the JSX. This rule owns the check, so the shared Biome preset leaves `noLeakedRender` off.
|
|
291
291
|
- **Tests:** `tests/follow` and `tests/colocated` keep a test beside the code it covers, named `<file>[.<modifier>].test.ts` or `<behaviour>[.<modifier>].spec.ts` with at most one modifier of `dom`, `slow`, `typecheck` and `unit`; a unit test runs without the DOM, so `.unit.dom` is rejected. `tests/colocated` always treats `__tests__/` as a test folder. It treats `test/`, `tests/` and `spec/` as test folders only when their directly contained checked files are all tests or test support; a product folder with source beside its specs is an ordinary source folder. Declared `suites` keep their own layout. Shared test support belongs in `test-support/`, the sanctioned test-only folder. A test covering a whole module may sit at its root or directly beside its folder. The story rules above keep setup in the kit.
|
|
292
292
|
- **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path. Read failures other than `NotFound` fail the scan. `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members with exports. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `source`, `types` and `default`. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry and exact-path non-code assets such as JSON presets and `./package.json` are allowed. Every module remains importable; `null` export entries fail with a request to remove the block. A package without modules, such as a dependency shell, exports only exact assets and needs no wildcard. Import each module at its path under `src/`; named aliases, flattened paths, per-file module lists and additional wildcards fail. `manifests/application` keeps an application on its entry points, as described above.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Effect, FileSystem } from "effect";
|
|
2
|
+
import { SetupFailure } from "#failure.ts";
|
|
3
|
+
export declare const cleanupMergeFiles: (cwd: string, inputs: readonly string[]) => Effect.Effect<void, SetupFailure, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | FileSystem.FileSystem>;
|
|
4
|
+
//# sourceMappingURL=cleanupMergeFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanupMergeFiles.d.ts","sourceRoot":"","sources":["../../src/baseline/cleanupMergeFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,UAAU,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,eAAO,MAAM,iBAAiB,yKAmB7B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { Clock, Effect, FileSystem, Option } from "effect";
|
|
3
|
+
import { SetupFailure } from "#failure.ts";
|
|
4
|
+
import { gitOrFail } from "#git/command.ts";
|
|
5
|
+
const STALE_AFTER_MS = 5 * 60_000;
|
|
6
|
+
export const cleanupMergeFiles = Effect.fn("Baseline.cleanupMergeFiles")(function* (cwd, inputs) {
|
|
7
|
+
const fs = yield* FileSystem.FileSystem;
|
|
8
|
+
const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
|
|
9
|
+
const active = new Set(inputs.map((path) => resolve(cwd, path)));
|
|
10
|
+
const untracked = yield* gitOrFail(root, ["ls-files", "--others", "--full-name", "-z", "--", ":(top,glob).merge_file_*"]);
|
|
11
|
+
const cutoff = (yield* Clock.currentTimeMillis) - STALE_AFTER_MS;
|
|
12
|
+
for (const name of untracked.split("\0").filter(Boolean)) {
|
|
13
|
+
const path = resolve(root, name);
|
|
14
|
+
if (active.has(path)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const info = yield* fs.stat(path);
|
|
18
|
+
if (info.type === "File" && Option.exists(info.mtime, (mtime) => mtime.getTime() < cutoff)) {
|
|
19
|
+
yield* fs.remove(path);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
|
|
23
|
+
//# sourceMappingURL=cleanupMergeFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanupMergeFiles.js","sourceRoot":"","sources":["../../src/baseline/cleanupMergeFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,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AI,KAAK,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;YAC5F,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACF,CAAC;AACF,CAAC,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAC5F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,QAAQ,CAAC;AAazC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQhD,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,OAAO,yMAyClB,CAAC"}
|
package/dist/cli/program.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Console, Effect } from "effect";
|
|
2
|
+
import { cleanupMergeFiles } from "#baseline/cleanupMergeFiles.ts";
|
|
2
3
|
import { installDriver } from "#baseline/installDriver.ts";
|
|
3
4
|
import { mergeBaseline } from "#baseline/merge.ts";
|
|
4
5
|
import { parseCommand } from "#cli/args.ts";
|
|
@@ -35,6 +36,7 @@ export const program = Effect.fn("Cli.program")(function* (args, { cwd, launch }
|
|
|
35
36
|
case "Fix":
|
|
36
37
|
return yield* command.rules.length === 0 ? fix(cwd, command.config) : fixRule(cwd, command.config, command.rules);
|
|
37
38
|
case "BaselineMerge":
|
|
39
|
+
yield* cleanupMergeFiles(cwd, [command.base, command.ours, command.theirs]);
|
|
38
40
|
return yield* mergeBaseline(command.base, command.ours, command.theirs);
|
|
39
41
|
case "BaselineInstallDriver":
|
|
40
42
|
return yield* installDriver(cwd, launch);
|
package/dist/cli/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OA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,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1F,KAAK,gBAAgB;YACpB,OAAO,KAAK,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAClC,KAAK,aAAa;YACjB,OAAO,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,gBAAgB;YACpB,OAAO,KAAK,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;AACF,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AAGrE,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AA2DD,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAalF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { posix } from "node:path";
|
|
3
|
+
import { moduleRoot } from "#naming/moduleRoot.ts";
|
|
3
4
|
import { parse } from "#rules/parse.ts";
|
|
4
5
|
import { projectsFor } from "./projects.js";
|
|
5
6
|
import { resolveImport } from "./resolve.js";
|
|
@@ -16,6 +17,15 @@ function leavesLexically(path) {
|
|
|
16
17
|
const normal = posix.normalize(path).replace(TRAILING_SLASHES, "");
|
|
17
18
|
return normal === ".." || normal.startsWith("../") || normal.includes("/");
|
|
18
19
|
}
|
|
20
|
+
function registersAdmin(from, specifier, target) {
|
|
21
|
+
const root = moduleRoot(from);
|
|
22
|
+
const folder = posix.dirname(from);
|
|
23
|
+
return (root !== undefined
|
|
24
|
+
&& (folder === `${root}/client` || folder === `${root}/server`)
|
|
25
|
+
&& /^registration\.[cm]?[jt]sx?$/u.test(posix.basename(from))
|
|
26
|
+
&& specifier.startsWith("./admin/")
|
|
27
|
+
&& target?.startsWith(`${folder}/admin/`) === true);
|
|
28
|
+
}
|
|
19
29
|
// A relative import leaves its folder when its path climbs or descends, or when it names a folder whose index file lies below.
|
|
20
30
|
function departureAt(context, site) {
|
|
21
31
|
const path = site.specifier.replace(QUERY, "");
|
|
@@ -25,6 +35,9 @@ function departureAt(context, site) {
|
|
|
25
35
|
const request = { kind: "import", line: site.line, specifier: site.specifier, type: site.type };
|
|
26
36
|
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
27
37
|
const local = target?.kind === "file" ? target.path : undefined;
|
|
38
|
+
if (registersAdmin(context.path, path, local)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
28
41
|
if (!(leavesLexically(path) || (local !== undefined && posix.dirname(local) !== posix.dirname(context.path)))) {
|
|
29
42
|
return undefined;
|
|
30
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"departures.js","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"departures.js","sourceRoot":"","sources":["../../src/imports/departures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAA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E,IAAI,EAAE,CAAC;QACpF,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namedAfterExport.d.ts","sourceRoot":"","sources":["../../../src/rules/files/namedAfterExport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"namedAfterExport.d.ts","sourceRoot":"","sources":["../../../src/rules/files/namedAfterExport.ts"],"names":[],"mappings":"AAsFA,eAAO,MAAM,gBAAgB;;;;;SAa3B,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { GlobDeclarations, globPatterns, validateGlobs } from "#config/globs.ts"
|
|
|
5
5
|
import { exportFits } from "#naming/exportFits.ts";
|
|
6
6
|
import { mainExport } from "#naming/mainExport.ts";
|
|
7
7
|
import { isMigrationFile } from "#naming/migrationFile.ts";
|
|
8
|
+
import { moduleRoot } from "#naming/moduleRoot.ts";
|
|
8
9
|
import { ownExports } from "#naming/ownExports.ts";
|
|
9
10
|
import { packageLayout } from "#naming/packageLayout.ts";
|
|
10
11
|
import { CAMEL, KEBAB, sameWord, wordsOf } from "#naming/words.ts";
|
|
@@ -63,7 +64,9 @@ function findingsOf(file, layout) {
|
|
|
63
64
|
? []
|
|
64
65
|
: [{ file: file.path, message: `"${stem}" is run as a script, so it is named in kebab-case, such as build-docs.ts.` }];
|
|
65
66
|
}
|
|
66
|
-
const
|
|
67
|
+
const root = moduleRoot(file.path);
|
|
68
|
+
const admin = root === undefined ? undefined : /^(?:client|server)\/(?<path>admin\/.+)$/u.exec(file.path.slice(root.length + 1))?.groups?.path;
|
|
69
|
+
const folder = repeated(stem, admin === undefined ? folders : posix.dirname(admin).split("/"));
|
|
67
70
|
const messages = [
|
|
68
71
|
nameFinding(file, stem, folders),
|
|
69
72
|
folder === undefined ? undefined : `"${stem}" repeats its folder "${folder}". The folder is the prefix: items/listItems.ts is items/list.ts.`,
|
|
@@ -78,7 +81,7 @@ export const namedAfterExport = defineRule({
|
|
|
78
81
|
.filter((file) => !(TEST.test(file.path) || isMigrationFile(file.path) || toolOwned.ignores(file.path)))
|
|
79
82
|
.flatMap((file) => findingsOf(file, layout));
|
|
80
83
|
},
|
|
81
|
-
description: "A file is named after its main export, including a single constant, with its folders as the prefix;
|
|
84
|
+
description: "A file is named after its main export, including a single constant, with its folders as the prefix; module client/admin and server/admin files may repeat names from above the admin folder. A file of several exports is a camelCase topic file, and a script is kebab-case. Rename the file or the export; nothing renames them for you.",
|
|
82
85
|
id: "files/named-after-export",
|
|
83
86
|
options: Schema.toStandardSchemaV1(NamedAfterExportOptions, { parseOptions: { errors: "all", onExcessProperty: "error" } }),
|
|
84
87
|
validate: validateGlobs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namedAfterExport.js","sourceRoot":"","sources":["../../../src/rules/files/namedAfterExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAsB,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnE,O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CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,WAAW,EACV,4UAA4U;IAC7U,EAAE,EAAE,0BAA0B;IAC9B,OAAO,EAAE,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,EAAE,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC;IAC3H,QAAQ,EAAE,aAAa;CACvB,CAAC,CAAC"}
|
|
@@ -17,7 +17,7 @@ export const importsAliased = defineRule({
|
|
|
17
17
|
message: messageOf(departure),
|
|
18
18
|
subject: departure.specifier,
|
|
19
19
|
})),
|
|
20
|
-
description: "A relative import names only a file in its own folder. Every other import goes through an alias: the package.json `imports` of its package or another workspace package's name.",
|
|
20
|
+
description: "A relative import names only a file in its own folder, except a module's client or server registration may import its own ./admin/ subtree. Every other import goes through an alias: the package.json `imports` of its package or another workspace package's name.",
|
|
21
21
|
id: "imports/aliased",
|
|
22
22
|
});
|
|
23
23
|
//# sourceMappingURL=aliased.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aliased.js","sourceRoot":"","sources":["../../../src/rules/imports/aliased.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa;IAChE,MAAM,MAAM,GAAG,IAAI,SAAS,sBAAsB,CAAC;IACnD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,MAAM,0CAA0C,SAAS,oCAAoC,CAAC;IACzG,CAAC;IACD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,MAAM,0CAA0C,SAAS,4EAA4E,CAAC;IACjJ,CAAC;IACD,OAAO,GAAG,MAAM,6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E,SAAS,CAAC,IAAI;QACpB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC;QAC7B,OAAO,EAAE,SAAS,CAAC,SAAS;KAC5B,CAAC,CAAC;IACJ,WAAW,EACV,sQAAsQ;IACvQ,EAAE,EAAE,iBAAiB;CACrB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/quality",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.1",
|
|
4
4
|
"description": "Repository quality gate with typed rules, a baseline of existing debt and a registry of reasoned exceptions",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/quality#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@effect/platform-node": "4.0.6",
|
|
64
64
|
"@effect/platform-node-shared": "4.0.6",
|
|
65
65
|
"@effect/vitest": "4.0.6",
|
|
66
|
-
"@shivaedev/test-story": "0.31.
|
|
66
|
+
"@shivaedev/test-story": "0.31.4",
|
|
67
67
|
"@types/node": "24.19.2",
|
|
68
68
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
69
69
|
"effect": "4.0.6",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { Clock, Effect, FileSystem, Option } from "effect";
|
|
3
|
+
import { SetupFailure } from "#failure.ts";
|
|
4
|
+
import { gitOrFail } from "#git/command.ts";
|
|
5
|
+
|
|
6
|
+
const STALE_AFTER_MS = 5 * 60_000;
|
|
7
|
+
|
|
8
|
+
export const cleanupMergeFiles = Effect.fn("Baseline.cleanupMergeFiles")(
|
|
9
|
+
function* (cwd: string, inputs: readonly string[]) {
|
|
10
|
+
const fs = yield* FileSystem.FileSystem;
|
|
11
|
+
const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
|
|
12
|
+
const active = new Set(inputs.map((path) => resolve(cwd, path)));
|
|
13
|
+
const untracked = yield* gitOrFail(root, ["ls-files", "--others", "--full-name", "-z", "--", ":(top,glob).merge_file_*"]);
|
|
14
|
+
const cutoff = (yield* Clock.currentTimeMillis) - STALE_AFTER_MS;
|
|
15
|
+
for (const name of untracked.split("\0").filter(Boolean)) {
|
|
16
|
+
const path = resolve(root, name);
|
|
17
|
+
if (active.has(path)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const info = yield* fs.stat(path);
|
|
21
|
+
if (info.type === "File" && Option.exists(info.mtime, (mtime) => mtime.getTime() < cutoff)) {
|
|
22
|
+
yield* fs.remove(path);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })),
|
|
27
|
+
);
|
package/src/cli/program.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Console, Effect } from "effect";
|
|
2
|
+
import { cleanupMergeFiles } from "#baseline/cleanupMergeFiles.ts";
|
|
2
3
|
import { installDriver } from "#baseline/installDriver.ts";
|
|
3
4
|
import { mergeBaseline } from "#baseline/merge.ts";
|
|
4
5
|
import { parseCommand } from "#cli/args.ts";
|
|
@@ -42,6 +43,7 @@ export const program = Effect.fn("Cli.program")(function* (args: readonly string
|
|
|
42
43
|
case "Fix":
|
|
43
44
|
return yield* command.rules.length === 0 ? fix(cwd, command.config) : fixRule(cwd, command.config, command.rules);
|
|
44
45
|
case "BaselineMerge":
|
|
46
|
+
yield* cleanupMergeFiles(cwd, [command.base, command.ours, command.theirs]);
|
|
45
47
|
return yield* mergeBaseline(command.base, command.ours, command.theirs);
|
|
46
48
|
case "BaselineInstallDriver":
|
|
47
49
|
return yield* installDriver(cwd, launch);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { posix } from "node:path";
|
|
3
|
+
import { moduleRoot } from "#naming/moduleRoot.ts";
|
|
3
4
|
import type { RuleInputs } from "#rule.ts";
|
|
4
5
|
import { parse } from "#rules/parse.ts";
|
|
5
6
|
import type { ImportRequest } from "./extract.ts";
|
|
@@ -39,6 +40,18 @@ interface FileContext {
|
|
|
39
40
|
readonly root: string;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
function registersAdmin(from: string, specifier: string, target: string | undefined): boolean {
|
|
44
|
+
const root = moduleRoot(from);
|
|
45
|
+
const folder = posix.dirname(from);
|
|
46
|
+
return (
|
|
47
|
+
root !== undefined
|
|
48
|
+
&& (folder === `${root}/client` || folder === `${root}/server`)
|
|
49
|
+
&& /^registration\.[cm]?[jt]sx?$/u.test(posix.basename(from))
|
|
50
|
+
&& specifier.startsWith("./admin/")
|
|
51
|
+
&& target?.startsWith(`${folder}/admin/`) === true
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
// A relative import leaves its folder when its path climbs or descends, or when it names a folder whose index file lies below.
|
|
43
56
|
function departureAt(context: FileContext, site: SpecifierSite): Departure | undefined {
|
|
44
57
|
const path = site.specifier.replace(QUERY, "");
|
|
@@ -48,6 +61,9 @@ function departureAt(context: FileContext, site: SpecifierSite): Departure | und
|
|
|
48
61
|
const request: ImportRequest = { kind: "import", line: site.line, specifier: site.specifier, type: site.type };
|
|
49
62
|
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
50
63
|
const local = target?.kind === "file" ? target.path : undefined;
|
|
64
|
+
if (registersAdmin(context.path, path, local)) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
51
67
|
if (!(leavesLexically(path) || (local !== undefined && posix.dirname(local) !== posix.dirname(context.path)))) {
|
|
52
68
|
return undefined;
|
|
53
69
|
}
|
|
@@ -5,6 +5,7 @@ import { GlobDeclarations, globPatterns, validateGlobs } from "#config/globs.ts"
|
|
|
5
5
|
import { exportFits } from "#naming/exportFits.ts";
|
|
6
6
|
import { mainExport } from "#naming/mainExport.ts";
|
|
7
7
|
import { isMigrationFile } from "#naming/migrationFile.ts";
|
|
8
|
+
import { moduleRoot } from "#naming/moduleRoot.ts";
|
|
8
9
|
import { ownExports } from "#naming/ownExports.ts";
|
|
9
10
|
import { type PackageLayout, packageLayout } from "#naming/packageLayout.ts";
|
|
10
11
|
import { CAMEL, KEBAB, sameWord, wordsOf } from "#naming/words.ts";
|
|
@@ -73,7 +74,9 @@ function findingsOf(file: SourceFile, layout: PackageLayout): readonly Finding[]
|
|
|
73
74
|
? []
|
|
74
75
|
: [{ file: file.path, message: `"${stem}" is run as a script, so it is named in kebab-case, such as build-docs.ts.` }];
|
|
75
76
|
}
|
|
76
|
-
const
|
|
77
|
+
const root = moduleRoot(file.path);
|
|
78
|
+
const admin = root === undefined ? undefined : /^(?:client|server)\/(?<path>admin\/.+)$/u.exec(file.path.slice(root.length + 1))?.groups?.path;
|
|
79
|
+
const folder = repeated(stem, admin === undefined ? folders : posix.dirname(admin).split("/"));
|
|
77
80
|
const messages = [
|
|
78
81
|
nameFinding(file, stem, folders),
|
|
79
82
|
folder === undefined ? undefined : `"${stem}" repeats its folder "${folder}". The folder is the prefix: items/listItems.ts is items/list.ts.`,
|
|
@@ -90,7 +93,7 @@ export const namedAfterExport = defineRule({
|
|
|
90
93
|
.flatMap((file) => findingsOf(file, layout));
|
|
91
94
|
},
|
|
92
95
|
description:
|
|
93
|
-
"A file is named after its main export, including a single constant, with its folders as the prefix;
|
|
96
|
+
"A file is named after its main export, including a single constant, with its folders as the prefix; module client/admin and server/admin files may repeat names from above the admin folder. A file of several exports is a camelCase topic file, and a script is kebab-case. Rename the file or the export; nothing renames them for you.",
|
|
94
97
|
id: "files/named-after-export",
|
|
95
98
|
options: Schema.toStandardSchemaV1(NamedAfterExportOptions, { parseOptions: { errors: "all", onExcessProperty: "error" } }),
|
|
96
99
|
validate: validateGlobs,
|
|
@@ -21,6 +21,6 @@ export const importsAliased = defineRule({
|
|
|
21
21
|
subject: departure.specifier,
|
|
22
22
|
})),
|
|
23
23
|
description:
|
|
24
|
-
"A relative import names only a file in its own folder. Every other import goes through an alias: the package.json `imports` of its package or another workspace package's name.",
|
|
24
|
+
"A relative import names only a file in its own folder, except a module's client or server registration may import its own ./admin/ subtree. Every other import goes through an alias: the package.json `imports` of its package or another workspace package's name.",
|
|
25
25
|
id: "imports/aliased",
|
|
26
26
|
});
|