@nodeve/checks 0.5.0 → 1.0.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/README.md +1 -1
- package/dist/lib/config.d.ts +2 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +6 -40
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/defaults.d.ts +62 -0
- package/dist/lib/defaults.d.ts.map +1 -0
- package/dist/lib/defaults.js +57 -0
- package/dist/lib/defaults.js.map +1 -0
- package/nodeve.checks.defaults.js +57 -0
- package/package.json +7 -3
- package/nodeve.checks.example.js +0 -50
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Then activate hooks once per clone with `lefthook install` (familiar/nodeve do t
|
|
|
19
19
|
|
|
20
20
|
## Configure
|
|
21
21
|
|
|
22
|
-
Copy `node_modules/@nodeve/checks/nodeve.checks.
|
|
22
|
+
Copy `node_modules/@nodeve/checks/nodeve.checks.defaults.js` to your repo root as `nodeve.checks.js` and keep ONLY the keys you change. That file is the org defaults verbatim — a valid `nodeve.checks.js` in the exact shape your config takes — so it doubles as the reference for every section and its default value. Omitted keys fall back to those defaults (deep-merged; arrays replace wholesale). It's importable too: `import DEFAULTS from '@nodeve/checks/defaults'`.
|
|
23
23
|
|
|
24
24
|
## Checks
|
|
25
25
|
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import DEFAULTS from './defaults.js';
|
|
1
2
|
export type Budget = {
|
|
2
3
|
maxLines: number;
|
|
3
4
|
maxTokens: number;
|
|
@@ -95,7 +96,7 @@ export type Config = {
|
|
|
95
96
|
requireDeps: RequireDepsConfig;
|
|
96
97
|
helperManifest: HelperManifestConfig;
|
|
97
98
|
};
|
|
98
|
-
export
|
|
99
|
+
export { DEFAULTS };
|
|
99
100
|
/**
|
|
100
101
|
* Load `nodeve.checks.*` from the repo root, deep-merging the user config over
|
|
101
102
|
* DEFAULTS. Nested records (e.g. `docTokens.overrides`) merge key-by-key; arrays
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"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"}
|
package/dist/lib/config.js
CHANGED
|
@@ -14,46 +14,12 @@ import { existsSync } from 'node:fs';
|
|
|
14
14
|
import { join } from 'node:path';
|
|
15
15
|
import { pathToFileURL } from 'node:url';
|
|
16
16
|
import { mergeDeep } from 'remeda';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
reshape: {
|
|
25
|
-
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
26
|
-
allowlist: [],
|
|
27
|
-
},
|
|
28
|
-
inlineDupes: {
|
|
29
|
-
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
30
|
-
allowlist: [],
|
|
31
|
-
},
|
|
32
|
-
helperCollisions: {
|
|
33
|
-
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
34
|
-
libs: ['remeda'],
|
|
35
|
-
libNamesPath: '.nodeve/lib-names.json',
|
|
36
|
-
threshold: 0.8,
|
|
37
|
-
allowlist: [],
|
|
38
|
-
},
|
|
39
|
-
// On by default: SvelteKit pages over 280 lines should rip inline components
|
|
40
|
-
// out into their own files. The `*+page.svelte` glob is a no-op in repos with
|
|
41
|
-
// no SvelteKit pages, so this stays harmless org-wide. Override per repo.
|
|
42
|
-
pageSize: { rules: [{ glob: '*+page.svelte', maxLines: 280 }] },
|
|
43
|
-
// On by default: warn past 225 lines, block past 300 (override per repo).
|
|
44
|
-
fileSize: {
|
|
45
|
-
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
46
|
-
warnLines: 225,
|
|
47
|
-
maxLines: 300,
|
|
48
|
-
allowlist: [],
|
|
49
|
-
},
|
|
50
|
-
// On by default: a workspace must declare a catalog (set enforce:false to opt out).
|
|
51
|
-
catalog: { enforce: true, allowlist: [] },
|
|
52
|
-
// On by default: the workspace catalog must define remeda (set deps:[] to opt out).
|
|
53
|
-
requireDeps: { deps: ['remeda'] },
|
|
54
|
-
// Opt-in: no packages → no-op.
|
|
55
|
-
helperManifest: { packages: [], output: '.nodeve/helper-manifest.txt' },
|
|
56
|
-
};
|
|
17
|
+
import DEFAULTS from './defaults.js';
|
|
18
|
+
// The authoritative defaults live in `./defaults.ts`, which is itself a valid
|
|
19
|
+
// `nodeve.checks.js` (a bare `export default {...}`) so it doubles as the copyable
|
|
20
|
+
// reference shipped to consumers. Re-exported here to keep the `@nodeve/checks/config`
|
|
21
|
+
// public surface intact.
|
|
22
|
+
export { DEFAULTS };
|
|
57
23
|
const CONFIG_FILES = ['nodeve.checks.js', 'nodeve.checks.mjs', 'nodeve.checks.config.js'];
|
|
58
24
|
/**
|
|
59
25
|
* Load `nodeve.checks.*` from the repo root, deep-merging the user config over
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,QAAQ,MAAM,eAAe,CAAC;AAwGrC,8EAA8E;AAC9E,mFAAmF;AACnF,uFAAuF;AACvF,yBAAyB;AACzB,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,MAAM,YAAY,GAAG,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;AAI1F;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC5C,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAS;QAChC,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAsC,CAAC;QAC1F,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,IAAK,GAA2B,CAAC;QACzD,OAAO,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAW,CAAC;IAC5C,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,SAAS,CAAC,IAAc;IAMvC,OAAO;QACN,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;QACjC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;KACnC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The org defaults for @nodeve/checks — the single source of truth.
|
|
3
|
+
*
|
|
4
|
+
* This file IS a valid `nodeve.checks.js`: it's the exact shape a repo drops at
|
|
5
|
+
* its root, default-exporting the config object. To customize, copy it (shipped
|
|
6
|
+
* as `node_modules/@nodeve/checks/nodeve.checks.defaults.js`) to your repo root
|
|
7
|
+
* as `nodeve.checks.js` and keep ONLY the keys you change — everything you omit
|
|
8
|
+
* falls back to the value here.
|
|
9
|
+
*
|
|
10
|
+
* Merge semantics (see `loadConfig`): your config is deep-merged OVER these
|
|
11
|
+
* defaults. Nested records merge key-by-key, but ARRAYS REPLACE wholesale — so
|
|
12
|
+
* if you set an array field (e.g. `docTokens.enforce`) you must restate every
|
|
13
|
+
* entry you want to keep, not just the ones you're adding.
|
|
14
|
+
*/
|
|
15
|
+
declare const _default: {
|
|
16
|
+
docTokens: {
|
|
17
|
+
maxLines: number;
|
|
18
|
+
maxTokens: number;
|
|
19
|
+
enforce: string[];
|
|
20
|
+
overrides: {};
|
|
21
|
+
};
|
|
22
|
+
reshape: {
|
|
23
|
+
globs: string[];
|
|
24
|
+
allowlist: never[];
|
|
25
|
+
};
|
|
26
|
+
inlineDupes: {
|
|
27
|
+
globs: string[];
|
|
28
|
+
allowlist: never[];
|
|
29
|
+
};
|
|
30
|
+
helperCollisions: {
|
|
31
|
+
globs: string[];
|
|
32
|
+
libs: string[];
|
|
33
|
+
libNamesPath: string;
|
|
34
|
+
threshold: number;
|
|
35
|
+
allowlist: never[];
|
|
36
|
+
};
|
|
37
|
+
pageSize: {
|
|
38
|
+
rules: {
|
|
39
|
+
glob: string;
|
|
40
|
+
maxLines: number;
|
|
41
|
+
}[];
|
|
42
|
+
};
|
|
43
|
+
fileSize: {
|
|
44
|
+
globs: string[];
|
|
45
|
+
warnLines: number;
|
|
46
|
+
maxLines: number;
|
|
47
|
+
allowlist: never[];
|
|
48
|
+
};
|
|
49
|
+
catalog: {
|
|
50
|
+
enforce: true;
|
|
51
|
+
allowlist: never[];
|
|
52
|
+
};
|
|
53
|
+
requireDeps: {
|
|
54
|
+
deps: string[];
|
|
55
|
+
};
|
|
56
|
+
helperManifest: {
|
|
57
|
+
packages: never[];
|
|
58
|
+
output: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export default _default;
|
|
62
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/lib/defaults.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBAyCmB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The org defaults for @nodeve/checks — the single source of truth.
|
|
3
|
+
*
|
|
4
|
+
* This file IS a valid `nodeve.checks.js`: it's the exact shape a repo drops at
|
|
5
|
+
* its root, default-exporting the config object. To customize, copy it (shipped
|
|
6
|
+
* as `node_modules/@nodeve/checks/nodeve.checks.defaults.js`) to your repo root
|
|
7
|
+
* as `nodeve.checks.js` and keep ONLY the keys you change — everything you omit
|
|
8
|
+
* falls back to the value here.
|
|
9
|
+
*
|
|
10
|
+
* Merge semantics (see `loadConfig`): your config is deep-merged OVER these
|
|
11
|
+
* defaults. Nested records merge key-by-key, but ARRAYS REPLACE wholesale — so
|
|
12
|
+
* if you set an array field (e.g. `docTokens.enforce`) you must restate every
|
|
13
|
+
* entry you want to keep, not just the ones you're adding.
|
|
14
|
+
*/
|
|
15
|
+
export default {
|
|
16
|
+
docTokens: {
|
|
17
|
+
maxLines: 150,
|
|
18
|
+
maxTokens: 3000,
|
|
19
|
+
// Git pathspecs the gate FAILS on: CLAUDE.md + READMEs + guide/ + docs/.
|
|
20
|
+
enforce: ['CLAUDE.md', 'README.md', '*/README.md', 'guide/*.md', 'docs/*.md'],
|
|
21
|
+
// Per-file budget bumps, keyed by repo-root-relative path.
|
|
22
|
+
overrides: {},
|
|
23
|
+
},
|
|
24
|
+
reshape: {
|
|
25
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
26
|
+
allowlist: [],
|
|
27
|
+
},
|
|
28
|
+
inlineDupes: {
|
|
29
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
30
|
+
allowlist: [],
|
|
31
|
+
},
|
|
32
|
+
helperCollisions: {
|
|
33
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
34
|
+
libs: ['remeda'],
|
|
35
|
+
libNamesPath: '.nodeve/lib-names.json',
|
|
36
|
+
threshold: 0.8,
|
|
37
|
+
allowlist: [],
|
|
38
|
+
},
|
|
39
|
+
// On by default: SvelteKit pages over 280 lines should rip inline components
|
|
40
|
+
// out into their own files. The `*+page.svelte` glob is a no-op in repos with
|
|
41
|
+
// no SvelteKit pages, so this stays harmless org-wide. Override per repo.
|
|
42
|
+
pageSize: { rules: [{ glob: '*+page.svelte', maxLines: 280 }] },
|
|
43
|
+
// On by default: warn past 225 lines, block past 300 (override per repo).
|
|
44
|
+
fileSize: {
|
|
45
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
46
|
+
warnLines: 225,
|
|
47
|
+
maxLines: 300,
|
|
48
|
+
allowlist: [],
|
|
49
|
+
},
|
|
50
|
+
// On by default: a workspace must declare a catalog (set enforce:false to opt out).
|
|
51
|
+
catalog: { enforce: true, allowlist: [] },
|
|
52
|
+
// On by default: the workspace catalog must define remeda (set deps:[] to opt out).
|
|
53
|
+
requireDeps: { deps: ['remeda'] },
|
|
54
|
+
// Opt-in: no packages → no-op.
|
|
55
|
+
helperManifest: { packages: [], output: '.nodeve/helper-manifest.txt' },
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/lib/defaults.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAe;IACd,SAAS,EAAE;QACV,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,IAAI;QACf,yEAAyE;QACzE,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,CAAC;QAC7E,2DAA2D;QAC3D,SAAS,EAAE,EAAE;KACb;IACD,OAAO,EAAE;QACR,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;QACrC,SAAS,EAAE,EAAE;KACb;IACD,WAAW,EAAE;QACZ,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;QACrC,SAAS,EAAE,EAAE;KACb;IACD,gBAAgB,EAAE;QACjB,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;QACrC,IAAI,EAAE,CAAC,QAAQ,CAAC;QAChB,YAAY,EAAE,wBAAwB;QACtC,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,EAAE;KACb;IACD,6EAA6E;IAC7E,8EAA8E;IAC9E,0EAA0E;IAC1E,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE;IAC/D,0EAA0E;IAC1E,QAAQ,EAAE;QACT,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;QACrC,SAAS,EAAE,GAAG;QACd,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,EAAE;KACb;IACD,oFAAoF;IACpF,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE;IACzC,oFAAoF;IACpF,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;IACjC,+BAA+B;IAC/B,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,6BAA6B,EAAE;CACtD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The org defaults for @nodeve/checks — the single source of truth.
|
|
3
|
+
*
|
|
4
|
+
* This file IS a valid `nodeve.checks.js`: it's the exact shape a repo drops at
|
|
5
|
+
* its root, default-exporting the config object. To customize, copy it (shipped
|
|
6
|
+
* as `node_modules/@nodeve/checks/nodeve.checks.defaults.js`) to your repo root
|
|
7
|
+
* as `nodeve.checks.js` and keep ONLY the keys you change — everything you omit
|
|
8
|
+
* falls back to the value here.
|
|
9
|
+
*
|
|
10
|
+
* Merge semantics (see `loadConfig`): your config is deep-merged OVER these
|
|
11
|
+
* defaults. Nested records merge key-by-key, but ARRAYS REPLACE wholesale — so
|
|
12
|
+
* if you set an array field (e.g. `docTokens.enforce`) you must restate every
|
|
13
|
+
* entry you want to keep, not just the ones you're adding.
|
|
14
|
+
*/
|
|
15
|
+
export default {
|
|
16
|
+
docTokens: {
|
|
17
|
+
maxLines: 150,
|
|
18
|
+
maxTokens: 3000,
|
|
19
|
+
// Git pathspecs the gate FAILS on: CLAUDE.md + READMEs + guide/ + docs/.
|
|
20
|
+
enforce: ['CLAUDE.md', 'README.md', '*/README.md', 'guide/*.md', 'docs/*.md'],
|
|
21
|
+
// Per-file budget bumps, keyed by repo-root-relative path.
|
|
22
|
+
overrides: {},
|
|
23
|
+
},
|
|
24
|
+
reshape: {
|
|
25
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
26
|
+
allowlist: [],
|
|
27
|
+
},
|
|
28
|
+
inlineDupes: {
|
|
29
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
30
|
+
allowlist: [],
|
|
31
|
+
},
|
|
32
|
+
helperCollisions: {
|
|
33
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
34
|
+
libs: ['remeda'],
|
|
35
|
+
libNamesPath: '.nodeve/lib-names.json',
|
|
36
|
+
threshold: 0.8,
|
|
37
|
+
allowlist: [],
|
|
38
|
+
},
|
|
39
|
+
// On by default: SvelteKit pages over 280 lines should rip inline components
|
|
40
|
+
// out into their own files. The `*+page.svelte` glob is a no-op in repos with
|
|
41
|
+
// no SvelteKit pages, so this stays harmless org-wide. Override per repo.
|
|
42
|
+
pageSize: { rules: [{ glob: '*+page.svelte', maxLines: 280 }] },
|
|
43
|
+
// On by default: warn past 225 lines, block past 300 (override per repo).
|
|
44
|
+
fileSize: {
|
|
45
|
+
globs: ['apps/*.ts', 'packages/*.ts'],
|
|
46
|
+
warnLines: 225,
|
|
47
|
+
maxLines: 300,
|
|
48
|
+
allowlist: [],
|
|
49
|
+
},
|
|
50
|
+
// On by default: a workspace must declare a catalog (set enforce:false to opt out).
|
|
51
|
+
catalog: { enforce: true, allowlist: [] },
|
|
52
|
+
// On by default: the workspace catalog must define remeda (set deps:[] to opt out).
|
|
53
|
+
requireDeps: { deps: ['remeda'] },
|
|
54
|
+
// Opt-in: no packages → no-op.
|
|
55
|
+
helperManifest: { packages: [], output: '.nodeve/helper-manifest.txt' },
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=defaults.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeve/checks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Org-wide commit-gate checks (doc budgets, reshape/dup/helper smells, page size) and helper-index generators, driven by a per-repo config file and wired through lefthook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"lefthook.checks.yml",
|
|
18
|
-
"nodeve.checks.
|
|
18
|
+
"nodeve.checks.defaults.js"
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
21
|
"./config": {
|
|
22
22
|
"types": "./dist/lib/config.d.ts",
|
|
23
23
|
"default": "./dist/lib/config.js"
|
|
24
24
|
},
|
|
25
|
+
"./defaults": {
|
|
26
|
+
"types": "./dist/lib/defaults.d.ts",
|
|
27
|
+
"default": "./dist/lib/defaults.js"
|
|
28
|
+
},
|
|
25
29
|
"./lefthook": "./lefthook.checks.yml"
|
|
26
30
|
},
|
|
27
31
|
"bin": {
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
"@nodeve/config": "0.1.0"
|
|
51
55
|
},
|
|
52
56
|
"scripts": {
|
|
53
|
-
"build": "tsc -p tsconfig.json",
|
|
57
|
+
"build": "tsc -p tsconfig.json && cp dist/lib/defaults.js nodeve.checks.defaults.js",
|
|
54
58
|
"clean": "rm -rf dist",
|
|
55
59
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
56
60
|
}
|
package/nodeve.checks.example.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Copy to your repo root as `nodeve.checks.js` and keep ONLY what you change.
|
|
2
|
-
// Every section is optional; omitted keys fall back to the org defaults baked
|
|
3
|
-
// into @nodeve/checks (see the `Config` type / `DEFAULTS` in the package for the
|
|
4
|
-
// authoritative values). The user config is deep-merged over those defaults:
|
|
5
|
-
// nested records merge key-by-key, but ARRAYS REPLACE — so if you set an array
|
|
6
|
-
// field (e.g. `docTokens.enforce`) you must restate the entries you want to keep,
|
|
7
|
-
// not just the ones you're adding.
|
|
8
|
-
//
|
|
9
|
-
// The blocks below are illustrative overrides, not the defaults. Delete any you
|
|
10
|
-
// don't need.
|
|
11
|
-
export default {
|
|
12
|
-
// Widen the enforced doc set (this array REPLACES the default list — the
|
|
13
|
-
// default is CLAUDE.md + READMEs + guide/ + docs/, restated here plus adr/):
|
|
14
|
-
docTokens: {
|
|
15
|
-
enforce: ['CLAUDE.md', 'README.md', '*/README.md', 'guide/*.md', 'docs/*.md', 'adr/*.md'],
|
|
16
|
-
// Per-file budget bumps, keyed by repo-root-relative path (merges with defaults):
|
|
17
|
-
overrides: {
|
|
18
|
-
'CLAUDE.md': { maxTokens: 3500 },
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
// Per-glob page-size budget (default ON: `*+page.svelte` >280 lines → rip
|
|
23
|
-
// inline components out into their own files). This array REPLACES the
|
|
24
|
-
// default, so restate the SvelteKit rule if you only mean to add others:
|
|
25
|
-
pageSize: {
|
|
26
|
-
rules: [
|
|
27
|
-
{ glob: '*+page.svelte', maxLines: 280 },
|
|
28
|
-
{ glob: '*+layout.svelte', maxLines: 200 },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
// TS line budget (default ON: warn >225, fail >300 across apps/ + packages/).
|
|
33
|
-
// Override the thresholds, or allowlist files that are one responsibility but
|
|
34
|
-
// legitimately long (the allowlist array REPLACES the default — restate all):
|
|
35
|
-
fileSize: {
|
|
36
|
-
maxLines: 350,
|
|
37
|
-
allowlist: ['packages/foo/src/schema.ts'], // WHY: single zod schema
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
// Deliberately opt a repo out of the (default-on) catalog gate:
|
|
41
|
-
catalog: { enforce: false },
|
|
42
|
-
|
|
43
|
-
// Change the org-required catalog deps (default: ['remeda']; [] to opt out):
|
|
44
|
-
requireDeps: { deps: ['remeda'] },
|
|
45
|
-
|
|
46
|
-
// Opt in to the helper-manifest index by listing package dirs to scan:
|
|
47
|
-
helperManifest: {
|
|
48
|
-
packages: ['packages/utils'],
|
|
49
|
-
},
|
|
50
|
-
};
|