@syntopica/quality-config 0.11.1 → 0.12.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/PUBLIC_API.md +3 -3
- package/README.md +1 -1
- package/bin/baseline-type-coverage.mjs +18 -9
- package/package.json +4 -4
- package/src/knip.ts +1 -1
package/PUBLIC_API.md
CHANGED
|
@@ -56,9 +56,9 @@ file plus a runner rather than as a factory: the config is read in place, never
|
|
|
56
56
|
copied into the consuming repo.
|
|
57
57
|
|
|
58
58
|
`baseline-type-coverage` takes the directories to search and `--at-least <n>`, a
|
|
59
|
-
repo-local
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
repo-local bar: below the shared threshold for a project still climbing toward
|
|
60
|
+
it, above it to pin a project that has passed it (up to 100). It refuses a value
|
|
61
|
+
equal to the shared threshold, which would only restate it.
|
|
62
62
|
|
|
63
63
|
`--also-ignore <patterns>` adds ignore patterns **on top of** the shared list.
|
|
64
64
|
jscpd's own `--ignore` replaces that list instead, so without this a project
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ files/exports/dependencies (knip), module boundaries and dependency cycles
|
|
|
7
7
|
|
|
8
8
|
- **Public API (semver):** see [PUBLIC_API.md](./PUBLIC_API.md).
|
|
9
9
|
- **Platform decisions:**
|
|
10
|
-
[engineering-baseline/docs/platform-decisions.md](https://github.com/
|
|
10
|
+
[engineering-baseline/docs/platform-decisions.md](https://github.com/syntopica/codeality/blob/main/docs/platform-decisions.md).
|
|
11
11
|
|
|
12
12
|
## Requirements
|
|
13
13
|
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
// to `any` is the point. `--strict` is on, so an `any` reached through a
|
|
13
13
|
// generic argument counts as uncovered.
|
|
14
14
|
//
|
|
15
|
-
// `--at-least <n>`
|
|
16
|
-
//
|
|
17
|
-
// so the choice is an unenforced gate or none. Freezing at the
|
|
18
|
-
// makes coverage a ratchet - it cannot fall - and the number in
|
|
19
|
-
// is the debt, visible in every diff that changes it. Raise it as
|
|
20
|
-
// go; never lower it to get green.
|
|
15
|
+
// `--at-least <n>` sets the bar for one repo. Below the shared threshold it
|
|
16
|
+
// exists for adoption: a codebase under it cannot wire this gate at all
|
|
17
|
+
// otherwise, so the choice is an unenforced gate or none. Freezing at the
|
|
18
|
+
// measured value makes coverage a ratchet - it cannot fall - and the number in
|
|
19
|
+
// package.json is the debt, visible in every diff that changes it. Raise it as
|
|
20
|
+
// the `any`s go; never lower it to get green. Above the shared threshold it
|
|
21
|
+
// pins a repo that has already climbed past it (to 100, say), so its coverage
|
|
22
|
+
// cannot slide back to the shared floor unnoticed.
|
|
21
23
|
//
|
|
22
24
|
// `--ignore-files <glob>` adds to the two exclusions above. Repeatable. It is
|
|
23
25
|
// for generated or vendored code the project already excludes elsewhere -
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
// baseline-type-coverage # every workspace under the cwd
|
|
28
30
|
// baseline-type-coverage packages apps # only under these directories
|
|
29
31
|
// baseline-type-coverage --at-least 97 # freeze below the shared bar
|
|
32
|
+
// baseline-type-coverage --at-least 100 # pin above it
|
|
30
33
|
// baseline-type-coverage --ignore-files 'migrations/**'
|
|
31
34
|
import { spawnSync } from 'node:child_process'
|
|
32
35
|
import { existsSync, readdirSync, readFileSync } from 'node:fs'
|
|
@@ -74,10 +77,16 @@ if (atLeastIndex !== -1 && !/^\d+(?:\.\d+)?$/.test(override ?? '')) {
|
|
|
74
77
|
)
|
|
75
78
|
exit(1)
|
|
76
79
|
}
|
|
77
|
-
if (override !== undefined && Number(override) >
|
|
80
|
+
if (override !== undefined && Number(override) > 100) {
|
|
78
81
|
console.error(
|
|
79
|
-
`baseline-type-coverage: --at-least ${override} is above
|
|
80
|
-
|
|
82
|
+
`baseline-type-coverage: --at-least ${override} is above 100 percent.`,
|
|
83
|
+
)
|
|
84
|
+
exit(1)
|
|
85
|
+
}
|
|
86
|
+
if (override !== undefined && Number(override) === Number(declared[1])) {
|
|
87
|
+
console.error(
|
|
88
|
+
`baseline-type-coverage: --at-least ${override} restates the shared ` +
|
|
89
|
+
`threshold. Drop the flag.`,
|
|
81
90
|
)
|
|
82
91
|
exit(1)
|
|
83
92
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syntopica/quality-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Shared configuration for cross-file quality gates: knip, dependency-cruiser, type-coverage, jscpd, lefthook",
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
75
75
|
"@syntopica/eslint-config": "0.8.0",
|
|
76
|
-
"@types/node": "^26.6.
|
|
77
|
-
"dependency-cruiser": "^18.
|
|
76
|
+
"@types/node": "^26.6.3",
|
|
77
|
+
"dependency-cruiser": "^18.5.0",
|
|
78
78
|
"eslint": "^10.11.0",
|
|
79
79
|
"eslint-plugin-regexp": "^3.3.1",
|
|
80
|
-
"knip": "^6.
|
|
80
|
+
"knip": "^6.39.0",
|
|
81
81
|
"publint": "^0.3.24",
|
|
82
82
|
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
|
83
83
|
},
|
package/src/knip.ts
CHANGED
|
@@ -35,7 +35,7 @@ import { FRAMEWORK_ENTRIES, type KnipFramework } from './knip-framework'
|
|
|
35
35
|
// `type-coverage`, `baseline-deps-graph` spawns `depcruise`. A project that
|
|
36
36
|
// wires the runner into its scripts never names the underlying tool anywhere
|
|
37
37
|
// knip can see, so knip reports a real dependency as unused. Found in
|
|
38
|
-
//
|
|
38
|
+
// a consumer the moment its `type-coverage` script became
|
|
39
39
|
// `baseline-type-coverage`.
|
|
40
40
|
//
|
|
41
41
|
// `dependency-cruiser` is on the list even though a project calling
|