@zgeoff/chex 0.8.4 → 0.8.6
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/lefthook.yml
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
#
|
|
6
6
|
# It checks what the branch changes, plus the whole-tree gates that fit a
|
|
7
7
|
# small host: format:check and typecheck. CI runs every whole-tree check. It
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# adds no job before a commit, so a commit costs only the repo's own jobs, such
|
|
9
|
+
# as its staged-file fixers. A repo adds its own jobs under pre-commit.jobs and pre-push.jobs in
|
|
10
|
+
# lefthook.yml; the pre-push ones run before these.
|
|
11
11
|
# lefthook 2.2.2 lets a job of an extended file replace the job of the same
|
|
12
12
|
# name in lefthook.yml, so each job name here starts with chex-.
|
|
13
13
|
# Each job runs under diet's memory cap, so a run that outgrows the host fails
|
|
@@ -25,15 +25,6 @@
|
|
|
25
25
|
templates:
|
|
26
26
|
clear-git-env: unset $(git rev-parse --local-env-vars);
|
|
27
27
|
|
|
28
|
-
pre-commit:
|
|
29
|
-
# Sequential, so typecheck reads the files the fixers before it rewrote.
|
|
30
|
-
piped: true
|
|
31
|
-
jobs:
|
|
32
|
-
# lefthook skips the job when no staged file matches the glob.
|
|
33
|
-
- name: chex-typecheck
|
|
34
|
-
glob: '*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,json,jsonc}'
|
|
35
|
-
run: '{clear-git-env} bun x --no-install diet -- bun run typecheck'
|
|
36
|
-
|
|
37
28
|
pre-push:
|
|
38
29
|
# Sequential, to bound memory on a small host or with parallel agents.
|
|
39
30
|
piped: true
|
package/package.json
CHANGED
|
@@ -7,7 +7,11 @@ export function parseFixablePackages(output: string): string[] {
|
|
|
7
7
|
throw new TypeError('bun audit fix --json printed no object');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const stuck = new Set([
|
|
10
|
+
const stuck = new Set([
|
|
11
|
+
...collectNames(plan, 'blocked'),
|
|
12
|
+
...collectNames(plan, 'unfixable'),
|
|
13
|
+
...collectYoungFixNames(plan),
|
|
14
|
+
]);
|
|
11
15
|
|
|
12
16
|
return [...new Set(collectNames(plan, 'fixes'))].filter((name) => !stuck.has(name));
|
|
13
17
|
}
|
|
@@ -27,3 +31,21 @@ function collectNames(plan: Record<string, unknown>, key: string): string[] {
|
|
|
27
31
|
return entry['name'];
|
|
28
32
|
});
|
|
29
33
|
}
|
|
34
|
+
|
|
35
|
+
// `bun install` refuses a release younger than `minimumReleaseAge`, so until the fix ages past the
|
|
36
|
+
// gate, an ignore is the only way to pass the audit without an exclude
|
|
37
|
+
function collectYoungFixNames(plan: Record<string, unknown>): string[] {
|
|
38
|
+
const list = plan['fixes'];
|
|
39
|
+
|
|
40
|
+
if (!Array.isArray(list)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return list.flatMap((entry: unknown) =>
|
|
45
|
+
isRecord(entry) &&
|
|
46
|
+
typeof entry['name'] === 'string' &&
|
|
47
|
+
entry['newerThanMinimumReleaseAge'] === true
|
|
48
|
+
? [entry['name']]
|
|
49
|
+
: [],
|
|
50
|
+
);
|
|
51
|
+
}
|