oxlint 1.18.0 → 1.19.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.
@@ -47,6 +47,18 @@
47
47
  "type": "string"
48
48
  }
49
49
  },
50
+ "jsPlugins": {
51
+ "description": "JS plugins.",
52
+ "default": null,
53
+ "type": [
54
+ "array",
55
+ "null"
56
+ ],
57
+ "items": {
58
+ "type": "string"
59
+ },
60
+ "uniqueItems": true
61
+ },
50
62
  "overrides": {
51
63
  "description": "Add, remove, or otherwise reconfigure rules for specific files or groups of files.",
52
64
  "allOf": [
@@ -427,6 +439,17 @@
427
439
  }
428
440
  ]
429
441
  },
442
+ "jsPlugins": {
443
+ "description": "JS plugins for this override.",
444
+ "type": [
445
+ "array",
446
+ "null"
447
+ ],
448
+ "items": {
449
+ "type": "string"
450
+ },
451
+ "uniqueItems": true
452
+ },
430
453
  "plugins": {
431
454
  "description": "Optionally change what plugins are enabled for this override. When\nomitted, the base config's plugins are used.",
432
455
  "default": null,
package/dist/cli.js CHANGED
@@ -36,7 +36,7 @@ function requireNative() {
36
36
  }
37
37
  try {
38
38
  let binding = require("@oxlint/android-arm64"), bindingPackageVersion = require("@oxlint/android-arm64/package.json").version;
39
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
39
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
40
40
  return binding;
41
41
  } catch (e) {
42
42
  loadErrors.push(e);
@@ -49,7 +49,7 @@ function requireNative() {
49
49
  }
50
50
  try {
51
51
  let binding = require("@oxlint/android-arm-eabi"), bindingPackageVersion = require("@oxlint/android-arm-eabi/package.json").version;
52
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
52
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
53
53
  return binding;
54
54
  } catch (e) {
55
55
  loadErrors.push(e);
@@ -63,7 +63,7 @@ function requireNative() {
63
63
  }
64
64
  try {
65
65
  let binding = require("@oxlint/win32-x64"), bindingPackageVersion = require("@oxlint/win32-x64/package.json").version;
66
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
66
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
67
67
  return binding;
68
68
  } catch (e) {
69
69
  loadErrors.push(e);
@@ -76,7 +76,7 @@ function requireNative() {
76
76
  }
77
77
  try {
78
78
  let binding = require("@oxlint/win32-ia32"), bindingPackageVersion = require("@oxlint/win32-ia32/package.json").version;
79
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
79
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
80
80
  return binding;
81
81
  } catch (e) {
82
82
  loadErrors.push(e);
@@ -89,7 +89,7 @@ function requireNative() {
89
89
  }
90
90
  try {
91
91
  let binding = require("@oxlint/win32-arm64"), bindingPackageVersion = require("@oxlint/win32-arm64/package.json").version;
92
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
92
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
93
93
  return binding;
94
94
  } catch (e) {
95
95
  loadErrors.push(e);
@@ -103,7 +103,7 @@ function requireNative() {
103
103
  }
104
104
  try {
105
105
  let binding = require("@oxlint/darwin-universal"), bindingPackageVersion = require("@oxlint/darwin-universal/package.json").version;
106
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
106
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
107
107
  return binding;
108
108
  } catch (e) {
109
109
  loadErrors.push(e);
@@ -116,7 +116,7 @@ function requireNative() {
116
116
  }
117
117
  try {
118
118
  let binding = require("@oxlint/darwin-x64"), bindingPackageVersion = require("@oxlint/darwin-x64/package.json").version;
119
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
119
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
120
120
  return binding;
121
121
  } catch (e) {
122
122
  loadErrors.push(e);
@@ -129,7 +129,7 @@ function requireNative() {
129
129
  }
130
130
  try {
131
131
  let binding = require("@oxlint/darwin-arm64"), bindingPackageVersion = require("@oxlint/darwin-arm64/package.json").version;
132
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
132
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
133
133
  return binding;
134
134
  } catch (e) {
135
135
  loadErrors.push(e);
@@ -143,7 +143,7 @@ function requireNative() {
143
143
  }
144
144
  try {
145
145
  let binding = require("@oxlint/freebsd-x64"), bindingPackageVersion = require("@oxlint/freebsd-x64/package.json").version;
146
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
146
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
147
147
  return binding;
148
148
  } catch (e) {
149
149
  loadErrors.push(e);
@@ -156,7 +156,7 @@ function requireNative() {
156
156
  }
157
157
  try {
158
158
  let binding = require("@oxlint/freebsd-arm64"), bindingPackageVersion = require("@oxlint/freebsd-arm64/package.json").version;
159
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
159
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
160
160
  return binding;
161
161
  } catch (e) {
162
162
  loadErrors.push(e);
@@ -170,7 +170,7 @@ function requireNative() {
170
170
  }
171
171
  try {
172
172
  let binding = require("@oxlint/linux-x64-musl"), bindingPackageVersion = require("@oxlint/linux-x64-musl/package.json").version;
173
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
173
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
174
174
  return binding;
175
175
  } catch (e) {
176
176
  loadErrors.push(e);
@@ -183,7 +183,7 @@ function requireNative() {
183
183
  }
184
184
  try {
185
185
  let binding = require("@oxlint/linux-x64-gnu"), bindingPackageVersion = require("@oxlint/linux-x64-gnu/package.json").version;
186
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
186
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
187
187
  return binding;
188
188
  } catch (e) {
189
189
  loadErrors.push(e);
@@ -197,7 +197,7 @@ function requireNative() {
197
197
  }
198
198
  try {
199
199
  let binding = require("@oxlint/linux-arm64-musl"), bindingPackageVersion = require("@oxlint/linux-arm64-musl/package.json").version;
200
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
200
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
201
201
  return binding;
202
202
  } catch (e) {
203
203
  loadErrors.push(e);
@@ -210,7 +210,7 @@ function requireNative() {
210
210
  }
211
211
  try {
212
212
  let binding = require("@oxlint/linux-arm64-gnu"), bindingPackageVersion = require("@oxlint/linux-arm64-gnu/package.json").version;
213
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
213
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
214
214
  return binding;
215
215
  } catch (e) {
216
216
  loadErrors.push(e);
@@ -224,7 +224,7 @@ function requireNative() {
224
224
  }
225
225
  try {
226
226
  let binding = require("@oxlint/linux-arm-musleabihf"), bindingPackageVersion = require("@oxlint/linux-arm-musleabihf/package.json").version;
227
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
227
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
228
228
  return binding;
229
229
  } catch (e) {
230
230
  loadErrors.push(e);
@@ -237,7 +237,7 @@ function requireNative() {
237
237
  }
238
238
  try {
239
239
  let binding = require("@oxlint/linux-arm-gnueabihf"), bindingPackageVersion = require("@oxlint/linux-arm-gnueabihf/package.json").version;
240
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
240
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
241
241
  return binding;
242
242
  } catch (e) {
243
243
  loadErrors.push(e);
@@ -251,7 +251,7 @@ function requireNative() {
251
251
  }
252
252
  try {
253
253
  let binding = require("@oxlint/linux-loong64-musl"), bindingPackageVersion = require("@oxlint/linux-loong64-musl/package.json").version;
254
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
254
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
255
255
  return binding;
256
256
  } catch (e) {
257
257
  loadErrors.push(e);
@@ -264,7 +264,7 @@ function requireNative() {
264
264
  }
265
265
  try {
266
266
  let binding = require("@oxlint/linux-loong64-gnu"), bindingPackageVersion = require("@oxlint/linux-loong64-gnu/package.json").version;
267
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
267
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
268
268
  return binding;
269
269
  } catch (e) {
270
270
  loadErrors.push(e);
@@ -278,7 +278,7 @@ function requireNative() {
278
278
  }
279
279
  try {
280
280
  let binding = require("@oxlint/linux-riscv64-musl"), bindingPackageVersion = require("@oxlint/linux-riscv64-musl/package.json").version;
281
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
281
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
282
282
  return binding;
283
283
  } catch (e) {
284
284
  loadErrors.push(e);
@@ -291,7 +291,7 @@ function requireNative() {
291
291
  }
292
292
  try {
293
293
  let binding = require("@oxlint/linux-riscv64-gnu"), bindingPackageVersion = require("@oxlint/linux-riscv64-gnu/package.json").version;
294
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
294
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
295
295
  return binding;
296
296
  } catch (e) {
297
297
  loadErrors.push(e);
@@ -305,7 +305,7 @@ function requireNative() {
305
305
  }
306
306
  try {
307
307
  let binding = require("@oxlint/linux-ppc64-gnu"), bindingPackageVersion = require("@oxlint/linux-ppc64-gnu/package.json").version;
308
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
308
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
309
309
  return binding;
310
310
  } catch (e) {
311
311
  loadErrors.push(e);
@@ -318,7 +318,7 @@ function requireNative() {
318
318
  }
319
319
  try {
320
320
  let binding = require("@oxlint/linux-s390x-gnu"), bindingPackageVersion = require("@oxlint/linux-s390x-gnu/package.json").version;
321
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
321
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
322
322
  return binding;
323
323
  } catch (e) {
324
324
  loadErrors.push(e);
@@ -332,7 +332,7 @@ function requireNative() {
332
332
  }
333
333
  try {
334
334
  let binding = require("@oxlint/openharmony-arm64"), bindingPackageVersion = require("@oxlint/openharmony-arm64/package.json").version;
335
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
335
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
336
336
  return binding;
337
337
  } catch (e) {
338
338
  loadErrors.push(e);
@@ -345,7 +345,7 @@ function requireNative() {
345
345
  }
346
346
  try {
347
347
  let binding = require("@oxlint/openharmony-x64"), bindingPackageVersion = require("@oxlint/openharmony-x64/package.json").version;
348
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
348
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
349
349
  return binding;
350
350
  } catch (e) {
351
351
  loadErrors.push(e);
@@ -358,7 +358,7 @@ function requireNative() {
358
358
  }
359
359
  try {
360
360
  let binding = require("@oxlint/openharmony-arm"), bindingPackageVersion = require("@oxlint/openharmony-arm/package.json").version;
361
- if (bindingPackageVersion !== "1.18.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
361
+ if (bindingPackageVersion !== "1.19.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.19.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
362
362
  return binding;
363
363
  } catch (e) {
364
364
  loadErrors.push(e);
@@ -389,12 +389,13 @@ let loadPlugin = null, lintFile = null;
389
389
  function loadPluginWrapper(path) {
390
390
  if (loadPlugin === null) {
391
391
  let require$1 = createRequire(import.meta.url);
392
- ({loadPlugin, lintFile} = require$1("./plugins/index.js"));
392
+ ({loadPlugin, lintFile} = require$1("./plugins.js"));
393
393
  }
394
394
  return loadPlugin(path);
395
395
  }
396
396
  function lintFileWrapper(filePath, bufferId, buffer, ruleIds) {
397
397
  return lintFile(filePath, bufferId, buffer, ruleIds);
398
398
  }
399
- await lint(loadPluginWrapper, lintFileWrapper) || (process.exitCode = 1);
399
+ const args = process.argv.slice(2);
400
+ await lint(args, loadPluginWrapper, lintFileWrapper) || (process.exitCode = 1);
400
401
  export {};
@@ -0,0 +1,120 @@
1
+ import { VisitorObject as Visitor } from "../dist/generated/visit/visitor.js";
2
+
3
+ //#region src-js/plugins/fix.d.ts
4
+ type FixFn = (fixer: Fixer) => Fix | Array<Fix | null | undefined> | IterableIterator<Fix | null | undefined> | null | undefined;
5
+ type Fix = {
6
+ range: Range;
7
+ text: string;
8
+ };
9
+ type Range = [number, number];
10
+ interface NodeOrToken {
11
+ start: number;
12
+ end: number;
13
+ }
14
+ declare const FIXER: Readonly<{
15
+ insertTextBefore(nodeOrToken: NodeOrToken, text: string): Fix;
16
+ insertTextBeforeRange(range: Range, text: string): Fix;
17
+ insertTextAfter(nodeOrToken: NodeOrToken, text: string): Fix;
18
+ insertTextAfterRange(range: Range, text: string): Fix;
19
+ remove(nodeOrToken: NodeOrToken): Fix;
20
+ removeRange(range: Range): Fix;
21
+ replaceText(nodeOrToken: NodeOrToken, text: string): Fix;
22
+ replaceTextRange(range: Range, text: string): Fix;
23
+ }>;
24
+ type Fixer = typeof FIXER;
25
+ //#endregion
26
+ //#region src-js/plugins/context.d.ts
27
+ interface Diagnostic {
28
+ message: string;
29
+ node: {
30
+ start: number;
31
+ end: number;
32
+ };
33
+ fix?: FixFn;
34
+ }
35
+ /**
36
+ * Context class.
37
+ *
38
+ * Each rule has its own `Context` object. It is passed to that rule's `create` function.
39
+ */
40
+ declare class Context {
41
+ #private;
42
+ /**
43
+ * @class
44
+ * @param fullRuleName - Rule name, in form `<plugin>/<rule>`
45
+ */
46
+ constructor(fullRuleName: string, isFixable: boolean);
47
+ get id(): string;
48
+ get filename(): string;
49
+ get physicalFilename(): string;
50
+ get options(): unknown[];
51
+ /**
52
+ * Report error.
53
+ * @param diagnostic - Diagnostic object
54
+ */
55
+ report(diagnostic: Diagnostic): void;
56
+ }
57
+ //#endregion
58
+ //#region src-js/plugins/types.d.ts
59
+ type BeforeHook = () => boolean | void;
60
+ type AfterHook = () => void;
61
+ interface VisitorWithHooks extends Visitor {
62
+ before?: BeforeHook;
63
+ after?: AfterHook;
64
+ }
65
+ interface RuleMeta {
66
+ fixable?: 'code' | 'whitespace' | null | undefined;
67
+ [key: string]: unknown;
68
+ }
69
+ //#endregion
70
+ //#region src-js/plugins/load.d.ts
71
+ interface Plugin {
72
+ meta: {
73
+ name: string;
74
+ };
75
+ rules: {
76
+ [key: string]: Rule;
77
+ };
78
+ }
79
+ type Rule = CreateRule | CreateOnceRule;
80
+ interface CreateRule {
81
+ meta?: RuleMeta;
82
+ create: (context: Context) => Visitor;
83
+ }
84
+ interface CreateOnceRule {
85
+ meta?: RuleMeta;
86
+ create?: (context: Context) => Visitor;
87
+ createOnce: (context: Context) => VisitorWithHooks;
88
+ }
89
+ //#endregion
90
+ //#region src-js/index.d.ts
91
+ /**
92
+ * Define a plugin.
93
+ *
94
+ * If any of the plugin's rules use the Oxlint alternative `createOnce` API,
95
+ * add ESLint-compatible `create` methods to those rules, which delegate to `createOnce`.
96
+ * This makes the plugin compatible with ESLint.
97
+ *
98
+ * The `plugin` object passed in is mutated in-place.
99
+ *
100
+ * @param plugin - Plugin to define
101
+ * @returns Plugin with all rules having `create` method
102
+ * @throws {Error} If `plugin` is not an object, or `plugin.rules` is not an object
103
+ */
104
+ declare function definePlugin(plugin: Plugin): Plugin;
105
+ /**
106
+ * Define a rule.
107
+ *
108
+ * If `rule` uses the Oxlint alternative `createOnce` API, add an ESLint-compatible
109
+ * `create` method to the rule, which delegates to `createOnce`.
110
+ * This makes the rule compatible with ESLint.
111
+ *
112
+ * The `rule` object passed in is mutated in-place.
113
+ *
114
+ * @param rule - Rule to define
115
+ * @returns Rule with `create` method
116
+ * @throws {Error} If `rule` is not an object
117
+ */
118
+ declare function defineRule(rule: Rule): Rule;
119
+ //#endregion
120
+ export { type AfterHook, type BeforeHook, type Context, type CreateOnceRule, type CreateRule, type Diagnostic, type Fix, type FixFn, type Fixer, type NodeOrToken, type Plugin, type Range, type Rule, type RuleMeta, type Visitor, type VisitorWithHooks, definePlugin, defineRule };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const { defineProperty, getPrototypeOf, hasOwn, setPrototypeOf, create: ObjectCreate } = Object, dummyOptions = [], dummyReport = () => {};
1
+ const { defineProperty, getPrototypeOf, hasOwn, setPrototypeOf, create: ObjectCreate } = Object;
2
2
  function definePlugin(plugin) {
3
3
  if (typeof plugin != "object" || !plugin) throw Error("Plugin must be an object");
4
4
  let { rules } = plugin;
@@ -23,12 +23,12 @@ function createContextAndVisitor(rule) {
23
23
  configurable: !0
24
24
  },
25
25
  options: {
26
- value: dummyOptions,
26
+ value: null,
27
27
  enumerable: !0,
28
28
  configurable: !0
29
29
  },
30
30
  report: {
31
- value: dummyReport,
31
+ value: null,
32
32
  enumerable: !0,
33
33
  configurable: !0
34
34
  }
@@ -1,16 +1,115 @@
1
- import { LEAF_NODE_TYPES_COUNT, NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP } from "../../dist/generated/visit/types.js";
2
- import { deserializeProgramOnly } from "../../dist/generated/deserialize/ts.js";
3
- import { walkProgram } from "../../dist/generated/visit/walk.js";
1
+ import { LEAF_NODE_TYPES_COUNT, NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP } from "../dist/generated/visit/types.js";
2
+ import { deserializeProgramOnly } from "../dist/generated/deserialize/ts.js";
3
+ import { walkProgram } from "../dist/generated/visit/walk.js";
4
+ function getErrorMessage(err) {
5
+ try {
6
+ if (err instanceof Error) {
7
+ let { stack } = err;
8
+ if (typeof stack == "string" && stack !== "") return stack;
9
+ }
10
+ let { message } = err;
11
+ if (typeof message == "string" && message !== "") return message;
12
+ } catch {}
13
+ return "Unknown error";
14
+ }
15
+ const { prototype: ArrayPrototype, from: ArrayFrom } = Array, { getPrototypeOf, hasOwn, prototype: ObjectPrototype } = Object, { ownKeys } = Reflect, IteratorSymbol = Symbol.iterator, FIXER = Object.freeze({
16
+ insertTextBefore(nodeOrToken, text) {
17
+ let { start } = nodeOrToken;
18
+ return {
19
+ range: [start, start],
20
+ text
21
+ };
22
+ },
23
+ insertTextBeforeRange(range, text) {
24
+ let start = range[0];
25
+ return {
26
+ range: [start, start],
27
+ text
28
+ };
29
+ },
30
+ insertTextAfter(nodeOrToken, text) {
31
+ let { end } = nodeOrToken;
32
+ return {
33
+ range: [end, end],
34
+ text
35
+ };
36
+ },
37
+ insertTextAfterRange(range, text) {
38
+ let end = range[1];
39
+ return {
40
+ range: [end, end],
41
+ text
42
+ };
43
+ },
44
+ remove(nodeOrToken) {
45
+ return {
46
+ range: [nodeOrToken.start, nodeOrToken.end],
47
+ text: ""
48
+ };
49
+ },
50
+ removeRange(range) {
51
+ return {
52
+ range,
53
+ text: ""
54
+ };
55
+ },
56
+ replaceText(nodeOrToken, text) {
57
+ return {
58
+ range: [nodeOrToken.start, nodeOrToken.end],
59
+ text
60
+ };
61
+ },
62
+ replaceTextRange(range, text) {
63
+ return {
64
+ range,
65
+ text
66
+ };
67
+ }
68
+ });
69
+ function getFixes(diagnostic, internal) {
70
+ let { fix } = diagnostic;
71
+ if (typeof fix != "function") return null;
72
+ let fixes = fix.call(diagnostic, FIXER);
73
+ if (!fixes) return null;
74
+ if (IteratorSymbol in fixes) {
75
+ let isCloned = !1;
76
+ (getPrototypeOf(fixes) !== ArrayPrototype || hasOwn(fixes, "toJSON")) && (fixes = ArrayFrom(fixes), isCloned = !0);
77
+ let fixesLen = fixes.length;
78
+ if (fixesLen === 0) return null;
79
+ for (let i = 0; i < fixesLen; i++) {
80
+ let fix$1 = fixes[i];
81
+ if (!fix$1) {
82
+ if (fixes = fixes.filter(Boolean), fixes.length === 0) return null;
83
+ isCloned = !0, i--;
84
+ continue;
85
+ }
86
+ let conformedFix = validateAndConformFix(fix$1);
87
+ conformedFix !== fix$1 && (isCloned === !1 && (fixes = fixes.slice(), isCloned = !0), fixes[i] = conformedFix);
88
+ }
89
+ } else fixes = [validateAndConformFix(fixes)];
90
+ if (internal.isFixable === !1) throw Error("Fixable rules must set the `meta.fixable` property to \"code\" or \"whitespace\".");
91
+ return fixes;
92
+ }
93
+ function validateAndConformFix(fix) {
94
+ let { range, text } = fix;
95
+ if (!range || typeof range[0] != "number" || typeof range[1] != "number") throw Error(`Fix has invalid range: ${JSON.stringify(fix, null, 2)}`);
96
+ let fixPrototype = getPrototypeOf(fix);
97
+ return (fixPrototype === ObjectPrototype || fixPrototype === null) && ownKeys(fix).length === 2 && getPrototypeOf(range) === ArrayPrototype && !hasOwn(range, "toJSON") && range.length === 2 && typeof text == "string" ? fix : {
98
+ range: [range[0], range[1]],
99
+ text: String(text)
100
+ };
101
+ }
4
102
  const diagnostics = [];
5
103
  let setupContextForFile, getInternal;
6
104
  var Context = class {
7
105
  #internal;
8
- constructor(fullRuleName) {
106
+ constructor(fullRuleName, isFixable) {
9
107
  this.#internal = {
10
108
  id: fullRuleName,
11
109
  filePath: "",
12
110
  ruleIndex: -1,
13
- options: []
111
+ options: [],
112
+ isFixable
14
113
  };
15
114
  }
16
115
  get id() {
@@ -26,12 +125,13 @@ var Context = class {
26
125
  return getInternal(this, "access `context.options`").options;
27
126
  }
28
127
  report(diagnostic) {
29
- let { ruleIndex } = getInternal(this, "report errors"), { node } = diagnostic;
128
+ let internal = getInternal(this, "report errors"), { node } = diagnostic;
30
129
  diagnostics.push({
31
130
  message: diagnostic.message,
32
131
  start: node.start,
33
132
  end: node.end,
34
- ruleIndex
133
+ ruleIndex: internal.ruleIndex,
134
+ fixes: getFixes(diagnostic, internal)
35
135
  });
36
136
  }
37
137
  static {
@@ -45,40 +145,41 @@ var Context = class {
45
145
  };
46
146
  }
47
147
  };
48
- function getErrorMessage(err) {
49
- try {
50
- if (err instanceof Error) {
51
- let { stack } = err;
52
- if (typeof stack == "string" && stack !== "") return stack;
53
- }
54
- let { message } = err;
55
- if (typeof message == "string" && message !== "") return message;
56
- } catch {}
57
- return "Unknown error";
58
- }
59
148
  const ObjectKeys$1 = Object.keys, registeredPluginPaths = /* @__PURE__ */ new Set(), registeredRules = [];
60
149
  async function loadPlugin(path) {
61
150
  try {
62
- return await loadPluginImpl(path);
151
+ let res = await loadPluginImpl(path);
152
+ return JSON.stringify({ Success: res });
63
153
  } catch (err) {
64
154
  return JSON.stringify({ Failure: getErrorMessage(err) });
65
155
  }
66
156
  }
67
157
  async function loadPluginImpl(path) {
68
- if (registeredPluginPaths.has(path)) return JSON.stringify({ Failure: "This plugin has already been registered" });
158
+ if (registeredPluginPaths.has(path)) throw Error("This plugin has already been registered. This is a bug in Oxlint. Please report it.");
69
159
  let { default: plugin } = await import(path);
70
160
  registeredPluginPaths.add(path);
71
161
  let pluginName = plugin.meta.name, offset = registeredRules.length, { rules } = plugin, ruleNames = ObjectKeys$1(rules), ruleNamesLen = ruleNames.length;
72
162
  for (let i = 0; i < ruleNamesLen; i++) {
73
- let ruleName = ruleNames[i], rule = rules[ruleName], context = new Context(`${pluginName}/${ruleName}`), ruleAndContext;
163
+ let ruleName = ruleNames[i], rule = rules[ruleName], isFixable = !1, ruleMeta = rule.meta;
164
+ if (ruleMeta != null) {
165
+ if (typeof ruleMeta != "object") throw TypeError("Invalid `meta`");
166
+ let { fixable } = ruleMeta;
167
+ if (fixable != null) {
168
+ if (fixable !== "code" && fixable !== "whitespace") throw TypeError("Invalid `meta.fixable`");
169
+ isFixable = !0;
170
+ }
171
+ }
172
+ let context = new Context(`${pluginName}/${ruleName}`, isFixable), ruleAndContext;
74
173
  if ("createOnce" in rule) {
75
- let { before: beforeHook, after: afterHook,...visitor } = rule.createOnce(context);
76
- ruleAndContext = {
174
+ let visitorWithHooks = rule.createOnce(context);
175
+ if (typeof visitorWithHooks != "object" || !visitorWithHooks) throw TypeError("`createOnce` must return an object");
176
+ let { before: beforeHook, after: afterHook,...visitor } = visitorWithHooks;
177
+ beforeHook = conformHookFn(beforeHook, "before"), afterHook = conformHookFn(afterHook, "after"), ruleAndContext = {
77
178
  rule,
78
179
  context,
79
180
  visitor,
80
- beforeHook: beforeHook || null,
81
- afterHook: afterHook || null
181
+ beforeHook,
182
+ afterHook
82
183
  };
83
184
  } else ruleAndContext = {
84
185
  rule,
@@ -89,11 +190,16 @@ async function loadPluginImpl(path) {
89
190
  };
90
191
  registeredRules.push(ruleAndContext);
91
192
  }
92
- return JSON.stringify({ Success: {
193
+ return {
93
194
  name: pluginName,
94
195
  offset,
95
196
  ruleNames
96
- } });
197
+ };
198
+ }
199
+ function conformHookFn(hookFn, hookName) {
200
+ if (hookFn == null) return null;
201
+ if (typeof hookFn != "function") throw TypeError(`\`${hookName}\` hook must be a function if provided`);
202
+ return hookFn;
97
203
  }
98
204
  const ObjectKeys = Object.keys, { isArray } = Array, compiledVisitor = [];
99
205
  for (let i = NODE_TYPES_COUNT; i !== 0; i--) compiledVisitor.push(null);
@@ -204,6 +310,15 @@ const mergers = [
204
310
  }
205
311
  ], buffers = [], textDecoder = new TextDecoder("utf-8", { ignoreBOM: !0 }), afterHooks = [];
206
312
  function lintFile(filePath, bufferId, buffer, ruleIds) {
313
+ try {
314
+ return lintFileImpl(filePath, bufferId, buffer, ruleIds), JSON.stringify({ Success: diagnostics });
315
+ } catch (err) {
316
+ return JSON.stringify({ Failure: getErrorMessage(err) });
317
+ } finally {
318
+ diagnostics.length = 0;
319
+ }
320
+ }
321
+ function lintFileImpl(filePath, bufferId, buffer, ruleIds) {
207
322
  if (buffer === null) buffer = buffers[bufferId];
208
323
  else {
209
324
  let { buffer: arrayBuffer, byteOffset } = buffer;
@@ -234,7 +349,5 @@ function lintFile(filePath, bufferId, buffer, ruleIds) {
234
349
  for (let afterHook of afterHooks) afterHook();
235
350
  afterHooks.length = 0;
236
351
  }
237
- let ret = JSON.stringify(diagnostics);
238
- return diagnostics.length = 0, ret;
239
352
  }
240
353
  export { lintFile, loadPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "type": "module",
5
5
  "description": "Linter for the JavaScript Oxidation Compiler",
6
6
  "keywords": [],
@@ -18,6 +18,7 @@
18
18
  "oxlint": "bin/oxlint",
19
19
  "oxc_language_server": "bin/oxc_language_server"
20
20
  },
21
+ "types": "dist/index.d.ts",
21
22
  "funding": {
22
23
  "url": "https://github.com/sponsors/Boshen"
23
24
  },
@@ -32,14 +33,14 @@
32
33
  "README.md"
33
34
  ],
34
35
  "optionalDependencies": {
35
- "@oxlint/win32-x64": "1.18.0",
36
- "@oxlint/win32-arm64": "1.18.0",
37
- "@oxlint/linux-x64-gnu": "1.18.0",
38
- "@oxlint/linux-arm64-gnu": "1.18.0",
39
- "@oxlint/linux-x64-musl": "1.18.0",
40
- "@oxlint/linux-arm64-musl": "1.18.0",
41
- "@oxlint/darwin-x64": "1.18.0",
42
- "@oxlint/darwin-arm64": "1.18.0"
36
+ "@oxlint/win32-x64": "1.19.0",
37
+ "@oxlint/win32-arm64": "1.19.0",
38
+ "@oxlint/linux-x64-gnu": "1.19.0",
39
+ "@oxlint/linux-arm64-gnu": "1.19.0",
40
+ "@oxlint/linux-x64-musl": "1.19.0",
41
+ "@oxlint/linux-arm64-musl": "1.19.0",
42
+ "@oxlint/darwin-x64": "1.19.0",
43
+ "@oxlint/darwin-arm64": "1.19.0"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "oxlint-tsgolint": ">=0.2.0"