@clipboard-health/oxlint-plugin 1.8.8 → 1.10.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 +43 -0
- package/package.json +7 -3
- package/src/bin/checkSuppressions.d.ts +2 -0
- package/src/bin/checkSuppressions.js +7 -0
- package/src/bin/checkSuppressions.js.map +1 -0
- package/src/bin/lintCeilings.d.ts +2 -0
- package/src/bin/lintCeilings.js +7 -0
- package/src/bin/lintCeilings.js.map +1 -0
- package/src/bin/runCheckSuppressions.d.ts +11 -0
- package/src/bin/runCheckSuppressions.js +126 -0
- package/src/bin/runCheckSuppressions.js.map +1 -0
- package/src/bin/runLintCeilings.d.ts +4 -0
- package/src/bin/runLintCeilings.js +313 -0
- package/src/bin/runLintCeilings.js.map +1 -0
- package/src/index.d.ts +5 -0
- package/src/index.js +9 -1
- package/src/index.js.map +1 -1
- package/src/lib/checkNeverSuppressRules.d.ts +18 -0
- package/src/lib/checkNeverSuppressRules.js +40 -0
- package/src/lib/checkNeverSuppressRules.js.map +1 -0
- package/src/lib/internal/changedLines.d.ts +24 -0
- package/src/lib/internal/changedLines.js +116 -0
- package/src/lib/internal/changedLines.js.map +1 -0
- package/src/lib/internal/json.d.ts +1 -0
- package/src/lib/internal/json.js +7 -0
- package/src/lib/internal/json.js.map +1 -0
- package/src/lib/internal/lintCeilings/ceilingOverrides.d.ts +34 -0
- package/src/lib/internal/lintCeilings/ceilingOverrides.js +128 -0
- package/src/lib/internal/lintCeilings/ceilingOverrides.js.map +1 -0
- package/src/lib/internal/lintCeilings/ceilingRules.d.ts +18 -0
- package/src/lib/internal/lintCeilings/ceilingRules.js +50 -0
- package/src/lib/internal/lintCeilings/ceilingRules.js.map +1 -0
- package/src/lib/internal/lintCeilings/ceilingsFile.d.ts +25 -0
- package/src/lib/internal/lintCeilings/ceilingsFile.js +111 -0
- package/src/lib/internal/lintCeilings/ceilingsFile.js.map +1 -0
- package/src/lib/internal/lintCeilings/compareCeilings.d.ts +43 -0
- package/src/lib/internal/lintCeilings/compareCeilings.js +112 -0
- package/src/lib/internal/lintCeilings/compareCeilings.js.map +1 -0
- package/src/lib/internal/lintCeilings/measure.d.ts +31 -0
- package/src/lib/internal/lintCeilings/measure.js +160 -0
- package/src/lib/internal/lintCeilings/measure.js.map +1 -0
- package/src/lib/internal/runCli.d.ts +10 -0
- package/src/lib/internal/runCli.js +22 -0
- package/src/lib/internal/runCli.js.map +1 -0
- package/src/lib/internal/runOxlint.d.ts +39 -0
- package/src/lib/internal/runOxlint.js +102 -0
- package/src/lib/internal/runOxlint.js.map +1 -0
- package/src/lib/internal/suppressionPolicy.d.ts +35 -0
- package/src/lib/internal/suppressionPolicy.js +153 -0
- package/src/lib/internal/suppressionPolicy.js.map +1 -0
- package/src/lib/internal/temporaryFile.d.ts +9 -0
- package/src/lib/internal/temporaryFile.js +29 -0
- package/src/lib/internal/temporaryFile.js.map +1 -0
- package/src/lib/rules/no-ambiguous-positional-parameters/index.js +24 -1
- package/src/lib/rules/no-ambiguous-positional-parameters/index.js.map +1 -1
- package/src/lib/rules/suppression-policy/index.d.ts +2 -0
- package/src/lib/rules/suppression-policy/index.js +60 -0
- package/src/lib/rules/suppression-policy/index.js.map +1 -0
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ ESLint.
|
|
|
23
23
|
- `require-run-validators-with-upsert`
|
|
24
24
|
- `require-to-declared-error`
|
|
25
25
|
- `require-zod-import-in-contracts`
|
|
26
|
+
- `suppression-policy`
|
|
26
27
|
|
|
27
28
|
## Configuration
|
|
28
29
|
|
|
@@ -65,3 +66,45 @@ the forms it skips. Enable it on controllers:
|
|
|
65
66
|
rules: { "@clipboard-health/require-to-declared-error": "error" },
|
|
66
67
|
},
|
|
67
68
|
```
|
|
69
|
+
|
|
70
|
+
## Suppression policy
|
|
71
|
+
|
|
72
|
+
`suppression-policy` checks every `eslint-disable*`, `oxlint-disable*`, `@ts-ignore`, and
|
|
73
|
+
`@ts-expect-error` comment:
|
|
74
|
+
|
|
75
|
+
- It forbids suppressing the rules in `NEVER_SUPPRESS_RULES`: `no-debugger`,
|
|
76
|
+
`typescript/no-explicit-any`, `typescript/no-unsafe-{argument,assignment,call,member-access,return}`,
|
|
77
|
+
and `typescript/strict-boolean-expressions`. Aliases such as `@typescript-eslint/no-explicit-any`
|
|
78
|
+
and `eslint/no-debugger` count. The list is fixed; repositories cannot remove rules from it.
|
|
79
|
+
- It requires `-- <reason>` on every other directive, and a reason after `@ts-expect-error`.
|
|
80
|
+
- It rejects generic reasons, such as a bare TypeScript error code, "legacy", "pre-existing
|
|
81
|
+
complexity", or "Legacy code retains this existing lint violation". A reason that goes on to say
|
|
82
|
+
why the code needs the exception passes.
|
|
83
|
+
- It forbids `@ts-ignore`, and any directive that disables `suppression-policy` or
|
|
84
|
+
`unicorn/no-abusive-eslint-disable`.
|
|
85
|
+
|
|
86
|
+
Enable it with the `suppressionPolicy` preset from `@clipboard-health/oxlint-config`.
|
|
87
|
+
|
|
88
|
+
### `cbh-check-suppressions`
|
|
89
|
+
|
|
90
|
+
A file-level `/* oxlint-disable @clipboard-health/suppression-policy */` silences the rule for the
|
|
91
|
+
whole file, including its report on that comment, and a repository with existing violations cannot
|
|
92
|
+
enable the rule yet. The `cbh-check-suppressions` CLI covers both. It applies the same policy to
|
|
93
|
+
directives added or changed since the merge base, and also reports blanket disables. The rule
|
|
94
|
+
writes its findings to a file instead of reporting them to Oxlint, so no inline directive can
|
|
95
|
+
silence them. Existing directives are left alone, so it can run in CI before the rule is enabled.
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
npx cbh-check-suppressions # compares with the pull request base in GitHub Actions, else origin/HEAD
|
|
99
|
+
npx cbh-check-suppressions --base origin/main
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
It compares the working tree, including uncommitted and untracked files, and respects the
|
|
103
|
+
repository's Oxlint `ignorePatterns`. It exits 1 on a violation. In GitHub Actions, check out with
|
|
104
|
+
`fetch-depth: 0` so it can find the merge base.
|
|
105
|
+
|
|
106
|
+
## `cbh-lint-ceilings`
|
|
107
|
+
|
|
108
|
+
Checks, tightens and generates `lint-ceilings.json`, the per-file upper bounds for count rules such
|
|
109
|
+
as `max-lines` and `complexity`. See
|
|
110
|
+
[Lint ceilings](../oxlint-config/README.md#lint-ceilings) in the config README.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/oxlint-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Clipboard's Oxlint plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oxlint",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"url": "git+https://github.com/ClipboardHealth/core-utils.git",
|
|
14
14
|
"directory": "packages/oxlint-plugin"
|
|
15
15
|
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"cbh-check-suppressions": "./src/bin/checkSuppressions.js",
|
|
18
|
+
"cbh-lint-ceilings": "./src/bin/lintCeilings.js"
|
|
19
|
+
},
|
|
16
20
|
"type": "commonjs",
|
|
17
21
|
"main": "./src/index.js",
|
|
18
22
|
"typings": "./src/index.d.ts",
|
|
@@ -20,11 +24,11 @@
|
|
|
20
24
|
"access": "public"
|
|
21
25
|
},
|
|
22
26
|
"dependencies": {
|
|
23
|
-
"@oxlint/plugins": "1.
|
|
27
|
+
"@oxlint/plugins": "1.93.0",
|
|
24
28
|
"tslib": "2.8.1"
|
|
25
29
|
},
|
|
26
30
|
"devDependencies": {
|
|
27
|
-
"oxlint": "1.
|
|
31
|
+
"oxlint": "1.93.0"
|
|
28
32
|
},
|
|
29
33
|
"types": "./src/index.d.ts"
|
|
30
34
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const runCli_1 = require("../lib/internal/runCli");
|
|
5
|
+
const runCheckSuppressions_1 = require("./runCheckSuppressions");
|
|
6
|
+
(0, runCli_1.runCli)(runCheckSuppressions_1.runCheckSuppressions);
|
|
7
|
+
//# sourceMappingURL=checkSuppressions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkSuppressions.js","sourceRoot":"","sources":["../../../../../packages/oxlint-plugin/src/bin/checkSuppressions.ts"],"names":[],"mappings":";;;AAEA,mDAAgD;AAChD,iEAA8D;AAE9D,IAAA,eAAM,EAAC,2CAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const runCli_1 = require("../lib/internal/runCli");
|
|
5
|
+
const runLintCeilings_1 = require("./runLintCeilings");
|
|
6
|
+
(0, runCli_1.runCli)(runLintCeilings_1.runLintCeilings);
|
|
7
|
+
//# sourceMappingURL=lintCeilings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lintCeilings.js","sourceRoot":"","sources":["../../../../../packages/oxlint-plugin/src/bin/lintCeilings.ts"],"names":[],"mappings":";;;AAEA,mDAAgD;AAChD,uDAAoD;AAEpD,IAAA,eAAM,EAAC,iCAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface RunCheckSuppressionsParams {
|
|
2
|
+
args: readonly string[];
|
|
3
|
+
cwd: string;
|
|
4
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
5
|
+
/** Module Oxlint loads the rule from; defaults to this package. */
|
|
6
|
+
pluginSpecifier?: string;
|
|
7
|
+
write: (output: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function runCheckSuppressions(params: RunCheckSuppressionsParams): {
|
|
10
|
+
exitCode: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCheckSuppressions = runCheckSuppressions;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_os_1 = require("node:os");
|
|
8
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
9
|
+
const node_util_1 = require("node:util");
|
|
10
|
+
const changedLines_1 = require("../lib/internal/changedLines");
|
|
11
|
+
const runOxlint_1 = require("../lib/internal/runOxlint");
|
|
12
|
+
const json_1 = require("../lib/internal/json");
|
|
13
|
+
const temporaryFile_1 = require("../lib/internal/temporaryFile");
|
|
14
|
+
const suppressionPolicy_1 = require("../lib/internal/suppressionPolicy");
|
|
15
|
+
const LINTABLE_FILE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
|
|
16
|
+
const USAGE = `Usage: cbh-check-suppressions [--base <ref>]
|
|
17
|
+
|
|
18
|
+
Applies @clipboard-health/suppression-policy to lint directives added or changed since the merge
|
|
19
|
+
base with <ref>. Defaults to the pull request base in GitHub Actions, else origin/HEAD.
|
|
20
|
+
`;
|
|
21
|
+
function runCheckSuppressions(params) {
|
|
22
|
+
const { cwd, env, write } = params;
|
|
23
|
+
const pluginSpecifier = params.pluginSpecifier ?? node_path_1.default.join(__dirname, "../index.js");
|
|
24
|
+
let base;
|
|
25
|
+
try {
|
|
26
|
+
const { values } = (0, node_util_1.parseArgs)({
|
|
27
|
+
args: [...params.args],
|
|
28
|
+
options: { base: { type: "string" }, help: { type: "boolean", short: "h" } },
|
|
29
|
+
strict: true,
|
|
30
|
+
});
|
|
31
|
+
if (values.help === true) {
|
|
32
|
+
write(USAGE);
|
|
33
|
+
return { exitCode: 0 };
|
|
34
|
+
}
|
|
35
|
+
({ base } = values);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
write(`${error instanceof Error ? error.message : String(error)}\n\n${USAGE}`);
|
|
39
|
+
return { exitCode: 2 };
|
|
40
|
+
}
|
|
41
|
+
const root = (0, changedLines_1.git)({ args: ["rev-parse", "--show-toplevel"], cwd }).trim();
|
|
42
|
+
const mergeBase = (0, changedLines_1.resolveMergeBase)({ base, cwd: root, eventPath: env["GITHUB_EVENT_PATH"] });
|
|
43
|
+
const changed = (0, changedLines_1.readChangedLines)({ cwd: root, include: LINTABLE_FILE, mergeBase });
|
|
44
|
+
const files = [...changed.keys()];
|
|
45
|
+
if (files.length === 0) {
|
|
46
|
+
write("cbh-check-suppressions: no changed JavaScript or TypeScript files.\n");
|
|
47
|
+
return { exitCode: 0 };
|
|
48
|
+
}
|
|
49
|
+
const recordDirectory = (0, node_fs_1.mkdtempSync)(node_path_1.default.join((0, node_os_1.tmpdir)(), "cbh-check-suppressions-"));
|
|
50
|
+
const recordPath = node_path_1.default.join(recordDirectory, "violations.jsonl");
|
|
51
|
+
// The configuration sits in the repository root so its `ignorePatterns` resolve as the
|
|
52
|
+
// repository's own do; Oxlint applies only configuration patterns to explicit file arguments.
|
|
53
|
+
const configPath = node_path_1.default.join(root, `.cbh-check-suppressions-${(0, node_crypto_1.randomBytes)(6).toString("hex")}.json`);
|
|
54
|
+
let records;
|
|
55
|
+
let diagnostics;
|
|
56
|
+
try {
|
|
57
|
+
({ diagnostics } = (0, temporaryFile_1.withTemporaryFile)({
|
|
58
|
+
path: configPath,
|
|
59
|
+
content: JSON.stringify({
|
|
60
|
+
categories: Object.fromEntries(["correctness", "nursery", "pedantic", "perf", "restriction", "style", "suspicious"].map((category) => [category, "off"])),
|
|
61
|
+
ignorePatterns: (0, runOxlint_1.readIgnorePatterns)({ cwd: root }).ignorePatterns,
|
|
62
|
+
jsPlugins: [{ name: "cbh-check-suppressions", specifier: pluginSpecifier }],
|
|
63
|
+
plugins: [],
|
|
64
|
+
rules: { [`cbh-check-suppressions/${suppressionPolicy_1.SUPPRESSION_POLICY_RULE_NAME}`]: "error" },
|
|
65
|
+
settings: { [suppressionPolicy_1.RECORD_SETTING]: { recordPath } },
|
|
66
|
+
}),
|
|
67
|
+
run: () => (0, runOxlint_1.runOxlint)({
|
|
68
|
+
args: ["--config", configPath, "--disable-nested-config", "--format=json", ...files],
|
|
69
|
+
cwd: root,
|
|
70
|
+
}),
|
|
71
|
+
}));
|
|
72
|
+
records = (0, node_fs_1.existsSync)(recordPath) ? (0, node_fs_1.readFileSync)(recordPath, "utf8") : "";
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
(0, node_fs_1.rmSync)(recordDirectory, { force: true, recursive: true });
|
|
76
|
+
}
|
|
77
|
+
// Only the policy rule is enabled, so any other diagnostic, such as a parse error, means Oxlint
|
|
78
|
+
// skipped the rule for that file and "no violations" would be false.
|
|
79
|
+
const unevaluated = diagnostics
|
|
80
|
+
.filter((diagnostic) => !diagnostic.code.endsWith(`(${suppressionPolicy_1.SUPPRESSION_POLICY_RULE_NAME})`))
|
|
81
|
+
.map((diagnostic) => `${node_path_1.default.relative(root, diagnostic.filename)}: ${diagnostic.message}`);
|
|
82
|
+
if (unevaluated.length > 0) {
|
|
83
|
+
write(`${unevaluated.join("\n")}\n\ncbh-check-suppressions: Oxlint could not evaluate the policy for ${unevaluated.length} diagnostic(s); fix them and rerun.\n`);
|
|
84
|
+
return { exitCode: 1 };
|
|
85
|
+
}
|
|
86
|
+
const failures = [];
|
|
87
|
+
for (const line of records.split("\n")) {
|
|
88
|
+
if (line === "") {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const { endLine, file: absoluteFile, message, startLine } = parseRecord({ line });
|
|
92
|
+
const file = node_path_1.default.relative(root, absoluteFile);
|
|
93
|
+
const changedLines = changed.get(file);
|
|
94
|
+
let touched = false;
|
|
95
|
+
for (let lineNumber = startLine; lineNumber <= endLine && !touched; lineNumber += 1) {
|
|
96
|
+
touched = changedLines?.has(lineNumber) ?? false;
|
|
97
|
+
}
|
|
98
|
+
if (touched) {
|
|
99
|
+
failures.push(`${file}:${startLine}: ${message}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
failures.sort((left, right) => left.localeCompare(right, "en", { numeric: true }));
|
|
103
|
+
if (failures.length > 0) {
|
|
104
|
+
write(`${failures.join("\n")}\n\ncbh-check-suppressions: ${failures.length} new or changed suppression(s) break the suppression policy.\n`);
|
|
105
|
+
return { exitCode: 1 };
|
|
106
|
+
}
|
|
107
|
+
write(`cbh-check-suppressions: checked ${files.length} changed file(s); no violations.\n`);
|
|
108
|
+
return { exitCode: 0 };
|
|
109
|
+
}
|
|
110
|
+
function parseRecord(params) {
|
|
111
|
+
const record = JSON.parse(params.line);
|
|
112
|
+
if (!(0, json_1.isPlainObject)(record) ||
|
|
113
|
+
typeof record["file"] !== "string" ||
|
|
114
|
+
typeof record["message"] !== "string" ||
|
|
115
|
+
typeof record["startLine"] !== "number" ||
|
|
116
|
+
typeof record["endLine"] !== "number") {
|
|
117
|
+
throw new TypeError(`Unexpected suppression-policy record: ${params.line}`);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
endLine: record["endLine"],
|
|
121
|
+
file: record["file"],
|
|
122
|
+
message: record["message"],
|
|
123
|
+
startLine: record["startLine"],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=runCheckSuppressions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runCheckSuppressions.js","sourceRoot":"","sources":["../../../../../packages/oxlint-plugin/src/bin/runCheckSuppressions.ts"],"names":[],"mappings":";;;;AAAA,6CAA0C;AAC1C,qCAAwE;AACxE,qCAAiC;AACjC,kEAA6B;AAC7B,yCAAsC;AAEtC,+DAAuF;AACvF,yDAAiG;AACjG,+CAAqD;AACrD,iEAAkE;AAClE,yEAAiG;AAEjG,MAAM,aAAa,GAAG,0BAA0B,CAAC;AACjD,MAAM,KAAK,GAAG;;;;CAIb,CAAC;AAWF,8BAAqC,MAAkC;IACrE,MAAM,EAAE,GAAG,EAAE,GAAG,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gEAAgE,CACrI,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,mCAAmC,KAAK,CAAC,MAAM,oCAAoC,CAAC,CAAC;IAC3F,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AACzB,CAAC;AAED,SAAS,WAAW,CAAC,MAAwB;IAM3C,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChD,IACE,CAAC,IAAA,oBAAa,EAAC,MAAM,CAAC;QACtB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,QAAQ;QAClC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,QAAQ;QACrC,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,QAAQ;QACvC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,EACrC,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,yCAAyC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC;QAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runLintCeilings = runLintCeilings;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
|
+
const node_util_1 = require("node:util");
|
|
8
|
+
const changedLines_1 = require("../lib/internal/changedLines");
|
|
9
|
+
const json_1 = require("../lib/internal/json");
|
|
10
|
+
const ceilingRules_1 = require("../lib/internal/lintCeilings/ceilingRules");
|
|
11
|
+
const ceilingOverrides_1 = require("../lib/internal/lintCeilings/ceilingOverrides");
|
|
12
|
+
const ceilingsFile_1 = require("../lib/internal/lintCeilings/ceilingsFile");
|
|
13
|
+
const compareCeilings_1 = require("../lib/internal/lintCeilings/compareCeilings");
|
|
14
|
+
const measure_1 = require("../lib/internal/lintCeilings/measure");
|
|
15
|
+
const runOxlint_1 = require("../lib/internal/runOxlint");
|
|
16
|
+
const USAGE = `Usage: cbh-lint-ceilings <command> [options]
|
|
17
|
+
|
|
18
|
+
Commands:
|
|
19
|
+
check [--base <ref>] [--allow-increases]
|
|
20
|
+
Fails if a changed file listed in ${ceilingsFile_1.LINT_CEILINGS_FILE} grew since the base, or if an entry
|
|
21
|
+
was added or raised. --allow-increases reports these without failing; pass it only when the
|
|
22
|
+
increase is approved. The base defaults to HEAD^1 for GitHub Actions merge commits and
|
|
23
|
+
merge-queue runs, else the merge base with the pull request base or origin/HEAD.
|
|
24
|
+
tighten
|
|
25
|
+
Lowers each ceiling to its file's current value and removes entries for files that are
|
|
26
|
+
missing or within the default.
|
|
27
|
+
init [--rule <name>]...
|
|
28
|
+
Writes an entry for every file that exceeds its default, for the given rules (default: all
|
|
29
|
+
supported rules), keeping entries for other rules.
|
|
30
|
+
`;
|
|
31
|
+
function runLintCeilings(params) {
|
|
32
|
+
const { cwd, env, write } = params;
|
|
33
|
+
const [command, ...rest] = params.args;
|
|
34
|
+
let values;
|
|
35
|
+
try {
|
|
36
|
+
({ values } = (0, node_util_1.parseArgs)({
|
|
37
|
+
args: rest,
|
|
38
|
+
options: {
|
|
39
|
+
"allow-increases": { type: "boolean" },
|
|
40
|
+
base: { type: "string" },
|
|
41
|
+
help: { type: "boolean", short: "h" },
|
|
42
|
+
rule: { multiple: true, type: "string" },
|
|
43
|
+
},
|
|
44
|
+
strict: true,
|
|
45
|
+
}));
|
|
46
|
+
if (command === "--help" || command === "-h" || values.help === true) {
|
|
47
|
+
write(USAGE);
|
|
48
|
+
return { exitCode: 0 };
|
|
49
|
+
}
|
|
50
|
+
assertOptions({ command, values });
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
write(`${error instanceof Error ? error.message : String(error)}\n\n${USAGE}`);
|
|
54
|
+
return { exitCode: 2 };
|
|
55
|
+
}
|
|
56
|
+
const root = (0, changedLines_1.git)({ args: ["rev-parse", "--show-toplevel"], cwd }).trim();
|
|
57
|
+
const context = { env, root, write };
|
|
58
|
+
switch (command) {
|
|
59
|
+
case "check": {
|
|
60
|
+
return check({
|
|
61
|
+
allowIncreases: values["allow-increases"] === true,
|
|
62
|
+
base: values.base,
|
|
63
|
+
context,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
case "tighten": {
|
|
67
|
+
return tighten({ context });
|
|
68
|
+
}
|
|
69
|
+
default: {
|
|
70
|
+
return init({ context, ruleNames: values.rule ?? Object.keys(ceilingRules_1.CEILING_RULES) });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function assertOptions(params) {
|
|
75
|
+
const { command, values } = params;
|
|
76
|
+
if (command !== "check" && command !== "tighten" && command !== "init") {
|
|
77
|
+
throw new Error(`Unknown command: ${command ?? "(none)"}`);
|
|
78
|
+
}
|
|
79
|
+
if (command !== "check" && (values.base !== undefined || values["allow-increases"] === true)) {
|
|
80
|
+
throw new Error("--base and --allow-increases apply only to check.");
|
|
81
|
+
}
|
|
82
|
+
if (command !== "init" && values.rule !== undefined) {
|
|
83
|
+
throw new Error("--rule applies only to init.");
|
|
84
|
+
}
|
|
85
|
+
for (const rule of values.rule ?? []) {
|
|
86
|
+
if (!(0, ceilingRules_1.isCeilingRule)(rule)) {
|
|
87
|
+
throw new Error(`Unsupported rule "${rule}". Use one of: ${Object.keys(ceilingRules_1.CEILING_RULES).join(", ")}.`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function check(params) {
|
|
92
|
+
const { allowIncreases, context } = params;
|
|
93
|
+
const { env, root, write } = context;
|
|
94
|
+
const ceilingsPath = node_path_1.default.join(root, ceilingsFile_1.LINT_CEILINGS_FILE);
|
|
95
|
+
if (!(0, node_fs_1.existsSync)(ceilingsPath)) {
|
|
96
|
+
write(`cbh-lint-ceilings: no ${ceilingsFile_1.LINT_CEILINGS_FILE}; nothing to check.\n`);
|
|
97
|
+
return { exitCode: 0 };
|
|
98
|
+
}
|
|
99
|
+
const { canonical, ceilings: headCeilings } = (0, ceilingsFile_1.readLintCeilingsText)({
|
|
100
|
+
text: (0, node_fs_1.readFileSync)(ceilingsPath, "utf8"),
|
|
101
|
+
});
|
|
102
|
+
if (!canonical) {
|
|
103
|
+
write(`${ceilingsFile_1.LINT_CEILINGS_FILE} is not in the canonical layout: rules and paths sorted, a blank line between entries, and no empty rules. \`cbh-lint-ceilings tighten\` rewrites it in that layout.\n`);
|
|
104
|
+
return { exitCode: 1 };
|
|
105
|
+
}
|
|
106
|
+
const base = resolveBase({ base: params.base, env, root });
|
|
107
|
+
const baseCeilings = readBaseCeilings({ base, root });
|
|
108
|
+
const changedFiles = readChangedFiles({ base, root });
|
|
109
|
+
const toMeasure = changedFiles.flatMap(({ basePath, headPath }) => {
|
|
110
|
+
if (basePath === undefined || headPath === undefined) {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
const rules = (0, compareCeilings_1.listedRules)({ baseCeilings, basePath, headCeilings, headPath });
|
|
114
|
+
return rules.length === 0 ? [] : [{ basePath, headPath, rules }];
|
|
115
|
+
});
|
|
116
|
+
const ruleNames = [...new Set(toMeasure.flatMap((file) => file.rules))];
|
|
117
|
+
let baseMeasurements = new Map();
|
|
118
|
+
let headMeasurements = new Map();
|
|
119
|
+
if (toMeasure.length > 0) {
|
|
120
|
+
const printedConfig = printDefaults({ env, root });
|
|
121
|
+
baseMeasurements = (0, measure_1.measureFiles)({
|
|
122
|
+
files: toMeasure.map((file) => ({
|
|
123
|
+
content: (0, changedLines_1.git)({ args: ["show", `${base}:${file.basePath}`], cwd: root }),
|
|
124
|
+
path: file.basePath,
|
|
125
|
+
})),
|
|
126
|
+
oxlintFrom: root,
|
|
127
|
+
printedConfig,
|
|
128
|
+
ruleNames,
|
|
129
|
+
});
|
|
130
|
+
headMeasurements = (0, measure_1.measureFiles)({
|
|
131
|
+
files: toMeasure.map((file) => ({
|
|
132
|
+
content: (0, node_fs_1.readFileSync)(node_path_1.default.join(root, file.headPath), "utf8"),
|
|
133
|
+
path: file.headPath,
|
|
134
|
+
})),
|
|
135
|
+
oxlintFrom: root,
|
|
136
|
+
printedConfig,
|
|
137
|
+
ruleNames,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const increases = (0, compareCeilings_1.findIncreases)({
|
|
141
|
+
baseCeilings,
|
|
142
|
+
baseMeasurements,
|
|
143
|
+
changedFiles,
|
|
144
|
+
headCeilings,
|
|
145
|
+
headMeasurements,
|
|
146
|
+
});
|
|
147
|
+
const messages = increases.map((increase) => increase.message).join("\n");
|
|
148
|
+
if (increases.length === 0) {
|
|
149
|
+
write(`cbh-lint-ceilings: checked ${toMeasure.length} changed listed file(s); nothing grew.\n`);
|
|
150
|
+
return { exitCode: 0 };
|
|
151
|
+
}
|
|
152
|
+
if (allowIncreases) {
|
|
153
|
+
write(`${messages}\n\ncbh-lint-ceilings: ${increases.length} increase(s) allowed by --allow-increases.\n`);
|
|
154
|
+
return { exitCode: 0 };
|
|
155
|
+
}
|
|
156
|
+
write(`${messages}\n\ncbh-lint-ceilings: ${increases.length} increase(s). Files listed in ${ceilingsFile_1.LINT_CEILINGS_FILE} may shrink but not grow, and entries may be lowered or removed but not added or raised without approval. Oxlint enforces the ceiling, which can be up to a week stale; this check enforces no growth.\n`);
|
|
157
|
+
return { exitCode: 1 };
|
|
158
|
+
}
|
|
159
|
+
function tighten(params) {
|
|
160
|
+
const { env, root, write } = params.context;
|
|
161
|
+
const ceilingsPath = node_path_1.default.join(root, ceilingsFile_1.LINT_CEILINGS_FILE);
|
|
162
|
+
if (!(0, node_fs_1.existsSync)(ceilingsPath)) {
|
|
163
|
+
write(`cbh-lint-ceilings: no ${ceilingsFile_1.LINT_CEILINGS_FILE}; nothing to tighten.\n`);
|
|
164
|
+
return { exitCode: 0 };
|
|
165
|
+
}
|
|
166
|
+
const { ceilings } = (0, ceilingsFile_1.readLintCeilingsText)({ text: (0, node_fs_1.readFileSync)(ceilingsPath, "utf8") });
|
|
167
|
+
const exists = (file) => (0, node_fs_1.existsSync)(node_path_1.default.join(root, file));
|
|
168
|
+
const files = [
|
|
169
|
+
...new Set(Object.values(ceilings.rules).flatMap((entries) => Object.keys(entries))),
|
|
170
|
+
]
|
|
171
|
+
.filter((file) => exists(file))
|
|
172
|
+
.map((file) => ({ content: (0, node_fs_1.readFileSync)(node_path_1.default.join(root, file), "utf8"), path: file }));
|
|
173
|
+
const measurements = (0, measure_1.measureFiles)({
|
|
174
|
+
files,
|
|
175
|
+
oxlintFrom: root,
|
|
176
|
+
printedConfig: printDefaults({ env, root }),
|
|
177
|
+
ruleNames: Object.keys(ceilings.rules),
|
|
178
|
+
});
|
|
179
|
+
const { ceilings: tightened, changes } = (0, compareCeilings_1.tightenCeilings)({ ceilings, exists, measurements });
|
|
180
|
+
(0, node_fs_1.writeFileSync)(ceilingsPath, (0, ceilingsFile_1.formatLintCeilings)({ ceilings: tightened }));
|
|
181
|
+
write(changes.length === 0
|
|
182
|
+
? "cbh-lint-ceilings: every ceiling is current.\n"
|
|
183
|
+
: `${changes.join("\n")}\n\ncbh-lint-ceilings: tightened ${changes.length} entr${changes.length === 1 ? "y" : "ies"}.\n`);
|
|
184
|
+
return { exitCode: 0 };
|
|
185
|
+
}
|
|
186
|
+
function init(params) {
|
|
187
|
+
const { context, ruleNames } = params;
|
|
188
|
+
const { env, root, write } = context;
|
|
189
|
+
const ceilingsPath = node_path_1.default.join(root, ceilingsFile_1.LINT_CEILINGS_FILE);
|
|
190
|
+
const existing = (0, node_fs_1.existsSync)(ceilingsPath)
|
|
191
|
+
? (0, ceilingsFile_1.readLintCeilingsText)({ text: (0, node_fs_1.readFileSync)(ceilingsPath, "utf8") }).ceilings
|
|
192
|
+
: { rules: {}, version: 1 };
|
|
193
|
+
const measurements = (0, measure_1.measureRepository)({
|
|
194
|
+
printedConfig: printDefaults({ env, root }),
|
|
195
|
+
root,
|
|
196
|
+
ruleNames,
|
|
197
|
+
});
|
|
198
|
+
const rules = { ...existing.rules };
|
|
199
|
+
let count = 0;
|
|
200
|
+
for (const ruleName of ruleNames) {
|
|
201
|
+
const entries = {};
|
|
202
|
+
for (const [file, fileMeasurements] of measurements) {
|
|
203
|
+
const measured = fileMeasurements.get(ruleName);
|
|
204
|
+
if (measured !== undefined) {
|
|
205
|
+
entries[file] = measured.max;
|
|
206
|
+
count += 1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
rules[ruleName] = entries;
|
|
210
|
+
}
|
|
211
|
+
(0, node_fs_1.writeFileSync)(ceilingsPath, (0, ceilingsFile_1.formatLintCeilings)({ ceilings: { rules, version: 1 } }));
|
|
212
|
+
write(`cbh-lint-ceilings: wrote ${count} entr${count === 1 ? "y" : "ies"} to ${ceilingsFile_1.LINT_CEILINGS_FILE}.\n`);
|
|
213
|
+
return { exitCode: 0 };
|
|
214
|
+
}
|
|
215
|
+
/** The repository's resolved configuration with lint-ceilings.json ignored, so defaults show. */
|
|
216
|
+
function printDefaults(params) {
|
|
217
|
+
return (0, runOxlint_1.printOxlintConfig)({
|
|
218
|
+
cwd: params.root,
|
|
219
|
+
env: { ...params.env, [ceilingOverrides_1.LINT_CEILINGS_ENV]: "ignore" },
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* In GitHub Actions, a `pull_request` run's default checkout is a merge commit whose first parent
|
|
224
|
+
* is the target branch, so `fetch-depth: 2` is enough; a `merge_group` run compares with the
|
|
225
|
+
* queue's base. Any other checkout, such as the pull request head, uses the merge base.
|
|
226
|
+
*/
|
|
227
|
+
function resolveBase(params) {
|
|
228
|
+
const { base, env, root } = params;
|
|
229
|
+
const eventPath = env["GITHUB_EVENT_PATH"];
|
|
230
|
+
if (base !== undefined || env["GITHUB_ACTIONS"] !== "true") {
|
|
231
|
+
return (0, changedLines_1.resolveMergeBase)({ base, cwd: root, eventPath });
|
|
232
|
+
}
|
|
233
|
+
if (env["GITHUB_EVENT_NAME"] === "merge_group") {
|
|
234
|
+
const queueBase = readEventField({ eventPath, keys: ["merge_group", "base_sha"] });
|
|
235
|
+
if (queueBase === undefined) {
|
|
236
|
+
throw new Error("The merge_group event has no merge_group.base_sha.");
|
|
237
|
+
}
|
|
238
|
+
return requireCommit({ commit: queueBase, root });
|
|
239
|
+
}
|
|
240
|
+
const head = (0, changedLines_1.git)({ args: ["rev-parse", "HEAD"], cwd: root }).trim();
|
|
241
|
+
if (head === env["GITHUB_SHA"]) {
|
|
242
|
+
const parents = (0, changedLines_1.git)({ args: ["rev-list", "--parents", "-n", "1", "HEAD"], cwd: root })
|
|
243
|
+
.trim()
|
|
244
|
+
.split(" ")
|
|
245
|
+
.slice(1);
|
|
246
|
+
// A shallow clone's oldest commit shows no parents.
|
|
247
|
+
if (parents.length === 0) {
|
|
248
|
+
throw new Error("HEAD has no parent commit in this checkout. In GitHub Actions, check out with `fetch-depth: 2`.");
|
|
249
|
+
}
|
|
250
|
+
if (parents.length >= 2 && parents[0] !== undefined) {
|
|
251
|
+
return requireCommit({ commit: parents[0], root });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return (0, changedLines_1.resolveMergeBase)({ base, cwd: root, eventPath });
|
|
255
|
+
}
|
|
256
|
+
function requireCommit(params) {
|
|
257
|
+
try {
|
|
258
|
+
(0, changedLines_1.git)({ args: ["cat-file", "-e", `${params.commit}^{commit}`], cwd: params.root });
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
throw new Error(`Base commit ${params.commit} is not in this checkout. In GitHub Actions, check out with \`fetch-depth: 2\`, or deeper for a rebase merge queue.`, { cause: error });
|
|
262
|
+
}
|
|
263
|
+
return params.commit;
|
|
264
|
+
}
|
|
265
|
+
function readEventField(params) {
|
|
266
|
+
const { eventPath, keys } = params;
|
|
267
|
+
if (eventPath === undefined || eventPath === "") {
|
|
268
|
+
return undefined;
|
|
269
|
+
}
|
|
270
|
+
let value = JSON.parse((0, node_fs_1.readFileSync)(eventPath, "utf8"));
|
|
271
|
+
for (const key of keys) {
|
|
272
|
+
value = (0, json_1.isPlainObject)(value) ? value[key] : undefined;
|
|
273
|
+
}
|
|
274
|
+
return typeof value === "string" ? value : undefined;
|
|
275
|
+
}
|
|
276
|
+
function readBaseCeilings(params) {
|
|
277
|
+
const { base, root } = params;
|
|
278
|
+
let text;
|
|
279
|
+
try {
|
|
280
|
+
text = (0, changedLines_1.git)({ args: ["show", `${base}:${ceilingsFile_1.LINT_CEILINGS_FILE}`], cwd: root });
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return { rules: {}, version: 1 };
|
|
284
|
+
}
|
|
285
|
+
return (0, ceilingsFile_1.parseLintCeilings)({ value: JSON.parse(text) });
|
|
286
|
+
}
|
|
287
|
+
/** Files changed between `base` and the working tree, following renames. */
|
|
288
|
+
function readChangedFiles(params) {
|
|
289
|
+
const fields = (0, changedLines_1.git)({
|
|
290
|
+
args: ["diff", "--name-status", "-z", "--find-renames", "--no-ext-diff", params.base],
|
|
291
|
+
cwd: params.root,
|
|
292
|
+
}).split("\0");
|
|
293
|
+
const changed = [];
|
|
294
|
+
for (let index = 0; index < fields.length - 1;) {
|
|
295
|
+
const status = fields[index] ?? "";
|
|
296
|
+
if (status.startsWith("R") || status.startsWith("C")) {
|
|
297
|
+
const from = fields[index + 1];
|
|
298
|
+
const to = fields[index + 2];
|
|
299
|
+
changed.push({ basePath: status.startsWith("R") ? from : undefined, headPath: to });
|
|
300
|
+
index += 3;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
const file = fields[index + 1];
|
|
304
|
+
changed.push({
|
|
305
|
+
basePath: status === "A" ? undefined : file,
|
|
306
|
+
headPath: status === "D" ? undefined : file,
|
|
307
|
+
});
|
|
308
|
+
index += 2;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return changed;
|
|
312
|
+
}
|
|
313
|
+
//# sourceMappingURL=runLintCeilings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runLintCeilings.js","sourceRoot":"","sources":["../../../../../packages/oxlint-plugin/src/bin/runLintCeilings.ts"],"names":[],"mappings":";;;;AAAA,qCAAkE;AAClE,kEAA6B;AAC7B,yCAAsC;AAEtC,+DAAqE;AACrE,+CAAqD;AACrD,4EAAyF;AACzF,oFAAkF;AAClF,4EAMmD;AACnD,kFAKsD;AACtD,kEAI8C;AAE9C,yDAA8D;AAE9D,MAAM,KAAK,GAAG;;;;0CAI4B,iCAAkB;;;;;;;;;;CAU3D,CAAC;AAQF,yBAAgC,MAAiB;IAC/C,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;IAEvC,IAAI,MAAuF,CAAC;IAC5F,IAAI,CAAC;QACH,CAAC,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAS,EAAC;YACtB,IAAI,EAAE,IAAI;YACV,OAAO,EAAE;gBACP,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBACtC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACxB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;gBACrC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;aACzC;YACD,MAAM,EAAE,IAAI;SACb,CAAC,CAAC,CAAC;QACJ,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAA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BAC3C,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;aAC5C,CAAC,CAAC;YACH,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/src/index.d.ts
CHANGED
|
@@ -12,4 +12,9 @@ export declare const rules: {
|
|
|
12
12
|
"require-run-validators-with-upsert": import("@oxlint/plugins").Rule;
|
|
13
13
|
"require-to-declared-error": import("@oxlint/plugins").Rule;
|
|
14
14
|
"require-zod-import-in-contracts": import("@oxlint/plugins").Rule;
|
|
15
|
+
"suppression-policy": import("@oxlint/plugins").Rule;
|
|
15
16
|
};
|
|
17
|
+
export { checkNeverSuppressRules } from "./lib/checkNeverSuppressRules";
|
|
18
|
+
export { NEVER_SUPPRESS_RULES } from "./lib/internal/suppressionPolicy";
|
|
19
|
+
export { type CeilingConfig, type CeilingOverride, createLintCeilingOverrides, } from "./lib/internal/lintCeilings/ceilingOverrides";
|
|
20
|
+
export type { LintCeilings } from "./lib/internal/lintCeilings/ceilingsFile";
|