@syntopica/quality-config 0.15.0 → 0.17.0
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 +519 -0
- package/PUBLIC_API.md +33 -0
- package/README.md +25 -0
- package/bin/auditLevels.mjs +1 -0
- package/bin/baseline-audit.mjs +25 -140
- package/bin/baseline-changes.mjs +49 -0
- package/bin/baseline-deps-graph.mjs +73 -81
- package/bin/baseline-dupes.mjs +3 -3
- package/bin/baseline-type-coverage.mjs +8 -8
- package/bin/classifyAuditAdvisories.mjs +22 -0
- package/bin/compareVersions.mjs +11 -0
- package/bin/cruiseWorkspaceSelection.mjs +5 -0
- package/bin/defaultCruiseSources.mjs +1 -0
- package/bin/findChanges.mjs +23 -0
- package/bin/findCruiseWorkspaces.mjs +18 -0
- package/bin/formatChanges.mjs +25 -0
- package/bin/isReplaceableStamp.mjs +12 -0
- package/bin/localNodeToolCommand.mjs +18 -0
- package/bin/maxCruiseDepth.mjs +1 -0
- package/bin/normalizeVersion.mjs +8 -0
- package/bin/parseAuditArguments.mjs +16 -0
- package/bin/parseChangelog.mjs +21 -0
- package/bin/parseCruiseArguments.mjs +30 -0
- package/bin/presentCruiseSources.mjs +11 -0
- package/bin/readAuditAllowlist.mjs +28 -0
- package/bin/readAuditReport.mjs +18 -0
- package/bin/readCruiseCompilerOptions.mjs +18 -0
- package/bin/readInstalledPackages.mjs +42 -0
- package/bin/readVersionStamp.mjs +11 -0
- package/bin/rebaseCruisePaths.mjs +40 -0
- package/bin/reportAuditOutcome.mjs +28 -0
- package/bin/runPackageAudit.mjs +13 -0
- package/bin/runSynchronousCruise.mjs +11 -0
- package/bin/sectionsBetween.mjs +11 -0
- package/bin/skippedCruiseDirectories.mjs +12 -0
- package/bin/spawnCruise.mjs +8 -0
- package/bin/splitActionRequired.mjs +21 -0
- package/bin/throwCruiseConfigDiagnostic.mjs +5 -0
- package/bin/validateAuditReport.mjs +105 -0
- package/bin/withCruiseTsconfig.d.mts +5 -0
- package/bin/withCruiseTsconfig.mjs +42 -0
- package/bin/writeVersionStamp.mjs +27 -0
- package/jscpd.json +7 -2
- package/package.json +16 -10
- package/src/LefthookOptions.ts +5 -0
- package/src/TADU_BACKLOG_PATHS.ts +7 -0
- package/src/dependency-cruiser.ts +4 -1
- package/src/knip-framework.ts +4 -4
- package/src/knip.ts +11 -2
- package/src/lefthook.ts +55 -31
- package/src/readInstalledDependencyNames.ts +30 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
# @syntopica/quality-config
|
|
2
|
+
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
- feat: `baseline-changes` compares the installed `@syntopica/*` and
|
|
6
|
+
`eslint-plugin-code-policy` versions with `.baseline-versions.json` and prints
|
|
7
|
+
the `CHANGELOG.md` sections of every release in between, each
|
|
8
|
+
`### Action required` subsection first, then records the installed versions.
|
|
9
|
+
It exits 0, and does not write under `CI` or with `--no-write`.
|
|
10
|
+
- The published package now includes `CHANGELOG.md`.
|
|
11
|
+
|
|
12
|
+
- feat: `createLefthookConfig({ tadu: true })` excludes the tadu backlog from
|
|
13
|
+
the lint and format hooks and adds a `backlog` hook that runs `tadu doctor .`
|
|
14
|
+
when tadu is installed.
|
|
15
|
+
|
|
16
|
+
## 0.16.0
|
|
17
|
+
|
|
18
|
+
- fix: include imported CSS in Vite React, Vite Vue, Tauri and Nuxt project
|
|
19
|
+
patterns so Knip follows compiled stylesheet imports in normal and production
|
|
20
|
+
analysis.
|
|
21
|
+
|
|
22
|
+
- fix: resolve the consumer-installed jscpd and type-coverage CLI entries
|
|
23
|
+
directly, including hoisted workspace dependencies, instead of requiring pnpm
|
|
24
|
+
or invoking another package manager.
|
|
25
|
+
|
|
26
|
+
- Export `@syntopica/quality-config/cruise-tsconfig` to preserve TypeScript
|
|
27
|
+
alias origins for dependency-cruiser.
|
|
28
|
+
|
|
29
|
+
- Validate the structure of package audit reports and report incomplete results.
|
|
30
|
+
|
|
31
|
+
- Keep runtime-used development dependencies visible in Knip production analysis
|
|
32
|
+
and remove stale compatibility hints.
|
|
33
|
+
|
|
34
|
+
## 0.15.0
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- fix: omit missing preset entry files and source roots from Knip configuration,
|
|
39
|
+
while preserving caller-supplied patterns. Custom ESLint configurations no
|
|
40
|
+
longer inherit dependency exemptions intended for `@syntopica/eslint-config`
|
|
41
|
+
consumers.
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- feat: `jscpd.json` scans `dart` and `swift` too, and ignores generated Dart
|
|
46
|
+
(`*.g.dart`, `*.freezed.dart`) and Dart/Swift build output (`.dart_tool`,
|
|
47
|
+
`build`, `.build`). `codeality-dart` and `codeality-swift` embed these
|
|
48
|
+
defaults, kept in step by `pnpm sync-jscpd:check`.
|
|
49
|
+
|
|
50
|
+
## 0.14.0
|
|
51
|
+
|
|
52
|
+
### Minor Changes
|
|
53
|
+
|
|
54
|
+
- feat: `createDepCruiserConfig({ moduleRoots })` adds
|
|
55
|
+
`no-deep-cross-module-import`: under each named root, a module may reach
|
|
56
|
+
another only through its `index`, judged on resolved paths. Opt-in.
|
|
57
|
+
- feat: `createKnipConfig` supports `knip --production`. Each preset marks its
|
|
58
|
+
runtime entries and sources as production code and excludes tests, mocks and
|
|
59
|
+
stories in that mode, so it no longer reports runtime dependencies (`vue`,
|
|
60
|
+
`zod`, `@nestjs/core`) as unused. Framework packages read only by their config
|
|
61
|
+
(`astro`, `nuxt`) are ignored in production mode only. The default run is
|
|
62
|
+
unchanged.
|
|
63
|
+
|
|
64
|
+
## 0.13.2
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- fix: `createKnipConfig` no longer fails a template whose `check:quality` runs
|
|
69
|
+
`pnpm type-coverage`. A word that only runs another `package.json` script
|
|
70
|
+
(`pnpm <script>`, `pnpm run <script>`) is no longer read as naming the binary,
|
|
71
|
+
so `type-coverage` stays ignored instead of reported unused.
|
|
72
|
+
- fix: `lefthook` is left out of `ignoreDependencies` when a Lefthook
|
|
73
|
+
configuration file exists, since knip's Lefthook plugin then resolves it
|
|
74
|
+
itself (from `CI`, or from the installed git hooks).
|
|
75
|
+
- fix: an ESLint peer another installed dependency declares as its own peer
|
|
76
|
+
(`typescript-eslint`, hosted by `eslint-plugin-astro`) is no longer ignored:
|
|
77
|
+
knip counts it as used, so the entry was a `Remove from ignoreDependencies`
|
|
78
|
+
hint.
|
|
79
|
+
|
|
80
|
+
## 0.13.1
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- fix: `createKnipConfig` no longer leaves configuration hints in a CLI-shaped
|
|
85
|
+
`ts-package` consumer. A caller-supplied `entry` now drops the preset's
|
|
86
|
+
default `src/index.ts` when that file does not exist (it is kept when it does,
|
|
87
|
+
so a library with both an index and a CLI behaves as before), and
|
|
88
|
+
`dependency-cruiser`, `lefthook`, `jscpd` and `type-coverage` are added to
|
|
89
|
+
`ignoreDependencies` only when no `package.json` script names their binary
|
|
90
|
+
directly. When a script does (`"prepare": "lefthook install"`,
|
|
91
|
+
`"deps:graph": "depcruise src"`), knip resolves the package itself and the
|
|
92
|
+
entry used to be a permanent `Remove from ignoreDependencies` hint. New
|
|
93
|
+
optional `cwd` option (defaults to the process cwd) for the project root.
|
|
94
|
+
|
|
95
|
+
## 0.13.0
|
|
96
|
+
|
|
97
|
+
### Minor Changes
|
|
98
|
+
|
|
99
|
+
- feat: `baseline-hooks-install` runs `lefthook install` only from the git
|
|
100
|
+
repository root. Wired into `prepare` instead of a bare `lefthook install`, it
|
|
101
|
+
stops a workspace's packages from rewriting the root's `.git/hooks` in
|
|
102
|
+
parallel, which failed `pnpm install` with
|
|
103
|
+
`could not replace the hook: remove .git/hooks/pre-push`.
|
|
104
|
+
|
|
105
|
+
## 0.12.1
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- fix: knip findings every template reported. `gitleaks`, a system binary the
|
|
110
|
+
baseline wires into `secrets:check`, is ignored by default; the nextjs preset
|
|
111
|
+
no longer lists `middleware` and `proxy`, which knip's Next plugin registers;
|
|
112
|
+
the Vite presets no longer list `src/main`, which `index.html` already
|
|
113
|
+
reaches.
|
|
114
|
+
|
|
115
|
+
## 0.12.0
|
|
116
|
+
|
|
117
|
+
### Minor Changes
|
|
118
|
+
|
|
119
|
+
- feat: `baseline-type-coverage --at-least` accepts a value above the shared
|
|
120
|
+
threshold, up to 100, so a repository that has climbed past the shared floor
|
|
121
|
+
can pin its coverage there. A value equal to the shared threshold is still
|
|
122
|
+
refused as a restatement.
|
|
123
|
+
|
|
124
|
+
## 0.11.1
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- fix: knip's `includeEntryExports` now defaults per framework.
|
|
129
|
+
|
|
130
|
+
knip 6.35 started applying the option to the files its own plugins register,
|
|
131
|
+
so `export default defineConfig(...)` in a vite, astro or nuxt config, and a
|
|
132
|
+
Next.js route's `default`/`metadata`, all reported as unused exports - in six
|
|
133
|
+
of the eight templates, with no export a project could remove. It is now true
|
|
134
|
+
only where the entries are hand-written (`nestjs`, `ts-package`), which is
|
|
135
|
+
where the check ever found anything, and false where the framework owns them.
|
|
136
|
+
|
|
137
|
+
- fix: dependency-cruiser excludes `.venv` and exempts `.d.mts`/`.d.cts`.
|
|
138
|
+
|
|
139
|
+
A repository with a uv project cruised the virtualenv's vendored JavaScript
|
|
140
|
+
and failed on four orphan modules it does not own; a package shipping types
|
|
141
|
+
beside an `.mjs` entry failed on the declaration file itself.
|
|
142
|
+
|
|
143
|
+
- fix: run pnpm through an entry point Node can execute.
|
|
144
|
+
|
|
145
|
+
`baseline-type-coverage`, `baseline-dupes`, `baseline-audit` and
|
|
146
|
+
`baseline-deps-graph` spawned `pnpm` directly. pnpm 11 puts a shebang-less
|
|
147
|
+
`sh` script at its bin path and replaces it with the native binary during
|
|
148
|
+
installation; where that replacement never ran, macOS answers `ENOEXEC` and
|
|
149
|
+
every one of those gates failed with empty output - `type-coverage: FAIL .` on
|
|
150
|
+
a repository measured at 99.82%, and `baseline-dupes: could not run jscpd`.
|
|
151
|
+
The gate blamed its subject for a broken launcher. The runners now resolve
|
|
152
|
+
`npm_execpath`, the executable `pnpm` on PATH, or the `bin/pnpm.mjs` the
|
|
153
|
+
placeholder hands over to, in that order.
|
|
154
|
+
|
|
155
|
+
## 0.11.0
|
|
156
|
+
|
|
157
|
+
### Minor Changes
|
|
158
|
+
|
|
159
|
+
- feat: `baseline-audit` - advisory waivers that expire.
|
|
160
|
+
|
|
161
|
+
`pnpm audit --audit-level=high` has one lever, and silencing a judged finding
|
|
162
|
+
means raising it for everything. `baseline-audit` reads
|
|
163
|
+
`.baseline-advisories.json`, keyed by GitHub advisory id, where each entry
|
|
164
|
+
carries a required `reason` and a required `expires`. An expired waiver fails
|
|
165
|
+
the build; an entry missing either field is rejected rather than honoured.
|
|
166
|
+
Because a judged finding now has somewhere to live, the default gate is
|
|
167
|
+
`moderate` rather than `high` - strictly stricter than before.
|
|
168
|
+
|
|
169
|
+
- feat: `baseline-licenses` - a licence gate for published packages.
|
|
170
|
+
|
|
171
|
+
Walks one package's _production_ closure and asserts every licence is
|
|
172
|
+
permissive, with the same `reason`/`expires` allowlist shape. Dev dependencies
|
|
173
|
+
are excluded on purpose: a copyleft test runner is not distributed, a copyleft
|
|
174
|
+
transitive runtime dependency of an MIT package is. `pnpm licenses list` is
|
|
175
|
+
not usable here - inside a workspace it reports the whole store, 986 packages
|
|
176
|
+
for a config package with eight direct dependencies.
|
|
177
|
+
|
|
178
|
+
- feat: `/commitlint` - conventional-commit rules for the `commit-msg` hook.
|
|
179
|
+
|
|
180
|
+
The release tooling already derived the semver bump and the changelog from
|
|
181
|
+
commit subjects, so a subject typed `feature:` instead of `feat:` silently
|
|
182
|
+
dropped a change out of the release notes. Nothing verified it. Two rules from
|
|
183
|
+
the conventional preset are off because they fight how commits are written
|
|
184
|
+
here: `body-max-line-length` rejects a pasted stack trace, `subject-case`
|
|
185
|
+
rejects a subject starting with `TypeScript` or `GitHub`.
|
|
186
|
+
|
|
187
|
+
- feat: `/oxlint` - a pre-filter config, one category wide.
|
|
188
|
+
|
|
189
|
+
`correctness` only. That is the set whose findings ESLint would also reject,
|
|
190
|
+
so oxlint can fail a build in seconds without introducing a second opinion.
|
|
191
|
+
Measured on this repository: `correctness` reported nothing, `suspicious` and
|
|
192
|
+
`pedantic` reported 19 findings, none of which ESLint considers a problem. See
|
|
193
|
+
`OXLINT.md` for why the scope is not wider.
|
|
194
|
+
|
|
195
|
+
- feat: `createLefthookConfig()` gains a `commit-msg` hook and a `lint:fast`
|
|
196
|
+
pre-commit command.
|
|
197
|
+
|
|
198
|
+
The typed lint stays the authority; the two-second pass runs first.
|
|
199
|
+
|
|
200
|
+
## 0.10.0
|
|
201
|
+
|
|
202
|
+
### Minor Changes
|
|
203
|
+
|
|
204
|
+
- fix: `baseline-type-coverage` measured nothing on a solution-style
|
|
205
|
+
`tsconfig.json` and reported `ok`.
|
|
206
|
+
|
|
207
|
+
A root `{"files": [], "references": [...]}` contributes no source of its own,
|
|
208
|
+
so type-coverage measured 0 identifiers and exited 0 -- a green gate over an
|
|
209
|
+
entire repository. consumer-g reported `ok . 0 / 0` and had to keep a
|
|
210
|
+
hand-written runner. Solution configs now contribute their referenced projects
|
|
211
|
+
instead, each measured with `-p`: the same tree reports 194,942 / 195,652,
|
|
212
|
+
41,214 / 41,415 and 184,008 / 184,671.
|
|
213
|
+
|
|
214
|
+
- fix: discovery descended into gitignored directories.
|
|
215
|
+
|
|
216
|
+
consumer-g's `artifacts/bamboobox-findings`, a vendored tree deliberately
|
|
217
|
+
excluded from its root quality scans, was reported as a checked workspace.
|
|
218
|
+
Candidate directories are now put to `git check-ignore` in one pass; a repo
|
|
219
|
+
without git excludes nothing, as before.
|
|
220
|
+
|
|
221
|
+
- feat: `--ignore-files <glob>`, repeatable, merged with the two built-in
|
|
222
|
+
exclusions.
|
|
223
|
+
|
|
224
|
+
For generated or vendored code a project already excludes elsewhere -- a
|
|
225
|
+
migrations directory is the standing case, and it is why consumer-y kept its
|
|
226
|
+
own runner. Not a way to hide `any`s: it adds to the built-in list and cannot
|
|
227
|
+
replace it.
|
|
228
|
+
|
|
229
|
+
## 0.9.0
|
|
230
|
+
|
|
231
|
+
### Minor Changes
|
|
232
|
+
|
|
233
|
+
- feat: `tanstack-start` knip preset.
|
|
234
|
+
|
|
235
|
+
TanStack Start has no `index.html` and no `src/main.tsx`: the router is the
|
|
236
|
+
root of the graph and the framework generates `routeTree.gen.ts` from
|
|
237
|
+
file-based routes. Adopting consumer-h under the `vite-react` preset left two
|
|
238
|
+
permanent "Refine entry pattern (no matches)" hints and reached the graph only
|
|
239
|
+
by accident.
|
|
240
|
+
|
|
241
|
+
## 0.8.1
|
|
242
|
+
|
|
243
|
+
### Patch Changes
|
|
244
|
+
|
|
245
|
+
- fix: `createKnipConfig` returns `KnipConfiguration`, not `KnipConfig`.
|
|
246
|
+
|
|
247
|
+
`KnipConfig` is a union that also admits a function, so a project spreading
|
|
248
|
+
the factory's result to override one rule got
|
|
249
|
+
`Property 'rules' does not exist on type 'RawConfigurationOrFn'` and had to
|
|
250
|
+
cast the value first. Consumer-s and consumer-m both hit it. Returning the
|
|
251
|
+
object shape makes extending the config the ordinary thing it looks like.
|
|
252
|
+
|
|
253
|
+
## 0.8.0
|
|
254
|
+
|
|
255
|
+
### Minor Changes
|
|
256
|
+
|
|
257
|
+
- feat: `createKnipConfig` accepts `project` and `entry` globs, merged with the
|
|
258
|
+
framework preset.
|
|
259
|
+
|
|
260
|
+
Every preset assumes the framework's own layout -- for Next.js, `src/` and
|
|
261
|
+
`app/`. consumer-m predates that convention: `actions/`, `components/`,
|
|
262
|
+
`hooks/`, `services/`, `types/` and six more sit at the repo root, so knip saw
|
|
263
|
+
only `app/` and reported 34 live dependencies as unused. The factory had no
|
|
264
|
+
override, so a repo in that shape could either delete the gate or carry a
|
|
265
|
+
permanent 34-line false report.
|
|
266
|
+
|
|
267
|
+
Both options merge rather than replace: a project can tell knip where its
|
|
268
|
+
extra code lives, but cannot silently stop it scanning the directories the
|
|
269
|
+
framework does own.
|
|
270
|
+
|
|
271
|
+
## 0.7.0
|
|
272
|
+
|
|
273
|
+
### Minor Changes
|
|
274
|
+
|
|
275
|
+
- feat: `baseline-type-coverage --at-least <n>` freezes a repo below the shared
|
|
276
|
+
threshold.
|
|
277
|
+
|
|
278
|
+
The bar is 99% and the runner had no way to say otherwise, so a codebase that
|
|
279
|
+
measures 96.93% could not wire this gate at all: the choice was an unenforced
|
|
280
|
+
gate or none. Found adopting consumer-k, whose 25 uncovered expressions sit
|
|
281
|
+
almost entirely in one database row mapper -- a real boundary, not sloppiness.
|
|
282
|
+
|
|
283
|
+
Freezing at the measured value makes coverage a ratchet: it cannot fall, and
|
|
284
|
+
the number in `package.json` is the debt, visible in every diff that changes
|
|
285
|
+
it. The flag refuses a value above the shared threshold, so it can only ever
|
|
286
|
+
lower the bar for a project that needs it, never restate or raise it.
|
|
287
|
+
|
|
288
|
+
## 0.6.1
|
|
289
|
+
|
|
290
|
+
### Patch Changes
|
|
291
|
+
|
|
292
|
+
- fix: `createKnipConfig` ignores every tool this package's runners spawn.
|
|
293
|
+
|
|
294
|
+
`baseline-dupes` spawns `jscpd`, `baseline-type-coverage` spawns
|
|
295
|
+
`type-coverage`, `baseline-deps-graph` spawns `depcruise` - all through
|
|
296
|
+
`pnpm exec`, so a project that wires the runner into its scripts never names
|
|
297
|
+
the underlying tool anywhere knip can see and knip reports a real dependency
|
|
298
|
+
as unused. Only `jscpd` was on the list; found in a consumer the moment its
|
|
299
|
+
`type-coverage` script became `baseline-type-coverage` and `pnpm knip` went
|
|
300
|
+
red on a dependency it uses on every run.
|
|
301
|
+
|
|
302
|
+
`dependency-cruiser` is included even though a project calling `depcruise`
|
|
303
|
+
directly resolves it fine: there knip emits a `Remove from ignoreDependencies`
|
|
304
|
+
hint, which is a hint and not a gate failure, and the cost of leaving it off
|
|
305
|
+
is a real dependency silently reported as dead.
|
|
306
|
+
|
|
307
|
+
## 0.6.0
|
|
308
|
+
|
|
309
|
+
### Minor Changes
|
|
310
|
+
|
|
311
|
+
- feat: `baseline-dupes --also-ignore` adds ignore patterns on top of the shared
|
|
312
|
+
list.
|
|
313
|
+
|
|
314
|
+
jscpd's own `--ignore` replaces the config's list rather than merging into it.
|
|
315
|
+
Measured on this repo: a config that also ignored `**/cargo-baseline/**`
|
|
316
|
+
scanned 61 files and found 1 clone; adding an unrelated `--ignore` took it to
|
|
317
|
+
109 files and 4 clones, the shared patterns gone.
|
|
318
|
+
|
|
319
|
+
That left a project with one generated directory to exclude - committed
|
|
320
|
+
Supabase types, a migrations folder, a cpanel build - restating every shared
|
|
321
|
+
pattern in its own `package.json`, which is the duplication this runner exists
|
|
322
|
+
to remove. Five of the nine repos surveyed carried exactly such an entry.
|
|
323
|
+
`--also-ignore` merges through a generated config that is deleted again on the
|
|
324
|
+
way out, and extends a caller-supplied `--config` when there is one.
|
|
325
|
+
|
|
326
|
+
### Patch Changes
|
|
327
|
+
|
|
328
|
+
- fix: `baseline-dupes` no longer mistakes a flag's value for a scan path.
|
|
329
|
+
|
|
330
|
+
It split arguments into paths and flags on a leading `-`, which cannot work:
|
|
331
|
+
`--min-tokens 120` and `--config x.json` carry a value that looks like
|
|
332
|
+
neither, so `120` was handed to jscpd as a directory to scan and a `--config`
|
|
333
|
+
value shifted the flag list, silently dropping the flag after it. Arguments
|
|
334
|
+
are now forwarded in the order given, untouched apart from `--also-ignore`;
|
|
335
|
+
the only argument the runner adds is `--config`, and only when the caller did
|
|
336
|
+
not pass one.
|
|
337
|
+
|
|
338
|
+
## 0.5.0
|
|
339
|
+
|
|
340
|
+
### Minor Changes
|
|
341
|
+
|
|
342
|
+
- feat: the jscpd gate ships from here, as `jscpd.json` plus a `baseline-dupes`
|
|
343
|
+
runner.
|
|
344
|
+
|
|
345
|
+
`.jscpd.json` was copied byte for byte into the repo root and all eight
|
|
346
|
+
templates, and every adopting project had to copy it again - the only quality
|
|
347
|
+
gate in the set that was hand-maintained duplication rather than shared
|
|
348
|
+
config. It is now one file in this package, read in place.
|
|
349
|
+
|
|
350
|
+
jscpd 5.x is a Rust binary that reads JSON only, with no JS config loader, so
|
|
351
|
+
this gate cannot be a factory the way `createKnipConfig` is. `baseline-dupes`
|
|
352
|
+
points jscpd at the packaged config and forwards any extra flag, which wins
|
|
353
|
+
over the file. The config is also resolvable directly, as
|
|
354
|
+
`@busirocket/quality-config/jscpd`.
|
|
355
|
+
|
|
356
|
+
`jscpd` stays a devDependency of the consuming project; the runner invokes it
|
|
357
|
+
rather than vendoring it.
|
|
358
|
+
|
|
359
|
+
- feat: `createKnipConfig` takes options instead of forcing every consumer to
|
|
360
|
+
restate the preset.
|
|
361
|
+
|
|
362
|
+
`ignoreBinaries`, `ignoreDependencies`, `ignore`, `includeEntryExports` and
|
|
363
|
+
`drizzle` are now settable. `ignoreDependencies` merges with the ESLint peer
|
|
364
|
+
list rather than replacing it, so a consumer whose layout hides a caller adds
|
|
365
|
+
one entry instead of copying the whole array.
|
|
366
|
+
|
|
367
|
+
The four cases that drove this, all found adopting the baseline in real repos:
|
|
368
|
+
|
|
369
|
+
- A **drizzle schema aggregator** reports every table as a dead export,
|
|
370
|
+
because `drizzle.config.ts` is the only consumer. Acting on that report
|
|
371
|
+
makes the next generated migration emit `DROP TABLE`. `ignore` excludes the
|
|
372
|
+
file.
|
|
373
|
+
- knip's **drizzle plugin loads `drizzle.config.ts`**, which throws by design
|
|
374
|
+
without `DATABASE_URL`, so the gate needed a live database in CI. Adding the
|
|
375
|
+
file to `ignore` does not stop the plugin; `drizzle: false` does.
|
|
376
|
+
- A **package that is finished but not wired up** reports its entire public
|
|
377
|
+
API as unused under `includeEntryExports: true`, and the obvious reading is
|
|
378
|
+
"delete this package". It can now be set per workspace.
|
|
379
|
+
- `ignoreBinaries` **no longer defaults to `['turbo', 'lhci']`**. Both resolve
|
|
380
|
+
in every template that has them, so the entries only ever produced a
|
|
381
|
+
`Remove from ignoreBinaries` hint a consumer could not silence.
|
|
382
|
+
|
|
383
|
+
- feat: ship the two runners consumers were copying by hand.
|
|
384
|
+
|
|
385
|
+
`baseline-type-coverage` runs `type-coverage --strict` in every workspace with
|
|
386
|
+
a `tsconfig.json`, reading the threshold from the package's own
|
|
387
|
+
`TYPE_COVERAGE_THRESHOLD` so the constant and the gate cannot drift. The
|
|
388
|
+
package exported that number and nothing else, so each consumer wrote its own
|
|
389
|
+
per-workspace loop.
|
|
390
|
+
|
|
391
|
+
`baseline-deps-graph` cruises each workspace with that workspace's own
|
|
392
|
+
tsconfig. A single repo-wide cruise takes one `tsConfig`, so in a monorepo it
|
|
393
|
+
resolves at most one `@/*` mapping and `no-orphans` then reports everything it
|
|
394
|
+
could not follow - which is why one adopter dropped dependency-cruiser
|
|
395
|
+
entirely.
|
|
396
|
+
|
|
397
|
+
### Patch Changes
|
|
398
|
+
|
|
399
|
+
- fix: drop `@vitest/eslint-plugin` and `eslint-plugin-testing-library` from the
|
|
400
|
+
shared `ignoreDependencies` list.
|
|
401
|
+
|
|
402
|
+
knip resolved the real caller for both in all eight templates, so the entries
|
|
403
|
+
were redundant everywhere while still printing a hint.
|
|
404
|
+
`eslint-config-prettier` and the rest stay: they are redundant in four of the
|
|
405
|
+
eight layouts and load-bearing in the other four, which is what the list is
|
|
406
|
+
for. Template hints went from 21 to 5.
|
|
407
|
+
|
|
408
|
+
## 0.4.0
|
|
409
|
+
|
|
410
|
+
### Minor Changes
|
|
411
|
+
|
|
412
|
+
- fix: complete the Next.js file conventions in both knip and
|
|
413
|
+
dependency-cruiser.
|
|
414
|
+
|
|
415
|
+
Adopting the standard in a real Next.js 16 project surfaced two presets that
|
|
416
|
+
had fallen behind the framework.
|
|
417
|
+
|
|
418
|
+
`createKnipConfig({ framework: 'nextjs' })` listed `middleware.ts`, which Next
|
|
419
|
+
16 renamed to `proxy.ts`. In a project that followed the rename, the proxy was
|
|
420
|
+
reachable from no entry point, so knip reported it and everything only it
|
|
421
|
+
imports as **unused files** while the pattern that no longer matched anything
|
|
422
|
+
produced a `Refine entry pattern (no matches)` hint. The entry now reads
|
|
423
|
+
`{,src/}{middleware,proxy}.ts` - one pattern, because a project has one file
|
|
424
|
+
or the other - and the App Router metadata routes (`sitemap`, `robots`,
|
|
425
|
+
`manifest`, `icon`, `apple-icon`, `opengraph-image`, `twitter-image`) plus
|
|
426
|
+
`global-error` join the existing brace alternation for the same reason.
|
|
427
|
+
|
|
428
|
+
`createDepCruiserConfig`'s `no-orphans` exemptions covered `sitemap` and
|
|
429
|
+
`robots` and nothing else of the App Router, so a normal project reported one
|
|
430
|
+
orphan error per route file. Every convention is exempt now, at any depth
|
|
431
|
+
below `app/`, and so is `middleware`/`proxy`.
|
|
432
|
+
|
|
433
|
+
The exemptions are written as two patterns - a direct-child form and a nested
|
|
434
|
+
`.*/` form - rather than one with an optional `(.*/)?` directory group,
|
|
435
|
+
because dependency-cruiser runs every `pathNot` entry through safe-regex and
|
|
436
|
+
**abandons the entire rule** when one is rejected, rather than skipping that
|
|
437
|
+
pattern. A nested quantifier there does not narrow the orphan check, it turns
|
|
438
|
+
it off. That trap is now documented in the factory and in
|
|
439
|
+
`docs/standards/quality-gates.md`.
|
|
440
|
+
|
|
441
|
+
A Next.js consumer on 0.3.0 that had patched around either gap can delete
|
|
442
|
+
those local patches; a consumer that had not will see false findings
|
|
443
|
+
disappear, so this is a behavior change rather than a patch.
|
|
444
|
+
|
|
445
|
+
## 0.3.0
|
|
446
|
+
|
|
447
|
+
### Minor Changes
|
|
448
|
+
|
|
449
|
+
- fix: cover the `src/app` layout in the knip Next.js preset. (`361dbf3`)
|
|
450
|
+
|
|
451
|
+
`createKnipConfig({ framework: 'nextjs' })` rooted its entry globs at `app/`,
|
|
452
|
+
so a project using `src/app/` matched none of them. The consequence is not a
|
|
453
|
+
quiet pass: with no entry matching, knip reports the application's own route
|
|
454
|
+
files as **unused files** and never checks their exports.
|
|
455
|
+
|
|
456
|
+
The globs now carry both roots in one pattern
|
|
457
|
+
(`{,src/}app/**/{page,layout,...}.{ts,tsx}`, `{,src/}middleware.ts`), which
|
|
458
|
+
also means neither layout produces a `Refine entry pattern (no matches)` hint.
|
|
459
|
+
`next.config.*` stays root-only, where Next.js requires it.
|
|
460
|
+
|
|
461
|
+
A `src/app` project on 0.2.0 that adopts this will see its knip output
|
|
462
|
+
change - the false "unused files" disappear and real dead exports start
|
|
463
|
+
failing the gate - so this is a behavior change, not a patch.
|
|
464
|
+
|
|
465
|
+
## 0.2.0
|
|
466
|
+
|
|
467
|
+
### Minor Changes
|
|
468
|
+
|
|
469
|
+
- feat: check entry-file exports in `createKnipConfig`.
|
|
470
|
+
|
|
471
|
+
The generated config now sets `includeEntryExports: true`, so a dead export
|
|
472
|
+
added to a project's entry file (`src/main.ts`, `src/index.ts`) fails the gate
|
|
473
|
+
instead of passing silently. It also sets `ignoreExportsUsedInFile: true`,
|
|
474
|
+
which is the pairing the Primary Unit Rule requires: a top-level declaration
|
|
475
|
+
may not be hidden, so an entry-point helper a file uses only itself still has
|
|
476
|
+
to be exported. An export nothing references at all still fails.
|
|
477
|
+
|
|
478
|
+
A project on 0.1.0 that adopts this may start failing `knip` - that is the
|
|
479
|
+
ratchet working, but it is a behavior change, not a patch.
|
|
480
|
+
|
|
481
|
+
Coverage is real but partial: it does not reach files a knip framework plugin
|
|
482
|
+
registers as an entry of its own (a Next.js `page.tsx`, a Vite `main.tsx`
|
|
483
|
+
loaded from `index.html`).
|
|
484
|
+
|
|
485
|
+
- feat: drop `src/app/index.ts` from the `vite-vue` entry list.
|
|
486
|
+
|
|
487
|
+
It was there to work around knip not resolving a path-aliased bare `@/app` to
|
|
488
|
+
the directory's `index.ts`. A Vue project should import its composition root
|
|
489
|
+
as `@/app/index` explicitly instead; the extra entry made knip refuse to count
|
|
490
|
+
the entry-to-entry import as usage.
|
|
491
|
+
|
|
492
|
+
## 0.1.0
|
|
493
|
+
|
|
494
|
+
### Minor Changes
|
|
495
|
+
|
|
496
|
+
- feat: initial release. Shared configuration factories for the cross-file
|
|
497
|
+
quality gates, plus one executable.
|
|
498
|
+
|
|
499
|
+
- `createKnipConfig` (`/knip`) - unused files, exports and dependencies, with
|
|
500
|
+
per-framework entry globs.
|
|
501
|
+
- `createDepCruiserConfig` (`/dependency-cruiser`) - import cycles, orphan
|
|
502
|
+
modules, package/template boundary, devDependency-in-production, and
|
|
503
|
+
deprecated Node core modules. Takes `scope` (`'repo'` for the whole graph,
|
|
504
|
+
`'workspace'` for a single-workspace orphan check), `tsConfigPath`, and
|
|
505
|
+
`orphanExemptions` for project-specific exemptions. The factory itself
|
|
506
|
+
encodes no directory name belonging to any particular repository.
|
|
507
|
+
- `TYPE_COVERAGE_THRESHOLD` (`/type-coverage`) - minimum non-`any` coverage.
|
|
508
|
+
- `createLefthookConfig` (`/lefthook`) - shared git hook pipeline.
|
|
509
|
+
- `baseline-env-init` - seeds a gitignored `.env` from the committed
|
|
510
|
+
`.env.example`, so a freshly cloned project boots on the documented example
|
|
511
|
+
values rather than failing its startup env validation. Bundlers inline
|
|
512
|
+
`VITE_*`/`NEXT_PUBLIC_*` at build time, so without it a project with no
|
|
513
|
+
`.env` builds a bundle that throws before it renders and shows a blank page
|
|
514
|
+
rather than a useful error. Idempotent, and a no-op without an
|
|
515
|
+
`.env.example`.
|
|
516
|
+
|
|
517
|
+
Every export resolves to TypeScript source; consumers load it with ESM and a
|
|
518
|
+
TypeScript-aware runner such as `jiti`. `knip` and `dependency-cruiser` are
|
|
519
|
+
optional peers, needed only for the gates you actually use.
|
package/PUBLIC_API.md
CHANGED
|
@@ -14,6 +14,14 @@ are **private** and may change without a major bump.
|
|
|
14
14
|
| `@syntopica/quality-config/lefthook` | `createLefthookConfig` — shared git hook pipeline |
|
|
15
15
|
| `@syntopica/quality-config/jscpd` | `jscpd.json` — cross-file duplication gate config |
|
|
16
16
|
|
|
17
|
+
### `createLefthookConfig(options)`
|
|
18
|
+
|
|
19
|
+
`options.tadu` (default `false`) is for a repository that keeps a tadu backlog.
|
|
20
|
+
The lint and format commands then exclude `todo/**`, `TODO.md`, `TODO_LOG.md`
|
|
21
|
+
and `TODO_HISTORY_INDEX.jsonl`, and a `backlog` command runs `tadu doctor .` on
|
|
22
|
+
those paths, skipped when `tadu` is not installed. Without it the output is
|
|
23
|
+
unchanged.
|
|
24
|
+
|
|
17
25
|
### `createDepCruiserConfig(options)`
|
|
18
26
|
|
|
19
27
|
Every option is optional and every default is project-agnostic: the factory
|
|
@@ -97,3 +105,28 @@ not resolution bugs:
|
|
|
97
105
|
`attw`'s sandbox only contains this package's own tarball, so it cannot see
|
|
98
106
|
peers a real consumer installs, and flags those imports as unresolved. This is
|
|
99
107
|
the intended shape of an optional peer, not a broken `exports` entry.
|
|
108
|
+
|
|
109
|
+
## Canonical dependency-cruiser TypeScript configuration
|
|
110
|
+
|
|
111
|
+
`@syntopica/quality-config/cruise-tsconfig` exports
|
|
112
|
+
`withCruiseTsconfig(configPath, operation, { requirePaths = false })`. It
|
|
113
|
+
synchronously invokes `operation` with an absolute tsconfig filename and returns
|
|
114
|
+
the operation's result. Promise-like results are rejected. The original
|
|
115
|
+
configuration and default input location are unchanged, and an exclusively
|
|
116
|
+
created temporary file beside the original configuration is removed even if the
|
|
117
|
+
operation fails.
|
|
118
|
+
|
|
119
|
+
The existing required TypeScript peer reads JSONC and inherited configuration.
|
|
120
|
+
Alias targets become absolute using the effective baseUrl, or the compiler's
|
|
121
|
+
declaring-config origin when baseUrl is absent. The effective baseUrl is
|
|
122
|
+
preserved. The latter origin uses checked internal `pathsBasePath` metadata:
|
|
123
|
+
compiler versions without an absolute origin fail explicitly, with no CWD
|
|
124
|
+
fallback. This does not establish compatibility with every version admitted by
|
|
125
|
+
the existing peer range. No-paths configurations use their original filename
|
|
126
|
+
unless `requirePaths` is true.
|
|
127
|
+
|
|
128
|
+
`baseline-deps-graph --cwd-only app` selects only the invoking project's app
|
|
129
|
+
directory. Without `--cwd-only`, existing recursive workspace discovery is
|
|
130
|
+
preserved for both explicit and default source arguments. In cwd-only mode,
|
|
131
|
+
every explicit source must exist or the command fails. Generated projects use
|
|
132
|
+
the published runtime and never import the monorepo root runner.
|
package/README.md
CHANGED
|
@@ -136,6 +136,31 @@ the same file through `@syntopica/quality-config/jscpd`.
|
|
|
136
136
|
`jscpd` itself stays a devDependency of the consuming project: the runner
|
|
137
137
|
invokes it, it does not vendor it.
|
|
138
138
|
|
|
139
|
+
### `baseline-changes`
|
|
140
|
+
|
|
141
|
+
Installed copies of these packages carry their `CHANGELOG.md`, and pnpm 10+ does
|
|
142
|
+
not run dependency lifecycle scripts, so a package cannot announce its own
|
|
143
|
+
upgrade. `baseline-changes` runs from the project's gate instead: it compares
|
|
144
|
+
the installed versions with `.baseline-versions.json`, prints the changelog
|
|
145
|
+
sections of every release in between with each `### Action required` subsection
|
|
146
|
+
first, then records the installed versions. The notice appears once, in the
|
|
147
|
+
first run after the upgrade. It always exits 0 and never writes under `CI` or
|
|
148
|
+
with `--no-write`. Commit `.baseline-versions.json`.
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"scripts": {
|
|
153
|
+
"changes": "baseline-changes",
|
|
154
|
+
"check:ci": "pnpm changes && ..."
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
A release that needs the consumer to do something (a breaking change, a new
|
|
160
|
+
config file, a migration) says so under `### Action required` in its changelog
|
|
161
|
+
section. The same file also records `syntopica-codeality-py` and
|
|
162
|
+
`cargo-baseline` versions, written by those tools.
|
|
163
|
+
|
|
139
164
|
## Related
|
|
140
165
|
|
|
141
166
|
- **Lint / TS configs:** `@syntopica/eslint-config`, `@syntopica/tsconfig`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const AUDIT_LEVELS = ['info', 'low', 'moderate', 'high', 'critical']
|