oxlint-harness 1.0.5 → 1.0.7

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 CHANGED
@@ -240,6 +240,13 @@ pnpm lint
240
240
  pnpm dev --help
241
241
  ```
242
242
 
243
+ ## Publishing
244
+
245
+ ```
246
+ npm login
247
+ npm publish
248
+ ```
249
+
243
250
  ## License
244
251
 
245
252
  MIT
package/dist/command.d.ts CHANGED
@@ -10,6 +10,7 @@ export default class OxlintHarness extends Command {
10
10
  "show-code": import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
11
  "results-path": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
12
  "save-results": import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ tighten: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
14
  };
14
15
  static args: {
15
16
  paths: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
package/dist/command.js CHANGED
@@ -53,6 +53,12 @@ The suppression file format uses counts per rule per file:
53
53
  default: true,
54
54
  allowNo: true,
55
55
  }),
56
+ tighten: Flags.boolean({
57
+ char: "t",
58
+ description: "Tighten suppressions by reducing counts when violations are fixed",
59
+ default: true,
60
+ allowNo: true,
61
+ }),
56
62
  };
57
63
  static args = {
58
64
  paths: Args.string({
@@ -83,11 +89,17 @@ The suppression file format uses counts per rule per file:
83
89
  this.log(" --show-code <number> Show code snippets for files with N or fewer errors (default: 3, 0 to disable)");
84
90
  this.log(" --results-path <path> Path to save oxlint JSON results (default: artifacts/oxlint-results.json)");
85
91
  this.log(" --no-save-results Don't save oxlint JSON results to file");
92
+ this.log(" -t, --tighten Tighten suppressions when violations are fixed (default: true)");
93
+ this.log(" --no-tighten Don't tighten suppressions");
94
+ this.log(" --no-type-aware Don't pass --type-aware to oxlint (default: passes it)");
95
+ this.log(" --no-type-check Don't pass --type-check to oxlint (default: passes it)");
86
96
  this.log(" -h, --help Show this help message");
87
97
  this.log("");
88
98
  this.log("ENVIRONMENT VARIABLES");
89
99
  this.log(" OXLINT_HARNESS_RESULTS_PATH Override the results file path");
90
100
  this.log(" OXLINT_HARNESS_NO_FAIL_ON_EXCESS Set to 'true' to exit 0 on new errors");
101
+ this.log(" OXLINT_HARNESS_NO_TYPE_AWARE Set to 'true' to skip --type-aware");
102
+ this.log(" OXLINT_HARNESS_NO_TYPE_CHECK Set to 'true' to skip --type-check");
91
103
  this.log("");
92
104
  this.log("ARGS");
93
105
  this.log(" <paths> Files or directories to lint (passed to oxlint)");
@@ -113,6 +125,11 @@ The suppression file format uses counts per rule per file:
113
125
  "--results-path",
114
126
  "--save-results",
115
127
  "--no-save-results",
128
+ "--tighten",
129
+ "-t",
130
+ "--no-tighten",
131
+ "--no-type-aware",
132
+ "--no-type-check",
116
133
  ]);
117
134
  const collectOxlintArgs = (args) => {
118
135
  const passthrough = [];
@@ -139,6 +156,12 @@ The suppression file format uses counts per rule per file:
139
156
  if (arg === "--save-results" || arg === "--no-save-results") {
140
157
  continue;
141
158
  }
159
+ if (arg === "--tighten" || arg === "-t" || arg === "--no-tighten") {
160
+ continue;
161
+ }
162
+ if (arg === "--no-type-aware" || arg === "--no-type-check") {
163
+ continue;
164
+ }
142
165
  if (arg === "--help" || arg === "-h") {
143
166
  continue;
144
167
  }
@@ -164,6 +187,7 @@ The suppression file format uses counts per rule per file:
164
187
  "results-path": process.env.OXLINT_HARNESS_RESULTS_PATH ||
165
188
  "artifacts/oxlint-results.json",
166
189
  "save-results": true,
190
+ tighten: true,
167
191
  };
168
192
  // Manually parse known flags and collect unknown ones
169
193
  for (let i = 0; i < rawArgs.length; i++) {
@@ -195,6 +219,12 @@ The suppression file format uses counts per rule per file:
195
219
  else if (arg === "--no-save-results") {
196
220
  parsedFlags["save-results"] = false;
197
221
  }
222
+ else if (arg === "--tighten" || arg === "-t") {
223
+ parsedFlags.tighten = true;
224
+ }
225
+ else if (arg === "--no-tighten") {
226
+ parsedFlags.tighten = false;
227
+ }
198
228
  else if (!knownFlagNames.has(arg) &&
199
229
  arg !== "--help" &&
200
230
  arg !== "-h") {
@@ -209,6 +239,17 @@ The suppression file format uses counts per rule per file:
209
239
  throw error;
210
240
  }
211
241
  }
242
+ // Default --type-aware and --type-check unless opted out
243
+ const noTypeAware = rawArgs.includes("--no-type-aware") ||
244
+ process.env.OXLINT_HARNESS_NO_TYPE_AWARE?.toLowerCase() === "true";
245
+ const noTypeCheck = rawArgs.includes("--no-type-check") ||
246
+ process.env.OXLINT_HARNESS_NO_TYPE_CHECK?.toLowerCase() === "true";
247
+ if (!noTypeAware && !oxlintArgs.includes("--type-aware")) {
248
+ oxlintArgs.unshift("--type-aware");
249
+ }
250
+ if (!noTypeCheck && !oxlintArgs.includes("--type-check")) {
251
+ oxlintArgs.unshift("--type-check");
252
+ }
212
253
  // Check for OXLINT_HARNESS_UPDATE_BULK_SUPPRESSION environment variable
213
254
  if (process.env.OXLINT_HARNESS_UPDATE_BULK_SUPPRESSION?.toLowerCase() ===
214
255
  "true") {
@@ -241,9 +282,12 @@ The suppression file format uses counts per rule per file:
241
282
  // Normal mode: check suppressions
242
283
  const suppressions = suppressionManager.loadSuppressions();
243
284
  const excessErrors = suppressionManager.findExcessErrors(diagnostics, suppressions);
244
- // Check for OXLINT_HARNESS_TIGHTEN_BULK_SUPPRESSION environment variable
245
- const shouldTighten = process.env.OXLINT_HARNESS_TIGHTEN_BULK_SUPPRESSION?.toLowerCase() ===
246
- "true";
285
+ // Tighten is on by default; env var can override the flag
286
+ let shouldTighten = flags.tighten;
287
+ if (process.env.OXLINT_HARNESS_TIGHTEN_BULK_SUPPRESSION?.toLowerCase() ===
288
+ "true") {
289
+ shouldTighten = true;
290
+ }
247
291
  if (shouldTighten) {
248
292
  // Tighten suppressions by removing/reducing cleaned-up violations
249
293
  const tightenedSuppressions = suppressionManager.tightenSuppressions(suppressions, diagnostics);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-harness",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "A harness for oxlint with bulk suppressions support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",