oxlint 1.59.0 → 1.60.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/configuration_schema.json +2 -2
- package/dist/bindings.js +26 -26
- package/dist/cli.js +2 -2
- package/dist/js_config.js +52 -36
- package/dist/lint.js +893 -893
- package/dist/plugins-dev.js +2 -2
- package/package.json +20 -20
|
@@ -472,12 +472,12 @@
|
|
|
472
472
|
"markdownDescription": "Configure an entire category of rules all at once.\n\nRules enabled or disabled this way will be overwritten by individual rules in the `rules` field.\n\nExample\n```json\n{\n \"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n \"categories\": {\n \"correctness\": \"warn\"\n },\n \"rules\": {\n \"eslint/no-unused-vars\": \"error\"\n }\n}\n```"
|
|
473
473
|
},
|
|
474
474
|
"OxlintEnv": {
|
|
475
|
-
"description": "Predefine global variables.\n\nEnvironments specify what global variables are predefined.\
|
|
475
|
+
"description": "Predefine global variables.\n\nEnvironments specify what global variables are predefined.\nAvailable environments:\n- amd - require() and define() globals.\n- applescript - AppleScript globals.\n- astro - Astro globals.\n- atomtest - Atom test globals.\n- audioworklet - AudioWorklet globals.\n- browser - browser globals.\n- builtin - Latest ECMAScript globals, equivalent to es2026.\n- commonjs - CommonJS globals and scoping.\n- embertest - Ember test globals.\n- es2015 - ECMAScript 2015 globals.\n- es2016 - ECMAScript 2016 globals.\n- es2017 - ECMAScript 2017 globals.\n- es2018 - ECMAScript 2018 globals.\n- es2019 - ECMAScript 2019 globals.\n- es2020 - ECMAScript 2020 globals.\n- es2021 - ECMAScript 2021 globals.\n- es2022 - ECMAScript 2022 globals.\n- es2023 - ECMAScript 2023 globals.\n- es2024 - ECMAScript 2024 globals.\n- es2025 - ECMAScript 2025 globals.\n- es2026 - ECMAScript 2026 globals.\n- es6 - ECMAScript 6 globals except modules.\n- greasemonkey - GreaseMonkey globals.\n- jasmine - Jasmine globals.\n- jest - Jest globals.\n- jquery - jQuery globals.\n- meteor - Meteor globals.\n- mocha - Mocha globals.\n- mongo - MongoDB globals.\n- nashorn - Java 8 Nashorn globals.\n- node - Node.js globals and scoping.\n- phantomjs - PhantomJS globals.\n- prototypejs - Prototype.js globals.\n- protractor - Protractor globals.\n- qunit - QUnit globals.\n- serviceworker - Service Worker globals.\n- shared-node-browser - Node.js and Browser common globals.\n- shelljs - ShellJS globals.\n- svelte - Svelte globals.\n- vitest - Vitest globals.\n- vue - Vue globals.\n- webextensions - WebExtensions globals.\n- worker - Web Workers globals.",
|
|
476
476
|
"type": "object",
|
|
477
477
|
"additionalProperties": {
|
|
478
478
|
"type": "boolean"
|
|
479
479
|
},
|
|
480
|
-
"markdownDescription": "Predefine global variables.\n\nEnvironments specify what global variables are predefined.\
|
|
480
|
+
"markdownDescription": "Predefine global variables.\n\nEnvironments specify what global variables are predefined.\nAvailable environments:\n- amd - require() and define() globals.\n- applescript - AppleScript globals.\n- astro - Astro globals.\n- atomtest - Atom test globals.\n- audioworklet - AudioWorklet globals.\n- browser - browser globals.\n- builtin - Latest ECMAScript globals, equivalent to es2026.\n- commonjs - CommonJS globals and scoping.\n- embertest - Ember test globals.\n- es2015 - ECMAScript 2015 globals.\n- es2016 - ECMAScript 2016 globals.\n- es2017 - ECMAScript 2017 globals.\n- es2018 - ECMAScript 2018 globals.\n- es2019 - ECMAScript 2019 globals.\n- es2020 - ECMAScript 2020 globals.\n- es2021 - ECMAScript 2021 globals.\n- es2022 - ECMAScript 2022 globals.\n- es2023 - ECMAScript 2023 globals.\n- es2024 - ECMAScript 2024 globals.\n- es2025 - ECMAScript 2025 globals.\n- es2026 - ECMAScript 2026 globals.\n- es6 - ECMAScript 6 globals except modules.\n- greasemonkey - GreaseMonkey globals.\n- jasmine - Jasmine globals.\n- jest - Jest globals.\n- jquery - jQuery globals.\n- meteor - Meteor globals.\n- mocha - Mocha globals.\n- mongo - MongoDB globals.\n- nashorn - Java 8 Nashorn globals.\n- node - Node.js globals and scoping.\n- phantomjs - PhantomJS globals.\n- prototypejs - Prototype.js globals.\n- protractor - Protractor globals.\n- qunit - QUnit globals.\n- serviceworker - Service Worker globals.\n- shared-node-browser - Node.js and Browser common globals.\n- shelljs - ShellJS globals.\n- svelte - Svelte globals.\n- vitest - Vitest globals.\n- vue - Vue globals.\n- webextensions - WebExtensions globals.\n- worker - Web Workers globals."
|
|
481
481
|
},
|
|
482
482
|
"OxlintGlobals": {
|
|
483
483
|
"description": "Add or remove global variables.\n\nFor each global variable, set the corresponding value equal to `\"writable\"`\nto allow the variable to be overwritten or `\"readonly\"` to disallow overwriting.\n\nGlobals can be disabled by setting their value to `\"off\"`. For example, in\nan environment where most Es2015 globals are available but `Promise` is unavailable,\nyou might use this config:\n\n```json\n\n{\n\"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n\"env\": {\n\"es6\": true\n},\n\"globals\": {\n\"Promise\": \"off\"\n}\n}\n\n```\n\nYou may also use `\"readable\"` or `false` to represent `\"readonly\"`, and\n`\"writeable\"` or `true` to represent `\"writable\"`.",
|
package/dist/bindings.js
CHANGED
|
@@ -38,7 +38,7 @@ function requireNative() {
|
|
|
38
38
|
}
|
|
39
39
|
try {
|
|
40
40
|
let binding = require("@oxlint/binding-android-arm64"), bindingPackageVersion = require("@oxlint/binding-android-arm64/package.json").version;
|
|
41
|
-
if (bindingPackageVersion !== "1.
|
|
41
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
42
42
|
return binding;
|
|
43
43
|
} catch (e) {
|
|
44
44
|
loadErrors.push(e);
|
|
@@ -51,7 +51,7 @@ function requireNative() {
|
|
|
51
51
|
}
|
|
52
52
|
try {
|
|
53
53
|
let binding = require("@oxlint/binding-android-arm-eabi"), bindingPackageVersion = require("@oxlint/binding-android-arm-eabi/package.json").version;
|
|
54
|
-
if (bindingPackageVersion !== "1.
|
|
54
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
55
55
|
return binding;
|
|
56
56
|
} catch (e) {
|
|
57
57
|
loadErrors.push(e);
|
|
@@ -65,7 +65,7 @@ function requireNative() {
|
|
|
65
65
|
}
|
|
66
66
|
try {
|
|
67
67
|
let binding = require("@oxlint/binding-win32-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-win32-x64-gnu/package.json").version;
|
|
68
|
-
if (bindingPackageVersion !== "1.
|
|
68
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
69
69
|
return binding;
|
|
70
70
|
} catch (e) {
|
|
71
71
|
loadErrors.push(e);
|
|
@@ -78,7 +78,7 @@ function requireNative() {
|
|
|
78
78
|
}
|
|
79
79
|
try {
|
|
80
80
|
let binding = require("@oxlint/binding-win32-x64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-x64-msvc/package.json").version;
|
|
81
|
-
if (bindingPackageVersion !== "1.
|
|
81
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
82
82
|
return binding;
|
|
83
83
|
} catch (e) {
|
|
84
84
|
loadErrors.push(e);
|
|
@@ -92,7 +92,7 @@ function requireNative() {
|
|
|
92
92
|
}
|
|
93
93
|
try {
|
|
94
94
|
let binding = require("@oxlint/binding-win32-ia32-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-ia32-msvc/package.json").version;
|
|
95
|
-
if (bindingPackageVersion !== "1.
|
|
95
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
96
96
|
return binding;
|
|
97
97
|
} catch (e) {
|
|
98
98
|
loadErrors.push(e);
|
|
@@ -105,7 +105,7 @@ function requireNative() {
|
|
|
105
105
|
}
|
|
106
106
|
try {
|
|
107
107
|
let binding = require("@oxlint/binding-win32-arm64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-arm64-msvc/package.json").version;
|
|
108
|
-
if (bindingPackageVersion !== "1.
|
|
108
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
109
109
|
return binding;
|
|
110
110
|
} catch (e) {
|
|
111
111
|
loadErrors.push(e);
|
|
@@ -119,7 +119,7 @@ function requireNative() {
|
|
|
119
119
|
}
|
|
120
120
|
try {
|
|
121
121
|
let binding = require("@oxlint/binding-darwin-universal"), bindingPackageVersion = require("@oxlint/binding-darwin-universal/package.json").version;
|
|
122
|
-
if (bindingPackageVersion !== "1.
|
|
122
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
123
123
|
return binding;
|
|
124
124
|
} catch (e) {
|
|
125
125
|
loadErrors.push(e);
|
|
@@ -132,7 +132,7 @@ function requireNative() {
|
|
|
132
132
|
}
|
|
133
133
|
try {
|
|
134
134
|
let binding = require("@oxlint/binding-darwin-x64"), bindingPackageVersion = require("@oxlint/binding-darwin-x64/package.json").version;
|
|
135
|
-
if (bindingPackageVersion !== "1.
|
|
135
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
136
136
|
return binding;
|
|
137
137
|
} catch (e) {
|
|
138
138
|
loadErrors.push(e);
|
|
@@ -145,7 +145,7 @@ function requireNative() {
|
|
|
145
145
|
}
|
|
146
146
|
try {
|
|
147
147
|
let binding = require("@oxlint/binding-darwin-arm64"), bindingPackageVersion = require("@oxlint/binding-darwin-arm64/package.json").version;
|
|
148
|
-
if (bindingPackageVersion !== "1.
|
|
148
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
149
149
|
return binding;
|
|
150
150
|
} catch (e) {
|
|
151
151
|
loadErrors.push(e);
|
|
@@ -159,7 +159,7 @@ function requireNative() {
|
|
|
159
159
|
}
|
|
160
160
|
try {
|
|
161
161
|
let binding = require("@oxlint/binding-freebsd-x64"), bindingPackageVersion = require("@oxlint/binding-freebsd-x64/package.json").version;
|
|
162
|
-
if (bindingPackageVersion !== "1.
|
|
162
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
163
163
|
return binding;
|
|
164
164
|
} catch (e) {
|
|
165
165
|
loadErrors.push(e);
|
|
@@ -172,7 +172,7 @@ function requireNative() {
|
|
|
172
172
|
}
|
|
173
173
|
try {
|
|
174
174
|
let binding = require("@oxlint/binding-freebsd-arm64"), bindingPackageVersion = require("@oxlint/binding-freebsd-arm64/package.json").version;
|
|
175
|
-
if (bindingPackageVersion !== "1.
|
|
175
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
176
176
|
return binding;
|
|
177
177
|
} catch (e) {
|
|
178
178
|
loadErrors.push(e);
|
|
@@ -186,7 +186,7 @@ function requireNative() {
|
|
|
186
186
|
}
|
|
187
187
|
try {
|
|
188
188
|
let binding = require("@oxlint/binding-linux-x64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-x64-musl/package.json").version;
|
|
189
|
-
if (bindingPackageVersion !== "1.
|
|
189
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
190
190
|
return binding;
|
|
191
191
|
} catch (e) {
|
|
192
192
|
loadErrors.push(e);
|
|
@@ -199,7 +199,7 @@ function requireNative() {
|
|
|
199
199
|
}
|
|
200
200
|
try {
|
|
201
201
|
let binding = require("@oxlint/binding-linux-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-x64-gnu/package.json").version;
|
|
202
|
-
if (bindingPackageVersion !== "1.
|
|
202
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
203
203
|
return binding;
|
|
204
204
|
} catch (e) {
|
|
205
205
|
loadErrors.push(e);
|
|
@@ -213,7 +213,7 @@ function requireNative() {
|
|
|
213
213
|
}
|
|
214
214
|
try {
|
|
215
215
|
let binding = require("@oxlint/binding-linux-arm64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-musl/package.json").version;
|
|
216
|
-
if (bindingPackageVersion !== "1.
|
|
216
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
217
217
|
return binding;
|
|
218
218
|
} catch (e) {
|
|
219
219
|
loadErrors.push(e);
|
|
@@ -226,7 +226,7 @@ function requireNative() {
|
|
|
226
226
|
}
|
|
227
227
|
try {
|
|
228
228
|
let binding = require("@oxlint/binding-linux-arm64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-gnu/package.json").version;
|
|
229
|
-
if (bindingPackageVersion !== "1.
|
|
229
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
230
230
|
return binding;
|
|
231
231
|
} catch (e) {
|
|
232
232
|
loadErrors.push(e);
|
|
@@ -240,7 +240,7 @@ function requireNative() {
|
|
|
240
240
|
}
|
|
241
241
|
try {
|
|
242
242
|
let binding = require("@oxlint/binding-linux-arm-musleabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-musleabihf/package.json").version;
|
|
243
|
-
if (bindingPackageVersion !== "1.
|
|
243
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
244
244
|
return binding;
|
|
245
245
|
} catch (e) {
|
|
246
246
|
loadErrors.push(e);
|
|
@@ -253,7 +253,7 @@ function requireNative() {
|
|
|
253
253
|
}
|
|
254
254
|
try {
|
|
255
255
|
let binding = require("@oxlint/binding-linux-arm-gnueabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-gnueabihf/package.json").version;
|
|
256
|
-
if (bindingPackageVersion !== "1.
|
|
256
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
257
257
|
return binding;
|
|
258
258
|
} catch (e) {
|
|
259
259
|
loadErrors.push(e);
|
|
@@ -267,7 +267,7 @@ function requireNative() {
|
|
|
267
267
|
}
|
|
268
268
|
try {
|
|
269
269
|
let binding = require("@oxlint/binding-linux-loong64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-musl/package.json").version;
|
|
270
|
-
if (bindingPackageVersion !== "1.
|
|
270
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
271
271
|
return binding;
|
|
272
272
|
} catch (e) {
|
|
273
273
|
loadErrors.push(e);
|
|
@@ -280,7 +280,7 @@ function requireNative() {
|
|
|
280
280
|
}
|
|
281
281
|
try {
|
|
282
282
|
let binding = require("@oxlint/binding-linux-loong64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-gnu/package.json").version;
|
|
283
|
-
if (bindingPackageVersion !== "1.
|
|
283
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
284
284
|
return binding;
|
|
285
285
|
} catch (e) {
|
|
286
286
|
loadErrors.push(e);
|
|
@@ -294,7 +294,7 @@ function requireNative() {
|
|
|
294
294
|
}
|
|
295
295
|
try {
|
|
296
296
|
let binding = require("@oxlint/binding-linux-riscv64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-musl/package.json").version;
|
|
297
|
-
if (bindingPackageVersion !== "1.
|
|
297
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
298
298
|
return binding;
|
|
299
299
|
} catch (e) {
|
|
300
300
|
loadErrors.push(e);
|
|
@@ -307,7 +307,7 @@ function requireNative() {
|
|
|
307
307
|
}
|
|
308
308
|
try {
|
|
309
309
|
let binding = require("@oxlint/binding-linux-riscv64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-gnu/package.json").version;
|
|
310
|
-
if (bindingPackageVersion !== "1.
|
|
310
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
311
311
|
return binding;
|
|
312
312
|
} catch (e) {
|
|
313
313
|
loadErrors.push(e);
|
|
@@ -321,7 +321,7 @@ function requireNative() {
|
|
|
321
321
|
}
|
|
322
322
|
try {
|
|
323
323
|
let binding = require("@oxlint/binding-linux-ppc64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-ppc64-gnu/package.json").version;
|
|
324
|
-
if (bindingPackageVersion !== "1.
|
|
324
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
325
325
|
return binding;
|
|
326
326
|
} catch (e) {
|
|
327
327
|
loadErrors.push(e);
|
|
@@ -334,7 +334,7 @@ function requireNative() {
|
|
|
334
334
|
}
|
|
335
335
|
try {
|
|
336
336
|
let binding = require("@oxlint/binding-linux-s390x-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-s390x-gnu/package.json").version;
|
|
337
|
-
if (bindingPackageVersion !== "1.
|
|
337
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
338
338
|
return binding;
|
|
339
339
|
} catch (e) {
|
|
340
340
|
loadErrors.push(e);
|
|
@@ -348,7 +348,7 @@ function requireNative() {
|
|
|
348
348
|
}
|
|
349
349
|
try {
|
|
350
350
|
let binding = require("@oxlint/binding-openharmony-arm64"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm64/package.json").version;
|
|
351
|
-
if (bindingPackageVersion !== "1.
|
|
351
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
352
352
|
return binding;
|
|
353
353
|
} catch (e) {
|
|
354
354
|
loadErrors.push(e);
|
|
@@ -361,7 +361,7 @@ function requireNative() {
|
|
|
361
361
|
}
|
|
362
362
|
try {
|
|
363
363
|
let binding = require("@oxlint/binding-openharmony-x64"), bindingPackageVersion = require("@oxlint/binding-openharmony-x64/package.json").version;
|
|
364
|
-
if (bindingPackageVersion !== "1.
|
|
364
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
365
365
|
return binding;
|
|
366
366
|
} catch (e) {
|
|
367
367
|
loadErrors.push(e);
|
|
@@ -374,7 +374,7 @@ function requireNative() {
|
|
|
374
374
|
}
|
|
375
375
|
try {
|
|
376
376
|
let binding = require("@oxlint/binding-openharmony-arm"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm/package.json").version;
|
|
377
|
-
if (bindingPackageVersion !== "1.
|
|
377
|
+
if (bindingPackageVersion !== "1.60.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.60.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
378
378
|
return binding;
|
|
379
379
|
} catch (e) {
|
|
380
380
|
loadErrors.push(e);
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as lint } from "./bindings.js";
|
|
2
2
|
//#region src-js/cli.ts
|
|
3
|
-
let loadPlugin = null, setupRuleConfigs = null, lintFile = null, createWorkspace = null, destroyWorkspace = null,
|
|
3
|
+
let loadPlugin = null, setupRuleConfigs = null, lintFile = null, createWorkspace = null, destroyWorkspace = null, resolvedConfigLoader = null;
|
|
4
4
|
/**
|
|
5
5
|
* Load a plugin.
|
|
6
6
|
*
|
|
@@ -76,7 +76,7 @@ function destroyWorkspaceWrapper(workspace) {
|
|
|
76
76
|
* @returns JSON-stringified result with all configs or error
|
|
77
77
|
*/
|
|
78
78
|
function loadJsConfigsWrapper(paths) {
|
|
79
|
-
return
|
|
79
|
+
return resolvedConfigLoader === null ? import("./js_config.js").then(({ loadJsConfigs, loadVitePlusConfigs }) => (resolvedConfigLoader = process.env.VP_VERSION ? loadVitePlusConfigs : loadJsConfigs, resolvedConfigLoader(paths))) : resolvedConfigLoader(paths);
|
|
80
80
|
}
|
|
81
81
|
const args = process.argv.slice(2);
|
|
82
82
|
process.stdout.isTTY || (process.stdin._handle?.setBlocking?.(!0), process.stdout._handle?.setBlocking?.(!0)), args.includes("--lsp") && (process.stdout.write = process.stderr.write.bind(process.stderr)), await lint(args, loadPluginWrapper, setupRuleConfigsWrapper, lintFileWrapper, createWorkspaceWrapper, destroyWorkspaceWrapper, loadJsConfigsWrapper) || (process.exitCode = 1);
|
package/dist/js_config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as JSONStringify, n as ArrayIsArray, r as DateNow } from "./globals.js";
|
|
2
2
|
import { t as getErrorMessage } from "./utils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { extname } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
//#region src-js/utils/node_version.ts
|
|
6
6
|
const TS_MODULE_EXTENSIONS = new Set([
|
|
@@ -30,7 +30,7 @@ function getUnsupportedTypeScriptModuleLoadHintForError(err, specifier, nodeVers
|
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src-js/js_config.ts
|
|
33
|
-
const isObject = (v) => typeof v == "object" && !!v && !ArrayIsArray(v)
|
|
33
|
+
const isObject = (v) => typeof v == "object" && !!v && !ArrayIsArray(v);
|
|
34
34
|
function validateConfigExtends(root) {
|
|
35
35
|
let visited = /* @__PURE__ */ new WeakSet(), inStack = /* @__PURE__ */ new WeakSet(), stackObjects = [], stackPaths = [], formatCycleError = (refPath, cycleStart, idx) => `\`extends\` contains a circular reference.
|
|
36
36
|
|
|
@@ -60,41 +60,53 @@ ${refPath} points back to ${cycleStart}\nCycle: ${idx === -1 ? `${cycleStart} ->
|
|
|
60
60
|
visit(root, "<root>");
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* Uses native Node.js TypeScript support to import the config files.
|
|
66
|
-
* Each config file should have a default export containing the oxlint configuration.
|
|
67
|
-
*
|
|
68
|
-
* @param paths - Array of absolute paths to JavaScript/TypeScript config files
|
|
69
|
-
* @returns JSON-stringified result with all configs or error
|
|
63
|
+
* Import a JS/TS config file and return its default export.
|
|
70
64
|
*/
|
|
71
|
-
async function
|
|
65
|
+
async function importConfig(path, cacheKey) {
|
|
66
|
+
let config = (await import(new URL(`file://${path}?cache=${cacheKey}`).href)).default;
|
|
67
|
+
if (config === void 0) throw Error("Configuration file has no default export.");
|
|
68
|
+
return config;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolve a single config path to a `JsConfigResult`.
|
|
72
|
+
* Standard mode: default export must be a plain object.
|
|
73
|
+
*/
|
|
74
|
+
async function resolveJsConfig(path, cacheKey) {
|
|
75
|
+
let config = await importConfig(path, cacheKey);
|
|
76
|
+
if (!isObject(config)) throw Error("Configuration file must have a default export that is an object.");
|
|
77
|
+
return validateConfigExtends(config), {
|
|
78
|
+
path,
|
|
79
|
+
config
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const VITE_OXLINT_CONFIG_FIELD = "lint";
|
|
83
|
+
/**
|
|
84
|
+
* Resolve a single Vite+ config path to a `JsConfigResult`.
|
|
85
|
+
* Extracts the `.lint` field. Returns `null` config when missing (signals "skip").
|
|
86
|
+
*/
|
|
87
|
+
async function resolveVitePlusConfig(path, cacheKey) {
|
|
88
|
+
let config = await importConfig(path, cacheKey);
|
|
89
|
+
if (!isObject(config)) return {
|
|
90
|
+
path,
|
|
91
|
+
config: null
|
|
92
|
+
};
|
|
93
|
+
let lintConfig = config[VITE_OXLINT_CONFIG_FIELD];
|
|
94
|
+
if (lintConfig === void 0) return {
|
|
95
|
+
path,
|
|
96
|
+
config: null
|
|
97
|
+
};
|
|
98
|
+
if (!isObject(lintConfig)) throw Error(`The \`${VITE_OXLINT_CONFIG_FIELD}\` field in the default export must be an object.`);
|
|
99
|
+
return validateConfigExtends(lintConfig), {
|
|
100
|
+
path,
|
|
101
|
+
config: lintConfig
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Load config files in parallel using the given resolver, and return JSON-stringified result.
|
|
106
|
+
*/
|
|
107
|
+
async function loadConfigs(paths, resolver) {
|
|
72
108
|
try {
|
|
73
|
-
let cacheKey = DateNow(), results = await Promise.allSettled(paths.map(
|
|
74
|
-
let config = (await import(new URL(`file://${path}?cache=${cacheKey}`).href)).default;
|
|
75
|
-
if (config === void 0) throw Error("Configuration file has no default export.");
|
|
76
|
-
if (basename(path) === "vite.config.ts") {
|
|
77
|
-
if (!isObject(config)) return {
|
|
78
|
-
path,
|
|
79
|
-
config: null
|
|
80
|
-
};
|
|
81
|
-
let lintConfig = config[VITE_OXLINT_CONFIG_FIELD];
|
|
82
|
-
if (lintConfig === void 0) return {
|
|
83
|
-
path,
|
|
84
|
-
config: null
|
|
85
|
-
};
|
|
86
|
-
if (!isObject(lintConfig)) throw Error(`The \`${VITE_OXLINT_CONFIG_FIELD}\` field in the default export must be an object.`);
|
|
87
|
-
return validateConfigExtends(lintConfig), {
|
|
88
|
-
path,
|
|
89
|
-
config: lintConfig
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (!isObject(config)) throw Error("Configuration file must have a default export that is an object.");
|
|
93
|
-
return validateConfigExtends(config), {
|
|
94
|
-
path,
|
|
95
|
-
config
|
|
96
|
-
};
|
|
97
|
-
})), successes = [], errors = [];
|
|
109
|
+
let cacheKey = DateNow(), results = await Promise.allSettled(paths.map((path) => resolver(path, cacheKey))), successes = [], errors = [];
|
|
98
110
|
for (let i = 0; i < results.length; i++) {
|
|
99
111
|
let result = results[i];
|
|
100
112
|
if (result.status === "fulfilled") successes.push(result.value);
|
|
@@ -111,5 +123,9 @@ async function loadJsConfigs(paths) {
|
|
|
111
123
|
return JSONStringify({ Error: getErrorMessage(err) });
|
|
112
124
|
}
|
|
113
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Load standard oxlint JS/TS config files in parallel.
|
|
128
|
+
*/
|
|
129
|
+
const loadJsConfigs = (paths) => loadConfigs(paths, resolveJsConfig), loadVitePlusConfigs = (paths) => loadConfigs(paths, resolveVitePlusConfig);
|
|
114
130
|
//#endregion
|
|
115
|
-
export { loadJsConfigs };
|
|
131
|
+
export { loadJsConfigs, loadVitePlusConfigs };
|