oxlint 1.62.0 → 1.64.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.
@@ -1,4 +1,4 @@
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";
1
+ import { _ as BLOCK_SIZE, b as __commonJSMin, c as allOptions, d as diagnostics, f as replacePlaceholders, g as BLOCK_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, v as BUFFER_SIZE, x as __toESM } from "./lint.js";
2
2
  import { _ as ObjectValues, a as JSONStringify, d as ObjectEntries, m as ObjectKeys, n as ArrayIsArray, p as ObjectHasOwn, t as ArrayFrom, u as ObjectDefineProperty } from "./globals.js";
3
3
  import { a as rawTransferSupported$1, i as parseRawSync, n as getBufferOffset, t as applyFixes } from "./bindings.js";
4
4
  import assert, { AssertionError } from "node:assert";
@@ -63,8 +63,8 @@ var import_json_stable_stringify_without_jsonify = /* @__PURE__ */ __toESM((/* @
63
63
  return keys;
64
64
  };
65
65
  })))(), 1);
66
- const ARRAY_BUFFER_SIZE = BUFFER_SIZE + BUFFER_ALIGN, textEncoder = new TextEncoder();
67
- let buffer = null, rawTransferIsSupported = null;
66
+ const ARRAY_BUFFER_SIZE = BLOCK_SIZE + BLOCK_ALIGN, textEncoder = new TextEncoder();
67
+ let buffer = null, blockBuffer = null, rawTransferIsSupported = null;
68
68
  /**
69
69
  * Parser source text into buffer.
70
70
  * @param path - Path of file to parse
@@ -79,7 +79,7 @@ function parse(path, sourceText, options) {
79
79
  if (maxSourceByteLen > 1073741824) throw Error("Source text is too long");
80
80
  let sourceStartPos = ACTIVE_SIZE - maxSourceByteLen, sourceBuffer = new Uint8Array(buffer.buffer, buffer.byteOffset + sourceStartPos, maxSourceByteLen), { read, written: sourceByteLen } = textEncoder.encodeInto(sourceText, sourceBuffer);
81
81
  if (read !== sourceText.length) throw Error("Failed to write source text into buffer");
82
- if (parseRawSync(path, buffer, sourceStartPos, sourceByteLen, options), buffer.int32[536870900] === 0) throw Error("Parsing failed");
82
+ if (parseRawSync(path, blockBuffer, sourceStartPos, sourceByteLen, options), buffer.int32[536870890] === 0) throw Error("Parsing failed");
83
83
  }
84
84
  /**
85
85
  * Create a `Uint8Array` which is 2 GiB in size, with its start aligned on 4 GiB.
@@ -92,13 +92,19 @@ function parse(path, sourceText, options) {
92
92
  * It's always possible to obtain a 2 GiB slice aligned on 4 GiB within a 6 GiB buffer,
93
93
  * no matter how the 6 GiB buffer is aligned.
94
94
  *
95
+ * `buffer` itself, and `int32` and `float64` views of `buffer`, are `BUFFER_SIZE` bytes,
96
+ * which excludes `FixedSizeAllocatorMetadata` and `ChunkFooter`.
97
+ * This ensures this critical data cannot be accidentally overwritten on JS side.
98
+ * `blockBuffer` is `BLOCK_SIZE` bytes, which includes `FixedSizeAllocatorMetadata` and `ChunkFooter`.
99
+ * `blockBuffer` is what we pass to Rust, which needs to write them.
100
+ *
95
101
  * Note: On systems with virtual memory, this only consumes 6 GiB of *virtual* memory.
96
102
  * It does not consume physical memory until data is actually written to the `Uint8Array`.
97
103
  * Physical memory consumed corresponds to the quantity of data actually written.
98
104
  */
99
105
  function initBuffer() {
100
106
  let arrayBuffer = new ArrayBuffer(ARRAY_BUFFER_SIZE), offset = getBufferOffset(new Uint8Array(arrayBuffer));
101
- buffer = new Uint8Array(arrayBuffer, offset, BUFFER_SIZE), buffer.int32 = new Int32Array(arrayBuffer, offset, BUFFER_SIZE / 4), buffer.float64 = new Float64Array(arrayBuffer, offset, BUFFER_SIZE / 8), buffers.push(buffer);
107
+ buffer = new Uint8Array(arrayBuffer, offset, BUFFER_SIZE), buffer.int32 = new Int32Array(arrayBuffer, offset, BUFFER_SIZE / 4), buffer.float64 = new Float64Array(arrayBuffer, offset, BUFFER_SIZE / 8), blockBuffer = new Uint8Array(arrayBuffer, offset, BLOCK_SIZE), buffers.push(buffer);
102
108
  }
103
109
  /**
104
110
  * Returns `true` if raw transfer is supported.
@@ -353,14 +359,14 @@ function assertInvalidTestCasePasses(test, plugin, config) {
353
359
  typeof error == "string" || error instanceof RegExp ? (assertMessageMatches(diagnostic.message, error), assert(diagnostic.suggestions === null, `Error at index ${errorIndex} has suggestions. Please convert the test error into an object and specify \`suggestions\` property on it to test suggestions`)) : (assertInvalidTestCaseMessageIsCorrect(diagnostic, error, messages), assertInvalidTestCaseLocationIsCorrect(diagnostic, error, test), ObjectHasOwn(error, "suggestions") && (error.suggestions == null ? assert(diagnostic.suggestions === null, "Rule produced suggestions") : assertSuggestionsAreCorrect(diagnostic, error, messages, test)));
354
360
  }
355
361
  }
356
- let { code } = test, eslintCompat = test.eslintCompat === !0, fixedCode = runFixes(diagnostics, code, eslintCompat);
362
+ let { code } = test, fixedCode = runFixes(diagnostics, code);
357
363
  fixedCode === null && (fixedCode = code);
358
364
  let { recursive } = test, extraPassCount = typeof recursive == "number" ? recursive : recursive === !0 ? 10 : 0;
359
365
  if (extraPassCount > 0 && fixedCode !== code) for (let pass = 0; pass < extraPassCount; pass++) {
360
366
  let newFixedCode = runFixes(lint({
361
367
  ...test,
362
368
  code: fixedCode
363
- }, plugin), fixedCode, eslintCompat);
369
+ }, plugin), fixedCode);
364
370
  if (newFixedCode === null) break;
365
371
  fixedCode = newFixedCode;
366
372
  }
@@ -378,11 +384,11 @@ function assertInvalidTestCasePasses(test, plugin, config) {
378
384
  * @returns Fixed code, or `null` if no fixes to apply
379
385
  * @throws {Error} If error when applying fixes
380
386
  */
381
- function runFixes(diagnostics, code, eslintCompat) {
387
+ function runFixes(diagnostics, code) {
382
388
  let fixGroups = [];
383
389
  for (let diagnostic of diagnostics) diagnostic.fixes !== null && fixGroups.push(diagnostic.fixes);
384
390
  if (fixGroups.length === 0) return null;
385
- let fixedCode = applyFixes(code, JSONStringify(fixGroups), eslintCompat);
391
+ let fixedCode = applyFixes(code, JSONStringify(fixGroups));
386
392
  if (fixedCode === null) throw Error("Failed to apply fixes");
387
393
  return fixedCode;
388
394
  }
@@ -448,11 +454,10 @@ function assertInvalidTestCaseLocationIsCorrect(diagnostic, error, test) {
448
454
  function assertSuggestionsAreCorrect(diagnostic, error, messages, test) {
449
455
  let actualSuggestions = diagnostic.suggestions ?? [], expectedSuggestions = error.suggestions;
450
456
  assert.strictEqual(actualSuggestions.length, expectedSuggestions.length, `Error should have ${expectedSuggestions.length} suggestion${expectedSuggestions.length > 1 ? "s" : ""}. Instead found ${actualSuggestions.length} suggestion${actualSuggestions.length > 1 ? "s" : ""}.`);
451
- let eslintCompat = test.eslintCompat === !0;
452
457
  for (let i = 0; i < expectedSuggestions.length; i++) {
453
458
  let actual = actualSuggestions[i], expected = expectedSuggestions[i], prefix = `Suggestion at index ${i}`;
454
459
  assertSuggestionMessageIsCorrect(actual, expected, messages, prefix), assert(ObjectHasOwn(expected, "output"), `${prefix}: \`output\` property is required`);
455
- let suggestedCode = applyFixes(test.code, JSONStringify([actual.fixes]), eslintCompat);
460
+ let suggestedCode = applyFixes(test.code, JSONStringify([actual.fixes]));
456
461
  assert(suggestedCode !== null, `${prefix}: Failed to apply suggestion fix`), assert.strictEqual(suggestedCode, expected.output, `${prefix}: Expected the applied suggestion fix to match the test suggestion output`), assert.notStrictEqual(expected.output, test.code, `${prefix}: The output of a suggestion should differ from the original source code`);
457
462
  }
458
463
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint",
3
- "version": "1.62.0",
3
+ "version": "1.64.0",
4
4
  "description": "Linter for the JavaScript Oxidation Compiler",
5
5
  "keywords": [
6
6
  "eslint",
@@ -46,7 +46,7 @@
46
46
  "./package.json": "./package.json"
47
47
  },
48
48
  "peerDependencies": {
49
- "oxlint-tsgolint": ">=0.18.0"
49
+ "oxlint-tsgolint": ">=0.22.1"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "oxlint-tsgolint": {
@@ -83,24 +83,24 @@
83
83
  },
84
84
  "preferUnplugged": true,
85
85
  "optionalDependencies": {
86
- "@oxlint/binding-darwin-arm64": "1.62.0",
87
- "@oxlint/binding-android-arm64": "1.62.0",
88
- "@oxlint/binding-win32-arm64-msvc": "1.62.0",
89
- "@oxlint/binding-linux-arm64-gnu": "1.62.0",
90
- "@oxlint/binding-linux-arm64-musl": "1.62.0",
91
- "@oxlint/binding-openharmony-arm64": "1.62.0",
92
- "@oxlint/binding-android-arm-eabi": "1.62.0",
93
- "@oxlint/binding-linux-arm-gnueabihf": "1.62.0",
94
- "@oxlint/binding-linux-arm-musleabihf": "1.62.0",
95
- "@oxlint/binding-win32-ia32-msvc": "1.62.0",
96
- "@oxlint/binding-linux-ppc64-gnu": "1.62.0",
97
- "@oxlint/binding-linux-riscv64-gnu": "1.62.0",
98
- "@oxlint/binding-linux-riscv64-musl": "1.62.0",
99
- "@oxlint/binding-linux-s390x-gnu": "1.62.0",
100
- "@oxlint/binding-darwin-x64": "1.62.0",
101
- "@oxlint/binding-win32-x64-msvc": "1.62.0",
102
- "@oxlint/binding-freebsd-x64": "1.62.0",
103
- "@oxlint/binding-linux-x64-gnu": "1.62.0",
104
- "@oxlint/binding-linux-x64-musl": "1.62.0"
86
+ "@oxlint/binding-darwin-arm64": "1.64.0",
87
+ "@oxlint/binding-android-arm64": "1.64.0",
88
+ "@oxlint/binding-win32-arm64-msvc": "1.64.0",
89
+ "@oxlint/binding-linux-arm64-gnu": "1.64.0",
90
+ "@oxlint/binding-linux-arm64-musl": "1.64.0",
91
+ "@oxlint/binding-openharmony-arm64": "1.64.0",
92
+ "@oxlint/binding-android-arm-eabi": "1.64.0",
93
+ "@oxlint/binding-linux-arm-gnueabihf": "1.64.0",
94
+ "@oxlint/binding-linux-arm-musleabihf": "1.64.0",
95
+ "@oxlint/binding-win32-ia32-msvc": "1.64.0",
96
+ "@oxlint/binding-linux-ppc64-gnu": "1.64.0",
97
+ "@oxlint/binding-linux-riscv64-gnu": "1.64.0",
98
+ "@oxlint/binding-linux-riscv64-musl": "1.64.0",
99
+ "@oxlint/binding-linux-s390x-gnu": "1.64.0",
100
+ "@oxlint/binding-darwin-x64": "1.64.0",
101
+ "@oxlint/binding-win32-x64-msvc": "1.64.0",
102
+ "@oxlint/binding-freebsd-x64": "1.64.0",
103
+ "@oxlint/binding-linux-x64-gnu": "1.64.0",
104
+ "@oxlint/binding-linux-x64-musl": "1.64.0"
105
105
  }
106
106
  }