oxlint-react-compiler-experimental 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ <p align="center">
2
+ <br>
3
+ <br>
4
+ <a href="https://oxc.rs" target="_blank" rel="noopener noreferrer">
5
+ <picture>
6
+ <source media="(prefers-color-scheme: dark)" srcset="https://oxc.rs/oxc-light.svg">
7
+ <source media="(prefers-color-scheme: light)" srcset="https://oxc.rs/oxc-dark.svg">
8
+ <img alt="Oxc logo" src="https://oxc.rs/oxc-dark.svg" height="60">
9
+ </picture>
10
+ </a>
11
+ <br>
12
+ <br>
13
+ <br>
14
+ </p>
15
+
16
+ <div align="center">
17
+
18
+ [![MIT licensed][license-badge]][license-url]
19
+ [![Build Status][ci-badge]][ci-url]
20
+ [![Code Coverage][code-coverage-badge]][code-coverage-url]
21
+ [![Sponsors][sponsors-badge]][sponsors-url]
22
+
23
+ [![Discord chat][discord-badge]][discord-url]
24
+ [![Playground][playground-badge]][playground-url]
25
+
26
+ [discord-badge]: https://img.shields.io/discord/1079625926024900739?logo=discord&label=Discord
27
+ [discord-url]: https://discord.gg/9uXCAwqQZW
28
+ [license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
29
+ [license-url]: https://github.com/oxc-project/oxc/blob/main/LICENSE
30
+ [ci-badge]: https://github.com/oxc-project/oxc/actions/workflows/ci.yml/badge.svg?event=push&branch=main
31
+ [ci-url]: https://github.com/oxc-project/oxc/actions/workflows/ci.yml?query=event%3Apush+branch%3Amain
32
+ [npm-badge]: https://img.shields.io/npm/v/oxlint/latest?color=brightgreen
33
+ [npm-url]: https://npmx.dev/package/oxlint/v/latest
34
+ [code-size-badge]: https://img.shields.io/github/languages/code-size/oxc-project/oxc
35
+ [code-size-url]: https://github.com/oxc-project/oxc
36
+ [code-coverage-badge]: https://codecov.io/github/oxc-project/oxc/branch/main/graph/badge.svg
37
+ [code-coverage-url]: https://codecov.io/gh/oxc-project/oxc
38
+ [sponsors-badge]: https://img.shields.io/github/sponsors/Boshen
39
+ [sponsors-url]: https://github.com/sponsors/Boshen
40
+ [playground-badge]: https://img.shields.io/badge/Playground-blue?color=9BE4E0
41
+ [playground-url]: https://playground.oxc.rs/
42
+
43
+ </div>
44
+
45
+ # ⚓ Oxc
46
+
47
+ The Oxidation Compiler is creating a suite of high-performance tools for JavaScript and TypeScript.
48
+
49
+ ## Oxlint
50
+
51
+ This is the linter for oxc.
52
+
53
+ See [usage instructions](https://oxc.rs/docs/guide/usage/linter).
54
+
55
+ Run
56
+
57
+ - `npx --yes oxlint@latest` in your JavaScript / TypeScript codebase and see it complete in milliseconds. No configurations are required.
58
+ - `npx oxlint@latest --help` for quick usage instructions.
59
+ - `npx oxlint@latest --rules` for the list of rules.
package/dist/bindings.js CHANGED
@@ -37,7 +37,7 @@ function requireNative() {
37
37
  }
38
38
  try {
39
39
  let binding = require("@oxlint/binding-android-arm64"), bindingPackageVersion = require("@oxlint/binding-android-arm64/package.json").version;
40
- if (bindingPackageVersion !== "1.51.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.51.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.`);
41
41
  return binding;
42
42
  } catch (e) {
43
43
  loadErrors.push(e);
@@ -50,7 +50,7 @@ function requireNative() {
50
50
  }
51
51
  try {
52
52
  let binding = require("@oxlint/binding-android-arm-eabi"), bindingPackageVersion = require("@oxlint/binding-android-arm-eabi/package.json").version;
53
- if (bindingPackageVersion !== "1.51.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.51.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.`);
54
54
  return binding;
55
55
  } catch (e) {
56
56
  loadErrors.push(e);
@@ -64,7 +64,7 @@ function requireNative() {
64
64
  }
65
65
  try {
66
66
  let binding = require("@oxlint/binding-win32-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-win32-x64-gnu/package.json").version;
67
- if (bindingPackageVersion !== "1.51.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.51.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.`);
68
68
  return binding;
69
69
  } catch (e) {
70
70
  loadErrors.push(e);
@@ -77,7 +77,7 @@ function requireNative() {
77
77
  }
78
78
  try {
79
79
  let binding = require("@oxlint/binding-win32-x64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-x64-msvc/package.json").version;
80
- if (bindingPackageVersion !== "1.51.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.51.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.`);
81
81
  return binding;
82
82
  } catch (e) {
83
83
  loadErrors.push(e);
@@ -91,7 +91,7 @@ function requireNative() {
91
91
  }
92
92
  try {
93
93
  let binding = require("@oxlint/binding-win32-ia32-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-ia32-msvc/package.json").version;
94
- if (bindingPackageVersion !== "1.51.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.51.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.`);
95
95
  return binding;
96
96
  } catch (e) {
97
97
  loadErrors.push(e);
@@ -104,7 +104,7 @@ function requireNative() {
104
104
  }
105
105
  try {
106
106
  let binding = require("@oxlint/binding-win32-arm64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-arm64-msvc/package.json").version;
107
- if (bindingPackageVersion !== "1.51.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.51.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.`);
108
108
  return binding;
109
109
  } catch (e) {
110
110
  loadErrors.push(e);
@@ -118,7 +118,7 @@ function requireNative() {
118
118
  }
119
119
  try {
120
120
  let binding = require("@oxlint/binding-darwin-universal"), bindingPackageVersion = require("@oxlint/binding-darwin-universal/package.json").version;
121
- if (bindingPackageVersion !== "1.51.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.51.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.`);
122
122
  return binding;
123
123
  } catch (e) {
124
124
  loadErrors.push(e);
@@ -131,7 +131,7 @@ function requireNative() {
131
131
  }
132
132
  try {
133
133
  let binding = require("@oxlint/binding-darwin-x64"), bindingPackageVersion = require("@oxlint/binding-darwin-x64/package.json").version;
134
- if (bindingPackageVersion !== "1.51.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.51.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.`);
135
135
  return binding;
136
136
  } catch (e) {
137
137
  loadErrors.push(e);
@@ -144,7 +144,7 @@ function requireNative() {
144
144
  }
145
145
  try {
146
146
  let binding = require("@oxlint/binding-darwin-arm64"), bindingPackageVersion = require("@oxlint/binding-darwin-arm64/package.json").version;
147
- if (bindingPackageVersion !== "1.51.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.51.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.`);
148
148
  return binding;
149
149
  } catch (e) {
150
150
  loadErrors.push(e);
@@ -158,7 +158,7 @@ function requireNative() {
158
158
  }
159
159
  try {
160
160
  let binding = require("@oxlint/binding-freebsd-x64"), bindingPackageVersion = require("@oxlint/binding-freebsd-x64/package.json").version;
161
- if (bindingPackageVersion !== "1.51.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.51.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.`);
162
162
  return binding;
163
163
  } catch (e) {
164
164
  loadErrors.push(e);
@@ -171,7 +171,7 @@ function requireNative() {
171
171
  }
172
172
  try {
173
173
  let binding = require("@oxlint/binding-freebsd-arm64"), bindingPackageVersion = require("@oxlint/binding-freebsd-arm64/package.json").version;
174
- if (bindingPackageVersion !== "1.51.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.51.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.`);
175
175
  return binding;
176
176
  } catch (e) {
177
177
  loadErrors.push(e);
@@ -185,7 +185,7 @@ function requireNative() {
185
185
  }
186
186
  try {
187
187
  let binding = require("@oxlint/binding-linux-x64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-x64-musl/package.json").version;
188
- if (bindingPackageVersion !== "1.51.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.51.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.`);
189
189
  return binding;
190
190
  } catch (e) {
191
191
  loadErrors.push(e);
@@ -198,7 +198,7 @@ function requireNative() {
198
198
  }
199
199
  try {
200
200
  let binding = require("@oxlint/binding-linux-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-x64-gnu/package.json").version;
201
- if (bindingPackageVersion !== "1.51.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.51.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.`);
202
202
  return binding;
203
203
  } catch (e) {
204
204
  loadErrors.push(e);
@@ -212,7 +212,7 @@ function requireNative() {
212
212
  }
213
213
  try {
214
214
  let binding = require("@oxlint/binding-linux-arm64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-musl/package.json").version;
215
- if (bindingPackageVersion !== "1.51.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.51.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.`);
216
216
  return binding;
217
217
  } catch (e) {
218
218
  loadErrors.push(e);
@@ -225,7 +225,7 @@ function requireNative() {
225
225
  }
226
226
  try {
227
227
  let binding = require("@oxlint/binding-linux-arm64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-gnu/package.json").version;
228
- if (bindingPackageVersion !== "1.51.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.51.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.`);
229
229
  return binding;
230
230
  } catch (e) {
231
231
  loadErrors.push(e);
@@ -239,7 +239,7 @@ function requireNative() {
239
239
  }
240
240
  try {
241
241
  let binding = require("@oxlint/binding-linux-arm-musleabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-musleabihf/package.json").version;
242
- if (bindingPackageVersion !== "1.51.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.51.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.`);
243
243
  return binding;
244
244
  } catch (e) {
245
245
  loadErrors.push(e);
@@ -252,7 +252,7 @@ function requireNative() {
252
252
  }
253
253
  try {
254
254
  let binding = require("@oxlint/binding-linux-arm-gnueabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-gnueabihf/package.json").version;
255
- if (bindingPackageVersion !== "1.51.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.51.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.`);
256
256
  return binding;
257
257
  } catch (e) {
258
258
  loadErrors.push(e);
@@ -266,7 +266,7 @@ function requireNative() {
266
266
  }
267
267
  try {
268
268
  let binding = require("@oxlint/binding-linux-loong64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-musl/package.json").version;
269
- if (bindingPackageVersion !== "1.51.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.51.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.`);
270
270
  return binding;
271
271
  } catch (e) {
272
272
  loadErrors.push(e);
@@ -279,7 +279,7 @@ function requireNative() {
279
279
  }
280
280
  try {
281
281
  let binding = require("@oxlint/binding-linux-loong64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-gnu/package.json").version;
282
- if (bindingPackageVersion !== "1.51.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.51.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.`);
283
283
  return binding;
284
284
  } catch (e) {
285
285
  loadErrors.push(e);
@@ -293,7 +293,7 @@ function requireNative() {
293
293
  }
294
294
  try {
295
295
  let binding = require("@oxlint/binding-linux-riscv64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-musl/package.json").version;
296
- if (bindingPackageVersion !== "1.51.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.51.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.`);
297
297
  return binding;
298
298
  } catch (e) {
299
299
  loadErrors.push(e);
@@ -306,7 +306,7 @@ function requireNative() {
306
306
  }
307
307
  try {
308
308
  let binding = require("@oxlint/binding-linux-riscv64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-gnu/package.json").version;
309
- if (bindingPackageVersion !== "1.51.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.51.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.`);
310
310
  return binding;
311
311
  } catch (e) {
312
312
  loadErrors.push(e);
@@ -320,7 +320,7 @@ function requireNative() {
320
320
  }
321
321
  try {
322
322
  let binding = require("@oxlint/binding-linux-ppc64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-ppc64-gnu/package.json").version;
323
- if (bindingPackageVersion !== "1.51.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.51.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.`);
324
324
  return binding;
325
325
  } catch (e) {
326
326
  loadErrors.push(e);
@@ -333,7 +333,7 @@ function requireNative() {
333
333
  }
334
334
  try {
335
335
  let binding = require("@oxlint/binding-linux-s390x-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-s390x-gnu/package.json").version;
336
- if (bindingPackageVersion !== "1.51.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.51.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.`);
337
337
  return binding;
338
338
  } catch (e) {
339
339
  loadErrors.push(e);
@@ -347,7 +347,7 @@ function requireNative() {
347
347
  }
348
348
  try {
349
349
  let binding = require("@oxlint/binding-openharmony-arm64"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm64/package.json").version;
350
- if (bindingPackageVersion !== "1.51.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.51.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.`);
351
351
  return binding;
352
352
  } catch (e) {
353
353
  loadErrors.push(e);
@@ -360,7 +360,7 @@ function requireNative() {
360
360
  }
361
361
  try {
362
362
  let binding = require("@oxlint/binding-openharmony-x64"), bindingPackageVersion = require("@oxlint/binding-openharmony-x64/package.json").version;
363
- if (bindingPackageVersion !== "1.51.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.51.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.`);
364
364
  return binding;
365
365
  } catch (e) {
366
366
  loadErrors.push(e);
@@ -373,7 +373,7 @@ function requireNative() {
373
373
  }
374
374
  try {
375
375
  let binding = require("@oxlint/binding-openharmony-arm"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm/package.json").version;
376
- if (bindingPackageVersion !== "1.51.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.51.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.`);
377
377
  return binding;
378
378
  } catch (e) {
379
379
  loadErrors.push(e);
@@ -399,6 +399,6 @@ if (nativeBinding = requireNative(), !nativeBinding || process.env.NAPI_RS_FORCE
399
399
  }
400
400
  }
401
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");
402
- const { applyFixes, getBufferOffset, lint, parseRawSync, rawTransferSupported } = nativeBinding;
402
+ const { Severity, applyFixes, getBufferOffset, lint, parseRawSync, rawTransferSupported } = nativeBinding;
403
403
  //#endregion
404
404
  export { rawTransferSupported as a, parseRawSync as i, getBufferOffset as n, lint as r, applyFixes as t };
package/dist/lint.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as StringFromCodePoint, a as JSONParse, c as MathMin, d as ObjectDefineProperty, h as ObjectKeys, l as ObjectAssign, m as ObjectHasOwn, o as JSONStringify, p as ObjectFreeze, r as ArrayIsArray, s as MathMax, t as getErrorMessage, u as ObjectCreate, v as SymbolIterator } from "./utils.js";
1
+ import { a as JSONParse, c as MathMin, d as ObjectDefineProperty, g as ObjectPreventExtensions, h as ObjectKeys, l as ObjectAssign, m as ObjectHasOwn, o as JSONStringify, p as ObjectFreeze, r as ArrayIsArray, s as MathMax, t as getErrorMessage, u as ObjectCreate, v as StringFromCodePoint, y as SymbolIterator } from "./utils.js";
2
2
  import { a as setCurrentWorkspace, n as currentWorkspace, o as workspaces, r as currentWorkspaceUri } from "./workspace2.js";
3
3
  import { createRequire } from "node:module";
4
4
  import "node:assert";
@@ -12095,7 +12095,7 @@ function getScope(node) {
12095
12095
  * @returns `true` if a variable with the given name was found and marked as used, otherwise `false`
12096
12096
  */
12097
12097
  function markVariableAsUsed(name, refNode) {
12098
- throw Error("`context.markVariableAsUsed` not implemented yet");
12098
+ throw Error("`sourceCode.markVariableAsUsed` not implemented yet");
12099
12099
  }
12100
12100
  //#endregion
12101
12101
  //#region src-js/plugins/tokens_methods.ts
@@ -13242,7 +13242,7 @@ function resetSettings() {
13242
13242
  }
13243
13243
  //#endregion
13244
13244
  //#region package.json
13245
- var version = "1.51.0";
13245
+ var version = "1.52.0";
13246
13246
  //#endregion
13247
13247
  //#region src-js/plugins/context.ts
13248
13248
  let filePath = null, cwd = null;
@@ -13392,20 +13392,24 @@ const FILE_CONTEXT = ObjectFreeze({
13392
13392
  * @returns `Context` object
13393
13393
  */
13394
13394
  function createContext(ruleDetails) {
13395
- return ObjectFreeze({
13396
- __proto__: FILE_CONTEXT,
13397
- get id() {
13398
- if (filePath === null) throw Error("Cannot access `context.id` in `createOnce`");
13399
- return ruleDetails.fullName;
13395
+ return ObjectPreventExtensions(ObjectCreate(FILE_CONTEXT, {
13396
+ id: {
13397
+ value: null,
13398
+ enumerable: !0,
13399
+ configurable: !0
13400
13400
  },
13401
- get options() {
13402
- if (filePath === null) throw Error("Cannot access `context.options` in `createOnce`");
13403
- return ruleDetails.options;
13401
+ options: {
13402
+ value: null,
13403
+ enumerable: !0,
13404
+ configurable: !0
13404
13405
  },
13405
- report(diagnostic, ...extraArgs) {
13406
- report(diagnostic, extraArgs, ruleDetails);
13406
+ report: {
13407
+ value(diagnostic, ...extraArgs) {
13408
+ report(diagnostic, extraArgs, ruleDetails);
13409
+ },
13410
+ enumerable: !0
13407
13411
  }
13408
- });
13412
+ }));
13409
13413
  }
13410
13414
  //#endregion
13411
13415
  //#region ../../node_modules/.pnpm/uri-js@4.4.1/node_modules/uri-js/dist/es5/uri.all.js
@@ -16480,9 +16484,9 @@ function setOptions(optionsJson) {
16480
16484
  */
16481
16485
  function processOptions(configOptions, ruleDetails) {
16482
16486
  let validator = ruleDetails.optionsSchemaValidator;
16483
- if (validator === null) throw Error(`Rule '${ruleDetails.fullName}' does not accept options`);
16487
+ if (validator === null) throw Error(`Rule '${ruleDetails.context.id}' does not accept options`);
16484
16488
  let { defaultOptions } = ruleDetails, options = defaultOptions === DEFAULT_OPTIONS ? configOptions : mergeOptions(configOptions, defaultOptions);
16485
- return validator !== !1 && validator(options, ruleDetails.fullName), deepFreezeJsonArray(options), options;
16489
+ return validator !== !1 && validator(options, ruleDetails.context.id), deepFreezeJsonArray(options), options;
16486
16490
  }
16487
16491
  /**
16488
16492
  * Merge user-provided options from config with rule's default options.
@@ -16598,7 +16602,6 @@ function registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) {
16598
16602
  }
16599
16603
  }
16600
16604
  let ruleDetails = {
16601
- fullName: fullRuleName,
16602
16605
  rule,
16603
16606
  context: null,
16604
16607
  isFixable,
@@ -16607,7 +16610,6 @@ function registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) {
16607
16610
  defaultOptions,
16608
16611
  optionsSchemaValidator: schemaValidator,
16609
16612
  ruleIndex: 0,
16610
- options: null,
16611
16613
  visitor: null,
16612
16614
  beforeHook: null,
16613
16615
  afterHook: null
@@ -16618,7 +16620,7 @@ function registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) {
16618
16620
  let { before: beforeHook, after: afterHook, ...visitor } = visitorWithHooks;
16619
16621
  beforeHook = conformHookFn(beforeHook, "before"), afterHook = conformHookFn(afterHook, "after"), ObjectKeys(visitor).length === 0 && (beforeHook = neverRunBeforeHook, afterHook = null), ruleDetails.visitor = visitor, ruleDetails.beforeHook = beforeHook, ruleDetails.afterHook = afterHook;
16620
16622
  }
16621
- registeredRules.push(ruleDetails);
16623
+ ObjectDefineProperty(ruleDetails.context, "id", { value: fullRuleName }), registeredRules.push(ruleDetails);
16622
16624
  }
16623
16625
  return {
16624
16626
  name: pluginName,
@@ -22209,28 +22211,16 @@ for (let i = 138; i !== 0; i--) compilingNonLeafVisitor.push({
22209
22211
  for (let i = 7; i !== 0; i--) compilingCfgVisitor.push([]);
22210
22212
  const compiledVisitor = [];
22211
22213
  for (let i = 172; i !== 0; i--) compiledVisitor.push(null);
22212
- const activeLeafVisitorTypeIds = [], activeNonLeafVisitorTypeIds = [], activeCfgVisitorTypeIds = [];
22213
- for (let i = 27; i !== 0; i--) activeLeafVisitorTypeIds.push(0);
22214
- for (let i = 138; i !== 0; i--) activeNonLeafVisitorTypeIds.push(0);
22215
- for (let i = 7; i !== 0; i--) activeCfgVisitorTypeIds.push(0);
22216
- activeLeafVisitorTypeIds.length = 0, activeNonLeafVisitorTypeIds.length = 0, activeCfgVisitorTypeIds.length = 0;
22217
- let hasActiveVisitors = !1;
22214
+ const activeTypeIdsBuffer = /* @__PURE__ */ new ArrayBuffer(172), activeLeafVisitorTypeIds = new Uint8Array(activeTypeIdsBuffer, 0, 27), activeNonLeafVisitorTypeIds = new Uint8Array(activeTypeIdsBuffer, 27, 138), activeCfgVisitorTypeIds = new Uint8Array(activeTypeIdsBuffer, 165, 7);
22215
+ let activeLeafVisitorsCount = 0, activeNonLeafVisitorsCount = 0, activeCfgVisitorsCount = 0, hasActiveVisitors = !1;
22218
22216
  const enterExitObjectCache = [];
22219
- let enterExitObjectCacheNextIndex = 0;
22217
+ for (let i = 138; i !== 0; i--) enterExitObjectCache.push({
22218
+ enter: null,
22219
+ exit: null
22220
+ });
22220
22221
  const visitPropsCache = [];
22221
22222
  let visitPropsCacheNextIndex = 0;
22222
22223
  /**
22223
- * Initialize compiled visitor, ready for calls to `addVisitor`.
22224
- */
22225
- function initCompiledVisitor() {
22226
- for (let i = 0; i < 172; i++) compiledVisitor[i] = null;
22227
- for (let i = 0; i < enterExitObjectCacheNextIndex; i++) {
22228
- let enterExit = enterExitObjectCache[i];
22229
- enterExit.enter = null, enterExit.exit = null;
22230
- }
22231
- enterExitObjectCacheNextIndex = 0;
22232
- }
22233
- /**
22234
22224
  * Add a visitor to compiled visitor.
22235
22225
  *
22236
22226
  * @param visitor - Visitor object
@@ -22238,39 +22228,40 @@ function initCompiledVisitor() {
22238
22228
  function addVisitorToCompiled(visitor) {
22239
22229
  if (typeof visitor != "object" || !visitor) throw TypeError("Visitor returned from `create` method must be an object");
22240
22230
  let keys = ObjectKeys(visitor), keysLen = keys.length;
22241
- if (keysLen !== 0) {
22242
- hasActiveVisitors = !0;
22243
- for (let i = 0; i < keysLen; i++) {
22244
- let name = keys[i], visitFn = visitor[name];
22245
- if (typeof visitFn != "function") throw TypeError(`'${name}' property of visitor object is not a function`);
22246
- let specificity = 0, isExit = name.endsWith(":exit");
22247
- isExit && (name = name.slice(0, -5), specificity = 536870912);
22248
- let visitProp;
22249
- visitPropsCacheNextIndex < visitPropsCache.length ? (visitProp = visitPropsCache[visitPropsCacheNextIndex], visitProp.fn = visitFn, visitProp.specificity = specificity, visitProp.selectorStr = name) : (visitProp = {
22250
- fn: visitFn,
22251
- specificity,
22252
- selectorStr: name
22253
- }, visitPropsCache.push(visitProp)), visitPropsCacheNextIndex++;
22254
- let typeId = NODE_TYPE_IDS_MAP.get(name);
22255
- if (typeId !== void 0) {
22256
- visitProp.specificity |= 1, typeId < 27 ? addLeafVisitFn(typeId, visitProp) : typeId < 165 ? addNonLeafVisitFn(typeId, visitProp, isExit) : addCfgVisitFn(typeId, visitProp, isExit);
22257
- continue;
22258
- }
22259
- if (name !== "*") {
22260
- let selector = parseSelector(name);
22261
- visitProp.specificity |= selector.specificity, selector.isComplex && (visitProp.fn = wrapVisitFnWithSelectorMatch(visitFn, selector.esquerySelector));
22262
- let { typeIds } = selector;
22263
- if (typeIds !== null) {
22264
- for (let i = 0, len = typeIds.length; i < len; i++) {
22265
- let typeId = typeIds[i];
22266
- typeId < 27 ? addLeafVisitFn(typeId, visitProp) : addNonLeafVisitFn(typeId, visitProp, isExit);
22267
- }
22268
- continue;
22231
+ if (keysLen === 0) return;
22232
+ hasActiveVisitors = !0;
22233
+ let visitPropsCacheRequiredLen = visitPropsCacheNextIndex + keysLen;
22234
+ for (; visitPropsCache.length < visitPropsCacheRequiredLen;) visitPropsCache.push({
22235
+ fn: null,
22236
+ specificity: 0,
22237
+ selectorStr: null
22238
+ });
22239
+ for (let i = 0; i < keysLen; i++) {
22240
+ let name = keys[i], visitFn = visitor[name];
22241
+ if (typeof visitFn != "function") throw TypeError(`'${name}' property of visitor object is not a function`);
22242
+ let specificity = 0, isExit = name.endsWith(":exit");
22243
+ isExit && (name = name.slice(0, -5), specificity = 536870912);
22244
+ let visitProp = visitPropsCache[visitPropsCacheNextIndex++];
22245
+ visitProp.fn = visitFn, visitProp.specificity = specificity, visitProp.selectorStr = name;
22246
+ let typeId = NODE_TYPE_IDS_MAP.get(name);
22247
+ if (typeId !== void 0) {
22248
+ visitProp.specificity |= 1, typeId < 27 ? addLeafVisitFn(typeId, visitProp) : typeId < 165 ? addNonLeafVisitFn(typeId, visitProp, isExit) : addCfgVisitFn(typeId, visitProp, isExit);
22249
+ continue;
22250
+ }
22251
+ if (name !== "*") {
22252
+ let selector = parseSelector(name);
22253
+ visitProp.specificity |= selector.specificity, selector.isComplex && (visitProp.fn = wrapVisitFnWithSelectorMatch(visitFn, selector.esquerySelector));
22254
+ let { typeIds } = selector;
22255
+ if (typeIds !== null) {
22256
+ for (let i = 0, len = typeIds.length; i < len; i++) {
22257
+ let typeId = typeIds[i];
22258
+ typeId < 27 ? addLeafVisitFn(typeId, visitProp) : addNonLeafVisitFn(typeId, visitProp, isExit);
22269
22259
  }
22260
+ continue;
22270
22261
  }
22271
- for (typeId = 0; typeId < 27; typeId++) addLeafVisitFn(typeId, visitProp);
22272
- for (; typeId < 165; typeId++) addNonLeafVisitFn(typeId, visitProp, isExit);
22273
22262
  }
22263
+ for (typeId = 0; typeId < 27; typeId++) addLeafVisitFn(typeId, visitProp);
22264
+ for (; typeId < 165; typeId++) addNonLeafVisitFn(typeId, visitProp, isExit);
22274
22265
  }
22275
22266
  }
22276
22267
  /**
@@ -22283,7 +22274,7 @@ function addVisitorToCompiled(visitor) {
22283
22274
  */
22284
22275
  function addLeafVisitFn(typeId, visitProp) {
22285
22276
  let visitProps = compilingLeafVisitor[typeId];
22286
- visitProps.length === 0 && activeLeafVisitorTypeIds.push(typeId), visitProps.push(visitProp);
22277
+ visitProps.length === 0 && (activeLeafVisitorTypeIds[activeLeafVisitorsCount++] = typeId), visitProps.push(visitProp);
22287
22278
  }
22288
22279
  /**
22289
22280
  * Add visit function for a non-leaf node to compiled visitor.
@@ -22296,7 +22287,7 @@ function addLeafVisitFn(typeId, visitProp) {
22296
22287
  */
22297
22288
  function addNonLeafVisitFn(typeId, visitProp, isExit) {
22298
22289
  let { enter, exit } = compilingNonLeafVisitor[typeId - 27];
22299
- enter.length === 0 && exit.length === 0 && activeNonLeafVisitorTypeIds.push(typeId), isExit ? exit.push(visitProp) : enter.push(visitProp);
22290
+ enter.length === 0 && exit.length === 0 && (activeNonLeafVisitorTypeIds[activeNonLeafVisitorsCount++] = typeId), isExit ? exit.push(visitProp) : enter.push(visitProp);
22300
22291
  }
22301
22292
  /**
22302
22293
  * Add visit function for a CFG event to compiled visitor.
@@ -22310,7 +22301,7 @@ function addNonLeafVisitFn(typeId, visitProp, isExit) {
22310
22301
  function addCfgVisitFn(typeId, visitProp, isExit) {
22311
22302
  if (isExit) throw Error(`Invalid visitor key: \`${visitProp.selectorStr}:exit\``);
22312
22303
  let visitProps = compilingCfgVisitor[typeId - 165];
22313
- visitProps.length === 0 && activeCfgVisitorTypeIds.push(typeId), visitProps.push(visitProp);
22304
+ visitProps.length === 0 && (activeCfgVisitorTypeIds[activeCfgVisitorsCount++] = typeId), visitProps.push(visitProp);
22314
22305
  }
22315
22306
  /**
22316
22307
  * Finalize compiled visitor.
@@ -22321,32 +22312,42 @@ function addCfgVisitFn(typeId, visitProp, isExit) {
22321
22312
  */
22322
22313
  function finalizeCompiledVisitor() {
22323
22314
  if (hasActiveVisitors === !1) return 0;
22324
- for (let i = activeLeafVisitorTypeIds.length - 1; i >= 0; i--) {
22315
+ for (let i = activeLeafVisitorsCount - 1; i >= 0; i--) {
22325
22316
  let typeId = activeLeafVisitorTypeIds[i];
22326
22317
  compiledVisitor[typeId] = mergeVisitFns(compilingLeafVisitor[typeId]);
22327
22318
  }
22328
- for (let i = activeNonLeafVisitorTypeIds.length - 1; i >= 0; i--) {
22329
- let typeId = activeNonLeafVisitorTypeIds[i], entry = compilingNonLeafVisitor[typeId - 27], enterExit;
22330
- enterExitObjectCacheNextIndex < enterExitObjectCache.length ? enterExit = enterExitObjectCache[enterExitObjectCacheNextIndex] : (enterExit = {
22331
- enter: null,
22332
- exit: null
22333
- }, enterExitObjectCache.push(enterExit)), enterExitObjectCacheNextIndex++;
22334
- let enterArr = entry.enter;
22319
+ for (let i = 0; i < activeNonLeafVisitorsCount; i++) {
22320
+ let typeId = activeNonLeafVisitorTypeIds[i], entry = compilingNonLeafVisitor[typeId - 27], enterExit = enterExitObjectCache[i], enterArr = entry.enter;
22335
22321
  enterArr.length !== 0 && (enterExit.enter = mergeVisitFns(enterArr));
22336
22322
  let exitArr = entry.exit;
22337
22323
  exitArr.length !== 0 && (enterExit.exit = mergeVisitFns(exitArr)), compiledVisitor[typeId] = enterExit;
22338
22324
  }
22339
22325
  let visitState = 1;
22340
- if (activeCfgVisitorTypeIds.length > 0) {
22326
+ if (activeCfgVisitorsCount > 0) {
22341
22327
  visitState = 2;
22342
- for (let i = activeCfgVisitorTypeIds.length - 1; i >= 0; i--) {
22328
+ for (let i = activeCfgVisitorsCount - 1; i >= 0; i--) {
22343
22329
  let typeId = activeCfgVisitorTypeIds[i];
22344
22330
  compiledVisitor[typeId] = mergeCfgVisitFns(compilingCfgVisitor[typeId - 165]);
22345
22331
  }
22346
- activeCfgVisitorTypeIds.length = 0;
22332
+ activeCfgVisitorsCount = 0;
22347
22333
  }
22348
22334
  for (let i = visitPropsCacheNextIndex - 1; i >= 0; i--) visitPropsCache[i].fn = null, visitPropsCache[i].selectorStr = null;
22349
- return visitPropsCacheNextIndex = 0, activeLeafVisitorTypeIds.length = 0, activeNonLeafVisitorTypeIds.length = 0, hasActiveVisitors = !1, visitState;
22335
+ return visitPropsCacheNextIndex = 0, activeLeafVisitorsCount = 0, hasActiveVisitors = !1, visitState;
22336
+ }
22337
+ /**
22338
+ * Reset compiled visitor.
22339
+ *
22340
+ * This frees visit functions stored in `compiledVisitor`, and makes them eligible for garbage collection.
22341
+ *
22342
+ * After calling this function, `compiledVisitor` is in a clean state, ready for next file's visitor to be compiled.
22343
+ */
22344
+ function resetCompiledVisitor() {
22345
+ compiledVisitor.fill(null);
22346
+ for (let i = 0; i < activeNonLeafVisitorsCount; i++) {
22347
+ let enterExit = enterExitObjectCache[i];
22348
+ enterExit.enter = null, enterExit.exit = null;
22349
+ }
22350
+ activeNonLeafVisitorsCount = 0;
22350
22351
  }
22351
22352
  const visitFns = [];
22352
22353
  /**
@@ -22519,12 +22520,12 @@ function lintFileImpl(filePath, bufferId, buffer, ruleIds, optionsIds, settingsJ
22519
22520
  }
22520
22521
  workspaceUri !== null && switchWorkspace(workspaceUri), setupFileContext(filePath);
22521
22522
  let hasBOM = buffer[2147483614] === 1;
22522
- setupSourceForFile(buffer, hasBOM), setSettingsForFile(settingsJSON), setGlobalsForFile(globalsJSON), initCompiledVisitor();
22523
+ setupSourceForFile(buffer, hasBOM), setSettingsForFile(settingsJSON), setGlobalsForFile(globalsJSON);
22523
22524
  for (let i = 0, len = ruleIds.length; i < len; i++) {
22524
22525
  let ruleDetails = registeredRules[ruleIds[i]];
22525
22526
  ruleDetails.ruleIndex = i;
22526
22527
  let optionsId = optionsIds[i];
22527
- ruleDetails.options = optionsId === 0 ? ruleDetails.defaultOptions : allOptions[optionsId];
22528
+ ObjectDefineProperty(ruleDetails.context, "options", { value: optionsId === 0 ? ruleDetails.defaultOptions : allOptions[optionsId] });
22528
22529
  let { visitor } = ruleDetails;
22529
22530
  if (visitor === null) visitor = ruleDetails.rule.create(ruleDetails.context);
22530
22531
  else {
@@ -22535,12 +22536,35 @@ function lintFileImpl(filePath, bufferId, buffer, ruleIds, optionsIds, settingsJ
22535
22536
  addVisitorToCompiled(visitor);
22536
22537
  }
22537
22538
  let visitorState = finalizeCompiledVisitor();
22538
- visitorState !== 0 && (ast === null && initAst(), visitorState === 2 ? walkProgramWithCfg(ast, compiledVisitor) : walkProgram(ast, compiledVisitor));
22539
+ visitorState !== 0 && (ast === null && initAst(), visitorState === 2 ? walkProgramWithCfg(ast, compiledVisitor) : walkProgram(ast, compiledVisitor), resetCompiledVisitor()), runAfterHooks(!0);
22540
+ }
22541
+ /**
22542
+ * Run any `after` hooks.
22543
+ *
22544
+ * Rules using `before` and `after` hooks likely maintain some internal state in their `createOnce` method.
22545
+ * To keep that state in sync, it's critical that `after` hooks always run, even if an error is thrown during any of:
22546
+ *
22547
+ * 1. A later rule's `before` hook.
22548
+ * 2. AST walk.
22549
+ * 3. An earlier rule's `after` hook.
22550
+ *
22551
+ * So if any `after` hook throws an error, this function continues running remaining hooks, and re-throws the error
22552
+ * only at the very end. This ensures an error in one rule does not affect any other rules.
22553
+ *
22554
+ * This function is called by `resetStateAfterError` to ensure `after` hooks are run no matter where an error occurs.
22555
+ *
22556
+ * @param shouldThrowIfError - `true` if any errors thrown in after hooks should be re-thrown
22557
+ */
22558
+ function runAfterHooks(shouldThrowIfError) {
22539
22559
  let afterHooksLen = afterHooks.length;
22540
- if (afterHooksLen !== 0) {
22541
- for (let i = 0; i < afterHooksLen; i++) (0, afterHooks[i])();
22542
- afterHooks.length = 0;
22560
+ if (afterHooksLen === 0) return;
22561
+ let error, didError = !1;
22562
+ for (let i = 0; i < afterHooksLen; i++) try {
22563
+ (0, afterHooks[i])();
22564
+ } catch (err) {
22565
+ didError === !1 && (error = err, didError = !0);
22543
22566
  }
22567
+ if (afterHooks.length = 0, didError && shouldThrowIfError) throw error;
22544
22568
  }
22545
22569
  /**
22546
22570
  * Reset file context, source, AST, and settings, to free memory.
@@ -22553,7 +22577,7 @@ function resetFile() {
22553
22577
  * in the correct initial state for linting the next file.
22554
22578
  */
22555
22579
  function resetStateAfterError() {
22556
- diagnostics.length = 0, ancestors.length = 0, resetFile(), resetCfgWalk();
22580
+ runAfterHooks(!1), finalizeCompiledVisitor(), resetCompiledVisitor(), diagnostics.length = 0, ancestors.length = 0, resetFile(), resetCfgWalk();
22557
22581
  }
22558
22582
  //#endregion
22559
22583
  export { BUFFER_SIZE as _, loadPlugin as a, __toESM as b, allOptions as c, diagnostics as d, replacePlaceholders as f, BUFFER_ALIGN as g, ACTIVE_SIZE as h, resetStateAfterError as i, setOptions as l, getNodeByRangeIndex as m, lintFile as n, registerPlugin as o, getLineColumnFromOffset as p, lintFileImpl as r, registeredRules as s, buffers as t, PLACEHOLDER_REGEX as u, DATA_POINTER_POS_32 as v, __commonJSMin as y };
Binary file
@@ -1,6 +1,6 @@
1
1
  import { _ as BUFFER_SIZE, b as __toESM, c as allOptions, d as diagnostics, f as replacePlaceholders, g as BUFFER_ALIGN, h as ACTIVE_SIZE, i as resetStateAfterError, l as setOptions, m as getNodeByRangeIndex, o as registerPlugin, p as getLineColumnFromOffset, r as lintFileImpl, s as registeredRules, t as buffers, u as PLACEHOLDER_REGEX, y as __commonJSMin } from "./lint.js";
2
2
  import { a as rawTransferSupported$1, i as parseRawSync, n as getBufferOffset, t as applyFixes } from "./bindings.js";
3
- import { d as ObjectDefineProperty, f as ObjectEntries, g as ObjectValues, h as ObjectKeys, m as ObjectHasOwn, n as ArrayFrom, o as JSONStringify, r as ArrayIsArray } from "./utils.js";
3
+ import { _ as ObjectValues, d as ObjectDefineProperty, f as ObjectEntries, h as ObjectKeys, m as ObjectHasOwn, n as ArrayFrom, o as JSONStringify, r as ArrayIsArray } from "./utils.js";
4
4
  import assert, { AssertionError } from "node:assert";
5
5
  import { dirname, isAbsolute, join } from "node:path";
6
6
  import util from "node:util";
package/dist/utils.js CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * See TSDown config file for more details.
10
10
  */
11
- const { prototype: ObjectPrototype, hasOwn: ObjectHasOwn, keys: ObjectKeys, values: ObjectValues, freeze: ObjectFreeze, defineProperty: ObjectDefineProperty, defineProperties: ObjectDefineProperties, create: ObjectCreate, assign: ObjectAssign, getPrototypeOf: ObjectGetPrototypeOf, setPrototypeOf: ObjectSetPrototypeOf, entries: ObjectEntries } = Object, { prototype: ArrayPrototype, isArray: ArrayIsArray, from: ArrayFrom } = Array, { min: MathMin, max: MathMax, floor: MathFloor } = Math, { parse: JSONParse, stringify: JSONStringify } = JSON, { ownKeys: ReflectOwnKeys } = Reflect, { iterator: SymbolIterator } = Symbol, { fromCodePoint: StringFromCodePoint } = String, { now: DateNow } = Date;
11
+ const { prototype: ObjectPrototype, hasOwn: ObjectHasOwn, keys: ObjectKeys, values: ObjectValues, freeze: ObjectFreeze, preventExtensions: ObjectPreventExtensions, defineProperty: ObjectDefineProperty, defineProperties: ObjectDefineProperties, create: ObjectCreate, assign: ObjectAssign, getPrototypeOf: ObjectGetPrototypeOf, setPrototypeOf: ObjectSetPrototypeOf, entries: ObjectEntries } = Object, { prototype: ArrayPrototype, isArray: ArrayIsArray, from: ArrayFrom } = Array, { min: MathMin, max: MathMax, floor: MathFloor } = Math, { parse: JSONParse, stringify: JSONStringify } = JSON, { ownKeys: ReflectOwnKeys } = Reflect, { iterator: SymbolIterator } = Symbol, { fromCodePoint: StringFromCodePoint } = String, { now: DateNow } = Date;
12
12
  //#endregion
13
13
  //#region src-js/utils/utils.ts
14
14
  /**
@@ -41,4 +41,4 @@ function getErrorMessage(err) {
41
41
  return "Unknown error";
42
42
  }
43
43
  //#endregion
44
- export { StringFromCodePoint as _, JSONParse as a, MathMin as c, ObjectDefineProperty as d, ObjectEntries as f, ObjectValues as g, ObjectKeys as h, DateNow as i, ObjectAssign as l, ObjectHasOwn as m, ArrayFrom as n, JSONStringify as o, ObjectFreeze as p, ArrayIsArray as r, MathMax as s, getErrorMessage as t, ObjectCreate as u, SymbolIterator as v };
44
+ export { ObjectValues as _, JSONParse as a, MathMin as c, ObjectDefineProperty as d, ObjectEntries as f, ObjectPreventExtensions as g, ObjectKeys as h, DateNow as i, ObjectAssign as l, ObjectHasOwn as m, ArrayFrom as n, JSONStringify as o, ObjectFreeze as p, ArrayIsArray as r, MathMax as s, getErrorMessage as t, ObjectCreate as u, StringFromCodePoint as v, SymbolIterator as y };
package/package.json CHANGED
@@ -1,31 +1,25 @@
1
1
  {
2
2
  "name": "oxlint-react-compiler-experimental",
3
- "version": "0.0.5",
4
- "description": "Linter for the JavaScript Oxidation Compiler (React Compiler Experimental)",
3
+ "version": "0.0.7",
4
+ "description": "Experimental oxlint with React Compiler rules (darwin-arm64 only)",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "javascript",
8
8
  "linter",
9
9
  "oxc",
10
10
  "oxlint",
11
- "react-compiler",
12
- "typescript"
11
+ "typescript",
12
+ "react-compiler"
13
13
  ],
14
- "homepage": "https://oxc.rs/docs/guide/usage/linter",
15
- "bugs": "https://github.com/oxc-project/oxc/issues",
16
14
  "license": "MIT",
17
15
  "author": "Boshen and oxc contributors",
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/nicksrandall/oxc.git",
21
- "directory": "npm/oxlint"
22
- },
23
16
  "bin": {
24
17
  "oxlint": "bin/oxlint"
25
18
  },
26
19
  "files": [
27
20
  "configuration_schema.json",
28
21
  "dist",
22
+ "README.md",
29
23
  "bin/oxlint"
30
24
  ],
31
25
  "type": "module",
@@ -41,6 +35,13 @@
41
35
  "default": "./dist/plugins-dev.js"
42
36
  }
43
37
  },
38
+ "napi": {
39
+ "binaryName": "oxlint",
40
+ "packageName": "@oxlint/binding",
41
+ "targets": [
42
+ "aarch64-apple-darwin"
43
+ ]
44
+ },
44
45
  "os": ["darwin"],
45
46
  "cpu": ["arm64"],
46
47
  "engines": {