oxlint-harness 1.0.3 → 1.0.5

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.
Files changed (2) hide show
  1. package/dist/command.js +50 -16
  2. package/package.json +9 -2
package/dist/command.js CHANGED
@@ -63,7 +63,7 @@ The suppression file format uses counts per rule per file:
63
63
  static strict = false; // Allow additional args to be passed to oxlint
64
64
  async run() {
65
65
  // Check for help flag first - check both this.argv and process.argv
66
- const rawArgs = this.argv.slice(1);
66
+ const rawArgs = this.argv;
67
67
  const processArgs = process.argv.slice(2); // Skip 'node' and script path
68
68
  const hasHelp = rawArgs.includes("--help") ||
69
69
  rawArgs.includes("-h") ||
@@ -102,10 +102,55 @@ The suppression file format uses counts per rule per file:
102
102
  // Parse with error handling for unknown flags
103
103
  let flags;
104
104
  let oxlintArgs = [];
105
+ const knownFlagNames = new Set([
106
+ "--suppressions",
107
+ "-s",
108
+ "--update",
109
+ "-u",
110
+ "--fail-on-excess",
111
+ "--no-fail-on-excess",
112
+ "--show-code",
113
+ "--results-path",
114
+ "--save-results",
115
+ "--no-save-results",
116
+ ]);
117
+ const collectOxlintArgs = (args) => {
118
+ const passthrough = [];
119
+ for (let i = 0; i < args.length; i++) {
120
+ const arg = args[i];
121
+ if (arg === "--suppressions" || arg === "-s") {
122
+ i++; // consume value
123
+ continue;
124
+ }
125
+ if (arg === "--update" || arg === "-u") {
126
+ continue;
127
+ }
128
+ if (arg === "--fail-on-excess" || arg === "--no-fail-on-excess") {
129
+ continue;
130
+ }
131
+ if (arg === "--show-code") {
132
+ i++; // consume value
133
+ continue;
134
+ }
135
+ if (arg === "--results-path") {
136
+ i++; // consume value
137
+ continue;
138
+ }
139
+ if (arg === "--save-results" || arg === "--no-save-results") {
140
+ continue;
141
+ }
142
+ if (arg === "--help" || arg === "-h") {
143
+ continue;
144
+ }
145
+ // Unknown flag or positional arg - pass to oxlint
146
+ passthrough.push(arg);
147
+ }
148
+ return passthrough;
149
+ };
105
150
  try {
106
151
  const parsed = await this.parse(OxlintHarness);
107
152
  flags = parsed.flags;
108
- oxlintArgs = parsed.argv;
153
+ oxlintArgs = collectOxlintArgs(rawArgs);
109
154
  }
110
155
  catch (error) {
111
156
  // If error is due to unknown flags (NonExistentFlagsError), manually parse
@@ -120,18 +165,6 @@ The suppression file format uses counts per rule per file:
120
165
  "artifacts/oxlint-results.json",
121
166
  "save-results": true,
122
167
  };
123
- const knownFlagNames = new Set([
124
- "--suppressions",
125
- "-s",
126
- "--update",
127
- "-u",
128
- "--fail-on-excess",
129
- "--no-fail-on-excess",
130
- "--show-code",
131
- "--results-path",
132
- "--save-results",
133
- "--no-save-results",
134
- ]);
135
168
  // Manually parse known flags and collect unknown ones
136
169
  for (let i = 0; i < rawArgs.length; i++) {
137
170
  const arg = rawArgs[i];
@@ -225,11 +258,12 @@ The suppression file format uses counts per rule per file:
225
258
  const reporter = new ErrorReporter();
226
259
  reporter.reportExcessErrors(excessErrors, flags["show-code"]);
227
260
  if (flags["fail-on-excess"]) {
228
- this.exit(1);
261
+ process.exit(1);
229
262
  }
230
263
  }
231
264
  catch (error) {
232
- this.error(error instanceof Error ? error.message : String(error));
265
+ this.logToStderr(error instanceof Error ? error.message : String(error));
266
+ process.exit(2);
233
267
  }
234
268
  }
235
269
  async saveResults(path, diagnostics) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-harness",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A harness for oxlint with bulk suppressions support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,14 @@
21
21
  "lint": "oxlint src/",
22
22
  "typecheck": "tsgo"
23
23
  },
24
- "keywords": ["oxlint", "linting", "suppressions", "eslint", "bulk-suppressions", "cli"],
24
+ "keywords": [
25
+ "oxlint",
26
+ "linting",
27
+ "suppressions",
28
+ "eslint",
29
+ "bulk-suppressions",
30
+ "cli"
31
+ ],
25
32
  "author": "Generated with Claude Code",
26
33
  "license": "MIT",
27
34
  "repository": {