oxlint 1.50.0 → 1.52.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 CHANGED
@@ -30,7 +30,7 @@
30
30
  [ci-badge]: https://github.com/oxc-project/oxc/actions/workflows/ci.yml/badge.svg?event=push&branch=main
31
31
  [ci-url]: https://github.com/oxc-project/oxc/actions/workflows/ci.yml?query=event%3Apush+branch%3Amain
32
32
  [npm-badge]: https://img.shields.io/npm/v/oxlint/latest?color=brightgreen
33
- [npm-url]: https://www.npmjs.com/package/oxlint/v/latest
33
+ [npm-url]: https://npmx.dev/package/oxlint/v/latest
34
34
  [code-size-badge]: https://img.shields.io/github/languages/code-size/oxc-project/oxc
35
35
  [code-size-url]: https://github.com/oxc-project/oxc
36
36
  [code-coverage-badge]: https://codecov.io/github/oxc-project/oxc/branch/main/graph/badge.svg
@@ -38,7 +38,7 @@
38
38
  [sponsors-badge]: https://img.shields.io/github/sponsors/Boshen
39
39
  [sponsors-url]: https://github.com/sponsors/Boshen
40
40
  [playground-badge]: https://img.shields.io/badge/Playground-blue?color=9BE4E0
41
- [playground-url]: https://oxc-playground.netlify.app
41
+ [playground-url]: https://playground.oxc.rs/
42
42
 
43
43
  </div>
44
44
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "Oxlintrc",
4
- "description": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json --import-plugin`\n\n::: danger NOTE\n\nOnly the `.json` format is supported. You can use comments in configuration files.\n\n:::\n\nExample\n\n`.oxlintrc.json`\n\n```json\n{\n\"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n\"plugins\": [\"import\", \"typescript\", \"unicorn\"],\n\"env\": {\n\"browser\": true\n},\n\"globals\": {\n\"foo\": \"readonly\"\n},\n\"settings\": {\n\"react\": {\n\"version\": \"18.2.0\"\n},\n\"custom\": { \"option\": true }\n},\n\"rules\": {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\n\"overrides\": [\n{\n\"files\": [\"*.test.ts\", \"*.spec.ts\"],\n\"rules\": {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n}\n```",
4
+ "description": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json`\n\nExample\n\n`.oxlintrc.json`\n\n```json\n{\n\"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n\"plugins\": [\"import\", \"typescript\", \"unicorn\"],\n\"env\": {\n\"browser\": true\n},\n\"globals\": {\n\"foo\": \"readonly\"\n},\n\"settings\": {\n\"react\": {\n\"version\": \"18.2.0\"\n},\n\"custom\": { \"option\": true }\n},\n\"rules\": {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\n\"overrides\": [\n{\n\"files\": [\"*.test.ts\", \"*.spec.ts\"],\n\"rules\": {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n}\n```\n\n`oxlint.config.ts`\n\n```ts\nimport { defineConfig } from \"oxlint\";\n\nexport default defineConfig({\nplugins: [\"import\", \"typescript\", \"unicorn\"],\nenv: {\n\"browser\": true\n},\nglobals: {\n\"foo\": \"readonly\"\n},\nsettings: {\nreact: {\nversion: \"18.2.0\"\n},\ncustom: { option: true }\n},\nrules: {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\noverrides: [\n{\nfiles: [\"*.test.ts\", \"*.spec.ts\"],\nrules: {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n}\n});\n```",
5
5
  "type": "object",
6
6
  "properties": {
7
7
  "$schema": {
@@ -75,6 +75,15 @@
75
75
  ],
76
76
  "markdownDescription": "JS plugins, allows usage of ESLint plugins with Oxlint.\n\nRead more about JS plugins in\n[the docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).\n\nNote: JS plugins are experimental and not subject to semver.\n\nExamples:\n\nBasic usage with a local plugin path.\n\n```json\n{\n\"jsPlugins\": [\"./custom-plugin.js\"],\n\"rules\": {\n\"custom/rule-name\": \"warn\"\n}\n}\n```\n\nUsing a built-in Rust plugin alongside a JS plugin with the same name\nby giving the JS plugin an alias.\n\n```json\n{\n\"plugins\": [\"import\"],\n\"jsPlugins\": [\n{ \"name\": \"import-js\", \"specifier\": \"eslint-plugin-import\" }\n],\n\"rules\": {\n\"import/no-cycle\": \"error\",\n\"import-js/no-unresolved\": \"warn\"\n}\n}\n```"
77
77
  },
78
+ "options": {
79
+ "description": "Oxlint config options.",
80
+ "allOf": [
81
+ {
82
+ "$ref": "#/definitions/OxlintOptions"
83
+ }
84
+ ],
85
+ "markdownDescription": "Oxlint config options."
86
+ },
78
87
  "overrides": {
79
88
  "description": "Add, remove, or otherwise reconfigure rules for specific files or groups of files.",
80
89
  "allOf": [
@@ -481,6 +490,60 @@
481
490
  },
482
491
  "markdownDescription": "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\"`."
483
492
  },
493
+ "OxlintOptions": {
494
+ "description": "Options for the linter.",
495
+ "type": "object",
496
+ "properties": {
497
+ "denyWarnings": {
498
+ "description": "Ensure warnings produce a non-zero exit code.\n\nEquivalent to passing `--deny-warnings` on the CLI.",
499
+ "type": [
500
+ "boolean",
501
+ "null"
502
+ ],
503
+ "markdownDescription": "Ensure warnings produce a non-zero exit code.\n\nEquivalent to passing `--deny-warnings` on the CLI."
504
+ },
505
+ "maxWarnings": {
506
+ "description": "Specify a warning threshold. Exits with an error status if warnings exceed this value.\n\nEquivalent to passing `--max-warnings` on the CLI.",
507
+ "type": [
508
+ "integer",
509
+ "null"
510
+ ],
511
+ "format": "uint",
512
+ "minimum": 0.0,
513
+ "markdownDescription": "Specify a warning threshold. Exits with an error status if warnings exceed this value.\n\nEquivalent to passing `--max-warnings` on the CLI."
514
+ },
515
+ "reportUnusedDisableDirectives": {
516
+ "description": "Report unused disable directives (e.g. `// oxlint-disable-line` or `// eslint-disable-line`).\n\nEquivalent to passing `--report-unused-disable-directives-severity` on the CLI.\nCLI flags take precedence over this value when both are set.\nOnly supported in the root configuration file.",
517
+ "anyOf": [
518
+ {
519
+ "$ref": "#/definitions/AllowWarnDeny"
520
+ },
521
+ {
522
+ "type": "null"
523
+ }
524
+ ],
525
+ "markdownDescription": "Report unused disable directives (e.g. `// oxlint-disable-line` or `// eslint-disable-line`).\n\nEquivalent to passing `--report-unused-disable-directives-severity` on the CLI.\nCLI flags take precedence over this value when both are set.\nOnly supported in the root configuration file."
526
+ },
527
+ "typeAware": {
528
+ "description": "Enable rules that require type information.\n\nEquivalent to passing `--type-aware` on the CLI.\n\nNote that this requires the `oxlint-tsgolint` package to be installed.",
529
+ "type": [
530
+ "boolean",
531
+ "null"
532
+ ],
533
+ "markdownDescription": "Enable rules that require type information.\n\nEquivalent to passing `--type-aware` on the CLI.\n\nNote that this requires the `oxlint-tsgolint` package to be installed."
534
+ },
535
+ "typeCheck": {
536
+ "description": "Enable experimental type checking (includes TypeScript compiler diagnostics).\n\nEquivalent to passing `--type-check` on the CLI.\n\nNote that this requires the `oxlint-tsgolint` package to be installed.",
537
+ "type": [
538
+ "boolean",
539
+ "null"
540
+ ],
541
+ "markdownDescription": "Enable experimental type checking (includes TypeScript compiler diagnostics).\n\nEquivalent to passing `--type-check` on the CLI.\n\nNote that this requires the `oxlint-tsgolint` package to be installed."
542
+ }
543
+ },
544
+ "additionalProperties": false,
545
+ "markdownDescription": "Options for the linter."
546
+ },
484
547
  "OxlintOverride": {
485
548
  "type": "object",
486
549
  "required": [
@@ -733,5 +796,5 @@
733
796
  "markdownDescription": "Configure Vitest plugin rules.\n\nSee [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest)'s\nconfiguration for a full reference."
734
797
  }
735
798
  },
736
- "markdownDescription": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json --import-plugin`\n\n::: danger NOTE\n\nOnly the `.json` format is supported. You can use comments in configuration files.\n\n:::\n\nExample\n\n`.oxlintrc.json`\n\n```json\n{\n\"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n\"plugins\": [\"import\", \"typescript\", \"unicorn\"],\n\"env\": {\n\"browser\": true\n},\n\"globals\": {\n\"foo\": \"readonly\"\n},\n\"settings\": {\n\"react\": {\n\"version\": \"18.2.0\"\n},\n\"custom\": { \"option\": true }\n},\n\"rules\": {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\n\"overrides\": [\n{\n\"files\": [\"*.test.ts\", \"*.spec.ts\"],\n\"rules\": {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n}\n```"
799
+ "markdownDescription": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json`\n\nExample\n\n`.oxlintrc.json`\n\n```json\n{\n\"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n\"plugins\": [\"import\", \"typescript\", \"unicorn\"],\n\"env\": {\n\"browser\": true\n},\n\"globals\": {\n\"foo\": \"readonly\"\n},\n\"settings\": {\n\"react\": {\n\"version\": \"18.2.0\"\n},\n\"custom\": { \"option\": true }\n},\n\"rules\": {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\n\"overrides\": [\n{\n\"files\": [\"*.test.ts\", \"*.spec.ts\"],\n\"rules\": {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n}\n```\n\n`oxlint.config.ts`\n\n```ts\nimport { defineConfig } from \"oxlint\";\n\nexport default defineConfig({\nplugins: [\"import\", \"typescript\", \"unicorn\"],\nenv: {\n\"browser\": true\n},\nglobals: {\n\"foo\": \"readonly\"\n},\nsettings: {\nreact: {\nversion: \"18.2.0\"\n},\ncustom: { option: true }\n},\nrules: {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\noverrides: [\n{\nfiles: [\"*.test.ts\", \"*.spec.ts\"],\nrules: {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n}\n});\n```"
737
800
  }
package/dist/bindings.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
+ //#region src-js/bindings.js
2
3
  const require = createRequire(import.meta.url);
3
4
  new URL(".", import.meta.url).pathname;
4
5
  const { readFileSync } = require("node:fs");
@@ -36,7 +37,7 @@ function requireNative() {
36
37
  }
37
38
  try {
38
39
  let binding = require("@oxlint/binding-android-arm64"), bindingPackageVersion = require("@oxlint/binding-android-arm64/package.json").version;
39
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
40
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
40
41
  return binding;
41
42
  } catch (e) {
42
43
  loadErrors.push(e);
@@ -49,7 +50,7 @@ function requireNative() {
49
50
  }
50
51
  try {
51
52
  let binding = require("@oxlint/binding-android-arm-eabi"), bindingPackageVersion = require("@oxlint/binding-android-arm-eabi/package.json").version;
52
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
53
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
53
54
  return binding;
54
55
  } catch (e) {
55
56
  loadErrors.push(e);
@@ -63,7 +64,7 @@ function requireNative() {
63
64
  }
64
65
  try {
65
66
  let binding = require("@oxlint/binding-win32-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-win32-x64-gnu/package.json").version;
66
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
67
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
67
68
  return binding;
68
69
  } catch (e) {
69
70
  loadErrors.push(e);
@@ -76,7 +77,7 @@ function requireNative() {
76
77
  }
77
78
  try {
78
79
  let binding = require("@oxlint/binding-win32-x64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-x64-msvc/package.json").version;
79
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
80
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
80
81
  return binding;
81
82
  } catch (e) {
82
83
  loadErrors.push(e);
@@ -90,7 +91,7 @@ function requireNative() {
90
91
  }
91
92
  try {
92
93
  let binding = require("@oxlint/binding-win32-ia32-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-ia32-msvc/package.json").version;
93
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
94
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
94
95
  return binding;
95
96
  } catch (e) {
96
97
  loadErrors.push(e);
@@ -103,7 +104,7 @@ function requireNative() {
103
104
  }
104
105
  try {
105
106
  let binding = require("@oxlint/binding-win32-arm64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-arm64-msvc/package.json").version;
106
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
107
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
107
108
  return binding;
108
109
  } catch (e) {
109
110
  loadErrors.push(e);
@@ -117,7 +118,7 @@ function requireNative() {
117
118
  }
118
119
  try {
119
120
  let binding = require("@oxlint/binding-darwin-universal"), bindingPackageVersion = require("@oxlint/binding-darwin-universal/package.json").version;
120
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
121
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
121
122
  return binding;
122
123
  } catch (e) {
123
124
  loadErrors.push(e);
@@ -130,7 +131,7 @@ function requireNative() {
130
131
  }
131
132
  try {
132
133
  let binding = require("@oxlint/binding-darwin-x64"), bindingPackageVersion = require("@oxlint/binding-darwin-x64/package.json").version;
133
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
134
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
134
135
  return binding;
135
136
  } catch (e) {
136
137
  loadErrors.push(e);
@@ -143,7 +144,7 @@ function requireNative() {
143
144
  }
144
145
  try {
145
146
  let binding = require("@oxlint/binding-darwin-arm64"), bindingPackageVersion = require("@oxlint/binding-darwin-arm64/package.json").version;
146
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
147
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
147
148
  return binding;
148
149
  } catch (e) {
149
150
  loadErrors.push(e);
@@ -157,7 +158,7 @@ function requireNative() {
157
158
  }
158
159
  try {
159
160
  let binding = require("@oxlint/binding-freebsd-x64"), bindingPackageVersion = require("@oxlint/binding-freebsd-x64/package.json").version;
160
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
161
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
161
162
  return binding;
162
163
  } catch (e) {
163
164
  loadErrors.push(e);
@@ -170,7 +171,7 @@ function requireNative() {
170
171
  }
171
172
  try {
172
173
  let binding = require("@oxlint/binding-freebsd-arm64"), bindingPackageVersion = require("@oxlint/binding-freebsd-arm64/package.json").version;
173
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
174
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
174
175
  return binding;
175
176
  } catch (e) {
176
177
  loadErrors.push(e);
@@ -184,7 +185,7 @@ function requireNative() {
184
185
  }
185
186
  try {
186
187
  let binding = require("@oxlint/binding-linux-x64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-x64-musl/package.json").version;
187
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
188
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
188
189
  return binding;
189
190
  } catch (e) {
190
191
  loadErrors.push(e);
@@ -197,7 +198,7 @@ function requireNative() {
197
198
  }
198
199
  try {
199
200
  let binding = require("@oxlint/binding-linux-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-x64-gnu/package.json").version;
200
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
201
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
201
202
  return binding;
202
203
  } catch (e) {
203
204
  loadErrors.push(e);
@@ -211,7 +212,7 @@ function requireNative() {
211
212
  }
212
213
  try {
213
214
  let binding = require("@oxlint/binding-linux-arm64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-musl/package.json").version;
214
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
215
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
215
216
  return binding;
216
217
  } catch (e) {
217
218
  loadErrors.push(e);
@@ -224,7 +225,7 @@ function requireNative() {
224
225
  }
225
226
  try {
226
227
  let binding = require("@oxlint/binding-linux-arm64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-gnu/package.json").version;
227
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
228
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
228
229
  return binding;
229
230
  } catch (e) {
230
231
  loadErrors.push(e);
@@ -238,7 +239,7 @@ function requireNative() {
238
239
  }
239
240
  try {
240
241
  let binding = require("@oxlint/binding-linux-arm-musleabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-musleabihf/package.json").version;
241
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
242
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
242
243
  return binding;
243
244
  } catch (e) {
244
245
  loadErrors.push(e);
@@ -251,7 +252,7 @@ function requireNative() {
251
252
  }
252
253
  try {
253
254
  let binding = require("@oxlint/binding-linux-arm-gnueabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-gnueabihf/package.json").version;
254
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
255
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
255
256
  return binding;
256
257
  } catch (e) {
257
258
  loadErrors.push(e);
@@ -265,7 +266,7 @@ function requireNative() {
265
266
  }
266
267
  try {
267
268
  let binding = require("@oxlint/binding-linux-loong64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-musl/package.json").version;
268
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
269
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
269
270
  return binding;
270
271
  } catch (e) {
271
272
  loadErrors.push(e);
@@ -278,7 +279,7 @@ function requireNative() {
278
279
  }
279
280
  try {
280
281
  let binding = require("@oxlint/binding-linux-loong64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-gnu/package.json").version;
281
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
282
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
282
283
  return binding;
283
284
  } catch (e) {
284
285
  loadErrors.push(e);
@@ -292,7 +293,7 @@ function requireNative() {
292
293
  }
293
294
  try {
294
295
  let binding = require("@oxlint/binding-linux-riscv64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-musl/package.json").version;
295
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
296
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
296
297
  return binding;
297
298
  } catch (e) {
298
299
  loadErrors.push(e);
@@ -305,7 +306,7 @@ function requireNative() {
305
306
  }
306
307
  try {
307
308
  let binding = require("@oxlint/binding-linux-riscv64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-gnu/package.json").version;
308
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
309
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
309
310
  return binding;
310
311
  } catch (e) {
311
312
  loadErrors.push(e);
@@ -319,7 +320,7 @@ function requireNative() {
319
320
  }
320
321
  try {
321
322
  let binding = require("@oxlint/binding-linux-ppc64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-ppc64-gnu/package.json").version;
322
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
323
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
323
324
  return binding;
324
325
  } catch (e) {
325
326
  loadErrors.push(e);
@@ -332,7 +333,7 @@ function requireNative() {
332
333
  }
333
334
  try {
334
335
  let binding = require("@oxlint/binding-linux-s390x-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-s390x-gnu/package.json").version;
335
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
336
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
336
337
  return binding;
337
338
  } catch (e) {
338
339
  loadErrors.push(e);
@@ -346,7 +347,7 @@ function requireNative() {
346
347
  }
347
348
  try {
348
349
  let binding = require("@oxlint/binding-openharmony-arm64"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm64/package.json").version;
349
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
350
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
350
351
  return binding;
351
352
  } catch (e) {
352
353
  loadErrors.push(e);
@@ -359,7 +360,7 @@ function requireNative() {
359
360
  }
360
361
  try {
361
362
  let binding = require("@oxlint/binding-openharmony-x64"), bindingPackageVersion = require("@oxlint/binding-openharmony-x64/package.json").version;
362
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
363
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
363
364
  return binding;
364
365
  } catch (e) {
365
366
  loadErrors.push(e);
@@ -372,7 +373,7 @@ function requireNative() {
372
373
  }
373
374
  try {
374
375
  let binding = require("@oxlint/binding-openharmony-arm"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm/package.json").version;
375
- if (bindingPackageVersion !== "1.50.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.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
376
+ if (bindingPackageVersion !== "1.52.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.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
376
377
  return binding;
377
378
  } catch (e) {
378
379
  loadErrors.push(e);
@@ -399,4 +400,5 @@ if (nativeBinding = requireNative(), !nativeBinding || process.env.NAPI_RS_FORCE
399
400
  }
400
401
  if (!nativeBinding) throw loadErrors.length > 0 ? Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors.reduce((err, cur) => (cur.cause = err, cur)) }) : Error("Failed to load native binding");
401
402
  const { Severity, applyFixes, getBufferOffset, lint, parseRawSync, rawTransferSupported } = nativeBinding;
403
+ //#endregion
402
404
  export { rawTransferSupported as a, parseRawSync as i, getBufferOffset as n, lint as r, applyFixes as t };
package/dist/cli.js CHANGED
@@ -1,23 +1,84 @@
1
1
  import { r as lint } from "./bindings.js";
2
+ //#region src-js/cli.ts
2
3
  let loadPlugin = null, setupRuleConfigs = null, lintFile = null, createWorkspace = null, destroyWorkspace = null, loadJsConfigs = null;
4
+ /**
5
+ * Load a plugin.
6
+ *
7
+ * Lazy-loads plugins code on first call, so that overhead is skipped if user doesn't use JS plugins.
8
+ *
9
+ * @param path - Absolute path of plugin file
10
+ * @param pluginName - Plugin name (either alias or package name)
11
+ * @param pluginNameIsAlias - `true` if plugin name is an alias (takes priority over name that plugin defines itself)
12
+ * @param workspaceUri - Workspace URI (`null` in CLI mode, `string` in LSP mode)
13
+ * @returns Plugin details or error serialized to JSON string
14
+ */
3
15
  function loadPluginWrapper(path, pluginName, pluginNameIsAlias, workspaceUri) {
4
16
  return loadPlugin === null ? import("./plugins.js").then((mod) => ({loadPlugin, lintFile, setupRuleConfigs} = mod, loadPlugin(path, pluginName, pluginNameIsAlias, workspaceUri))) : loadPlugin(path, pluginName, pluginNameIsAlias, workspaceUri);
5
17
  }
18
+ /**
19
+ * Bootstrap configuration options.
20
+ *
21
+ * Delegates to `setupRuleConfigs`, which was lazy-loaded by `loadPluginWrapper`.
22
+ *
23
+ * @param optionsJSON - Array of all rule options across all configurations, serialized as JSON
24
+ * @returns `null` if success, or error message string
25
+ */
6
26
  function setupRuleConfigsWrapper(optionsJSON) {
7
27
  return setupRuleConfigs(optionsJSON);
8
28
  }
29
+ /**
30
+ * Lint a file.
31
+ *
32
+ * Delegates to `lintFile`, which was lazy-loaded by `loadPluginWrapper`.
33
+ *
34
+ * @param filePath - Absolute path of file being linted
35
+ * @param bufferId - ID of buffer containing file data
36
+ * @param buffer - Buffer containing file data, or `null` if buffer with this ID was previously sent to JS
37
+ * @param ruleIds - IDs of rules to run on this file
38
+ * @param optionsIds - IDs of options to use for rules on this file, in same order as `ruleIds`
39
+ * @param settingsJSON - Settings for file, as JSON
40
+ * @param globalsJSON - Globals for file, as JSON
41
+ * @param workspaceUri - Workspace URI (`null` in CLI mode, `string` in LSP mode)
42
+ * @returns Diagnostics or error serialized to JSON string
43
+ */
9
44
  function lintFileWrapper(filePath, bufferId, buffer, ruleIds, optionsIds, settingsJSON, globalsJSON, workspaceUri) {
10
45
  return lintFile(filePath, bufferId, buffer, ruleIds, optionsIds, settingsJSON, globalsJSON, workspaceUri);
11
46
  }
47
+ /**
48
+ * Create a new workspace.
49
+ *
50
+ * Lazy-loads workspace code on first call, so that overhead is skipped if user doesn't use JS plugins.
51
+ *
52
+ * @param workspace - Workspace URI
53
+ * @returns Promise which resolves when workspace is created
54
+ */
12
55
  function createWorkspaceWrapper(workspace) {
13
56
  return createWorkspace === null ? import("./workspace.js").then((mod) => ({createWorkspace, destroyWorkspace} = mod, createWorkspace(workspace))) : Promise.resolve(createWorkspace(workspace));
14
57
  }
58
+ /**
59
+ * Destroy a workspace.
60
+ *
61
+ * Delegates to `destroyWorkspace`, which was lazy-loaded by `createWorkspaceWrapper`.
62
+ *
63
+ * @param workspace - Workspace URI
64
+ * @returns `undefined`
65
+ */
15
66
  function destroyWorkspaceWrapper(workspace) {
16
67
  destroyWorkspace(workspace);
17
68
  }
69
+ /**
70
+ * Load JavaScript/TypeScript config files (experimental).
71
+ *
72
+ * Lazy-loads the js_config module on first call.
73
+ * Uses native Node.js TypeScript support to import config files.
74
+ *
75
+ * @param paths - Array of absolute paths to JavaScript/TypeScript config files
76
+ * @returns JSON-stringified result with all configs or error
77
+ */
18
78
  function loadJsConfigsWrapper(paths) {
19
79
  return loadJsConfigs === null ? import("./js_config.js").then((mod) => (loadJsConfigs = mod.loadJsConfigs, loadJsConfigs(paths))) : loadJsConfigs(paths);
20
80
  }
21
81
  const args = process.argv.slice(2);
22
82
  process.stdout.isTTY || (process.stdin._handle?.setBlocking?.(!0), process.stdout._handle?.setBlocking?.(!0)), await lint(args, loadPluginWrapper, setupRuleConfigsWrapper, lintFileWrapper, createWorkspaceWrapper, destroyWorkspaceWrapper, loadJsConfigsWrapper) || (process.exitCode = 1);
83
+ //#endregion
23
84
  export {};
package/dist/config.js CHANGED
@@ -1,8 +1,16 @@
1
+ //#region src-js/package/config.ts
1
2
  const DEFINE_CONFIG_REGISTRY = /* @__PURE__ */ new WeakSet();
3
+ /**
4
+ * Define an Oxlint configuration with type inference.
5
+ *
6
+ * @param config - Oxlint configuration
7
+ * @returns Config unchanged
8
+ */
2
9
  function defineConfig(config) {
3
10
  return DEFINE_CONFIG_REGISTRY.add(config), config;
4
11
  }
5
12
  function isDefineConfig(config) {
6
13
  return typeof config == "object" && !!config && DEFINE_CONFIG_REGISTRY.has(config);
7
14
  }
15
+ //#endregion
8
16
  export { isDefineConfig as n, defineConfig as t };