oxlint 1.68.0 → 1.70.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 +2 -0
- package/configuration_schema.json +16381 -2112
- package/dist/bindings.js +38 -33
- package/dist/index.d.ts +5525 -802
- package/dist/js_config.js +2 -3
- package/dist/lint.js +162 -140
- package/dist/plugins-dev.d.ts +45 -16
- package/dist/plugins-dev.js +1 -1
- package/package.json +20 -20
- package/dist/globals.js +0 -13
package/dist/lint.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as JSONStringify, c as ObjectAssign, f as ObjectFreeze, g as ObjectPrototype, h as ObjectPreventExtensions, i as JSONParse, l as ObjectCreate, m as ObjectKeys, n as ArrayIsArray, o as MathMax, p as ObjectHasOwn, s as MathMin, u as ObjectDefineProperty, v as StringFromCodePoint, y as SymbolIterator } from "./globals.js";
|
|
2
1
|
import { a as setCurrentWorkspace, n as currentWorkspace, o as workspaces, r as currentWorkspaceUri } from "./workspace2.js";
|
|
3
2
|
import { t as getErrorMessage } from "./utils.js";
|
|
4
3
|
import { createRequire } from "node:module";
|
|
@@ -330,7 +329,7 @@ var keys_default = freeze({
|
|
|
330
329
|
});
|
|
331
330
|
//#endregion
|
|
332
331
|
//#region src-js/plugins/location.ts
|
|
333
|
-
const LINE_BREAK_PATTERN = /\r\n|[\r\n\u2028\u2029]/gu, lines = [], lineStartIndices = [0], cachedLocations = [];
|
|
332
|
+
const ObjectDefineProperty$4 = Object.defineProperty, ArrayIsArray$6 = Array.isArray, LINE_BREAK_PATTERN = /\r\n|[\r\n\u2028\u2029]/gu, lines = [], lineStartIndices = [0], cachedLocations = [];
|
|
334
333
|
let activeLocationsCount = 0;
|
|
335
334
|
/**
|
|
336
335
|
* Split source text into lines.
|
|
@@ -422,7 +421,7 @@ function getLoc(nodeOrToken) {
|
|
|
422
421
|
*/
|
|
423
422
|
function getNodeLoc(node) {
|
|
424
423
|
let loc = computeLoc(node.start, node.end);
|
|
425
|
-
return LOC_DESCRIPTOR.value = loc, ObjectDefineProperty(node, "loc", LOC_DESCRIPTOR), loc;
|
|
424
|
+
return LOC_DESCRIPTOR.value = loc, ObjectDefineProperty$4(node, "loc", LOC_DESCRIPTOR), loc;
|
|
426
425
|
}
|
|
427
426
|
const LOC_DESCRIPTOR = {
|
|
428
427
|
value: null,
|
|
@@ -487,7 +486,7 @@ function traverse(node) {
|
|
|
487
486
|
let keys = keys_default[node.type];
|
|
488
487
|
for (let keyIndex = 0, keysLen = keys.length; keyIndex < keysLen; keyIndex++) {
|
|
489
488
|
let child = node[keys[keyIndex]];
|
|
490
|
-
if (ArrayIsArray(child)) for (let arrIndex = 0, arrLen = child.length; arrIndex < arrLen; arrIndex++) {
|
|
489
|
+
if (ArrayIsArray$6(child)) for (let arrIndex = 0, arrLen = child.length; arrIndex < arrLen; arrIndex++) {
|
|
491
490
|
let entry = child[arrIndex];
|
|
492
491
|
if (entry !== null) {
|
|
493
492
|
if (entry.start > index) break;
|
|
@@ -503,22 +502,26 @@ function traverse(node) {
|
|
|
503
502
|
}
|
|
504
503
|
//#endregion
|
|
505
504
|
//#region src-js/utils/typed_arrays.ts
|
|
506
|
-
const EMPTY_UINT8_ARRAY = new Uint8Array(), EMPTY_INT32_ARRAY = new Int32Array();
|
|
507
|
-
//#endregion
|
|
508
|
-
//#region src-js/plugins/tokens.ts
|
|
505
|
+
const EMPTY_UINT8_ARRAY = new Uint8Array(), EMPTY_INT32_ARRAY = new Int32Array(), FunctionPrototypeCall$1 = Function.prototype.call, ObjectPrototype__defineGetter__$1 = Object.prototype.__defineGetter__, MathMax$4 = Math.max, StringFromCodePoint$1 = String.fromCodePoint;
|
|
509
506
|
let tokens = null, tokensUint8 = null, tokensInt32 = null, tokensLen = 0, allTokensDeserialized = !1;
|
|
510
507
|
const cachedTokens = [];
|
|
511
508
|
let previousTokens = [];
|
|
512
509
|
const tokensWithLoc = [];
|
|
513
510
|
let activeTokensWithLocCount = 0;
|
|
514
511
|
const regexObjects = [];
|
|
515
|
-
let tokensWithRegexIndexes = EMPTY_INT32_ARRAY, activeTokensWithRegexCount = 0, deserializedTokenIndexes = EMPTY_INT32_ARRAY, deserializedTokensLen = 0
|
|
512
|
+
let tokensWithRegexIndexes = EMPTY_INT32_ARRAY, activeTokensWithRegexCount = 0, deserializedTokenIndexes = EMPTY_INT32_ARRAY, deserializedTokensLen = 0;
|
|
513
|
+
const defineGetter$1 = FunctionPrototypeCall$1.bind(ObjectPrototype__defineGetter__$1);
|
|
514
|
+
let getTokenLocTemp, resetLocTemp;
|
|
516
515
|
/**
|
|
517
516
|
* Token implementation with lazy `loc` caching via private field.
|
|
518
517
|
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
518
|
+
* `loc` is defined as an own accessor property via `__defineGetter__` in the constructor,
|
|
519
|
+
* using a shared getter function (`getTokenLoc`). This makes `loc` an own enumerable property,
|
|
520
|
+
* so `{...token}` spreads it and `JSON.stringify(token)` serializes it.
|
|
521
|
+
*
|
|
522
|
+
* The computed `Location` value is cached in the private `#loc` field on first access.
|
|
523
|
+
* All instances share the same getter function, keeping the V8 hidden class transition
|
|
524
|
+
* identical across instances. Reset only clears the `#loc` field.
|
|
522
525
|
*/
|
|
523
526
|
var Token = class {
|
|
524
527
|
type = null;
|
|
@@ -528,24 +531,19 @@ var Token = class {
|
|
|
528
531
|
end = 0;
|
|
529
532
|
range = [0, 0];
|
|
530
533
|
#loc = null;
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return loc === null ? (activeTokensWithLocCount < tokensWithLoc.length ? tokensWithLoc[activeTokensWithLocCount] = this : tokensWithLoc.push(this), activeTokensWithLocCount++, this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
534
|
-
}
|
|
535
|
-
toJSON() {
|
|
536
|
-
return {
|
|
537
|
-
...this,
|
|
538
|
-
loc: this.loc
|
|
539
|
-
};
|
|
534
|
+
constructor() {
|
|
535
|
+
defineGetter$1(this, "loc", getTokenLoc);
|
|
540
536
|
}
|
|
541
537
|
static {
|
|
542
|
-
|
|
538
|
+
getTokenLocTemp = function() {
|
|
539
|
+
let loc = this.#loc;
|
|
540
|
+
return loc === null ? (activeTokensWithLocCount < tokensWithLoc.length ? tokensWithLoc[activeTokensWithLocCount] = this : tokensWithLoc.push(this), activeTokensWithLocCount++, this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
541
|
+
}, resetLocTemp = (token) => {
|
|
543
542
|
token.#loc = null;
|
|
544
543
|
};
|
|
545
544
|
}
|
|
546
545
|
};
|
|
547
|
-
|
|
548
|
-
const TOKEN_TYPES = [
|
|
546
|
+
const getTokenLoc = getTokenLocTemp, resetLoc = resetLocTemp, TOKEN_TYPES = [
|
|
549
547
|
"Identifier",
|
|
550
548
|
"Keyword",
|
|
551
549
|
"PrivateIdentifier",
|
|
@@ -591,7 +589,7 @@ function initTokensBuffer() {
|
|
|
591
589
|
cachedTokens.push(new Token());
|
|
592
590
|
while (cachedTokens.length < tokensLen);
|
|
593
591
|
let indexesLen = deserializedTokenIndexes.length;
|
|
594
|
-
indexesLen < tokensLen && (deserializedTokenIndexes = new Int32Array(MathMax(tokensLen, indexesLen === 0 ? 16 : indexesLen << 1)));
|
|
592
|
+
indexesLen < tokensLen && (deserializedTokenIndexes = new Int32Array(MathMax$4(tokensLen, indexesLen === 0 ? 16 : indexesLen << 1)));
|
|
595
593
|
}
|
|
596
594
|
}
|
|
597
595
|
/**
|
|
@@ -653,7 +651,7 @@ function deserializeTokenIfNeeded(index) {
|
|
|
653
651
|
* @returns {string} - Unescaped identifier name
|
|
654
652
|
*/
|
|
655
653
|
function unescapeIdentifier(name) {
|
|
656
|
-
return name.replace(/\\u(?:\{([0-9a-fA-F]+)\}|([0-9a-fA-F]{4}))/g, (_, hex1, hex2) => StringFromCodePoint(parseInt(hex1 ?? hex2, 16)));
|
|
654
|
+
return name.replace(/\\u(?:\{([0-9a-fA-F]+)\}|([0-9a-fA-F]{4}))/g, (_, hex1, hex2) => StringFromCodePoint$1(parseInt(hex1 ?? hex2, 16)));
|
|
657
655
|
}
|
|
658
656
|
/**
|
|
659
657
|
* Reset tokens after file has been linted.
|
|
@@ -681,20 +679,24 @@ function resetTokens() {
|
|
|
681
679
|
}
|
|
682
680
|
//#endregion
|
|
683
681
|
//#region src-js/plugins/comments.ts
|
|
682
|
+
const ObjectFreeze$7 = Object.freeze, FunctionPrototypeCall = Function.prototype.call, ObjectPrototype__defineGetter__ = Object.prototype.__defineGetter__, MathMax$3 = Math.max;
|
|
684
683
|
let comments = null, commentsUint8 = null, commentsInt32 = null, commentsLen = 0, allCommentsDeserialized = !1;
|
|
685
684
|
const cachedComments = [];
|
|
686
685
|
let previousComments = [];
|
|
687
686
|
const commentsWithLoc = [];
|
|
688
687
|
let activeCommentsWithLocCount = 0, deserializedCommentIndexes = EMPTY_INT32_ARRAY, deserializedCommentsLen = 0;
|
|
689
|
-
const EMPTY_COMMENTS = ObjectFreeze([]);
|
|
690
|
-
let
|
|
688
|
+
const EMPTY_COMMENTS = ObjectFreeze$7([]), defineGetter = FunctionPrototypeCall.bind(ObjectPrototype__defineGetter__);
|
|
689
|
+
let getCommentLocTemp, resetCommentLocTemp;
|
|
691
690
|
/**
|
|
692
691
|
* Comment class.
|
|
693
692
|
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
693
|
+
* `loc` is defined as an own accessor property via `__defineGetter__` in the constructor,
|
|
694
|
+
* using a shared getter function (`getCommentLoc`). This makes `loc` an own enumerable property,
|
|
695
|
+
* so `{...comment}` spreads it and `JSON.stringify(comment)` serializes it.
|
|
696
|
+
*
|
|
697
|
+
* The computed `Location` value is cached in the private `#loc` field on first access.
|
|
698
|
+
* All instances share the same getter function, keeping the V8 hidden class transition
|
|
699
|
+
* identical across instances. Reset only clears the `#loc` field.
|
|
698
700
|
*/
|
|
699
701
|
var Comment = class {
|
|
700
702
|
type = null;
|
|
@@ -703,23 +705,19 @@ var Comment = class {
|
|
|
703
705
|
end = 0;
|
|
704
706
|
range = [0, 0];
|
|
705
707
|
#loc = null;
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
return loc === null ? (activeCommentsWithLocCount < commentsWithLoc.length ? commentsWithLoc[activeCommentsWithLocCount] = this : commentsWithLoc.push(this), activeCommentsWithLocCount++, this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
709
|
-
}
|
|
710
|
-
toJSON() {
|
|
711
|
-
return {
|
|
712
|
-
...this,
|
|
713
|
-
loc: this.loc
|
|
714
|
-
};
|
|
708
|
+
constructor() {
|
|
709
|
+
defineGetter(this, "loc", getCommentLoc);
|
|
715
710
|
}
|
|
716
711
|
static {
|
|
717
|
-
|
|
712
|
+
getCommentLocTemp = function() {
|
|
713
|
+
let loc = this.#loc;
|
|
714
|
+
return loc === null ? (activeCommentsWithLocCount < commentsWithLoc.length ? commentsWithLoc[activeCommentsWithLocCount] = this : commentsWithLoc.push(this), activeCommentsWithLocCount++, this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
715
|
+
}, resetCommentLocTemp = (comment) => {
|
|
718
716
|
comment.#loc = null;
|
|
719
717
|
};
|
|
720
718
|
}
|
|
721
719
|
};
|
|
722
|
-
|
|
720
|
+
const getCommentLoc = getCommentLocTemp, resetCommentLoc = resetCommentLocTemp;
|
|
723
721
|
/**
|
|
724
722
|
* Deserialize all comments and build the `comments` array.
|
|
725
723
|
* Called by `ast.comments` getter.
|
|
@@ -757,7 +755,7 @@ function initCommentsBuffer() {
|
|
|
757
755
|
cachedComments.push(new Comment());
|
|
758
756
|
while (cachedComments.length < commentsLen);
|
|
759
757
|
let indexesLen = deserializedCommentIndexes.length;
|
|
760
|
-
indexesLen < commentsLen && (deserializedCommentIndexes = new Int32Array(MathMax(commentsLen, indexesLen === 0 ? 16 : indexesLen << 1)));
|
|
758
|
+
indexesLen < commentsLen && (deserializedCommentIndexes = new Int32Array(MathMax$3(commentsLen, indexesLen === 0 ? 16 : indexesLen << 1)));
|
|
761
759
|
}
|
|
762
760
|
commentsInt32[0] === 0 && sourceText.startsWith("#!") && (getComment(0).type = "Shebang");
|
|
763
761
|
}
|
|
@@ -812,10 +810,11 @@ function resetComments() {
|
|
|
812
810
|
}
|
|
813
811
|
//#endregion
|
|
814
812
|
//#region src-js/generated/deserialize.js
|
|
813
|
+
const BufferPrototype$1 = Buffer.prototype, ObjectCreate$1 = Object.create, ObjectPrototype = Object.prototype, StringFromCodePoint = String.fromCodePoint, ObjectHasOwn$4 = Object.hasOwn;
|
|
815
814
|
let uint8, int32, float64, sourceText$1, sourceTextLatin, sourceStartPos$1 = 0, firstNonAsciiPos = 0, parent = null;
|
|
816
|
-
const { fromCharCode } = String, { utf8Slice: utf8Slice$1, latin1Slice } =
|
|
815
|
+
const { fromCharCode } = String, { utf8Slice: utf8Slice$1, latin1Slice } = BufferPrototype$1, stringDecodeArrays = Array(65).fill(null);
|
|
817
816
|
for (let i = 0; i <= 64; i++) stringDecodeArrays[i] = Array(i).fill(0);
|
|
818
|
-
const NodeProto = ObjectCreate(ObjectPrototype, { loc: {
|
|
817
|
+
const NodeProto = ObjectCreate$1(ObjectPrototype, { loc: {
|
|
819
818
|
get() {
|
|
820
819
|
return getNodeLoc(this);
|
|
821
820
|
},
|
|
@@ -4072,7 +4071,7 @@ function deserializeTSModuleDeclaration(pos) {
|
|
|
4072
4071
|
parent: innerId
|
|
4073
4072
|
};
|
|
4074
4073
|
}
|
|
4075
|
-
ObjectHasOwn(body, "body") ? (body = body.body, node.body = body, body.parent = node) : body = null;
|
|
4074
|
+
ObjectHasOwn$4(body, "body") ? (body = body.body, node.body = body, body.parent = node) : body = null;
|
|
4076
4075
|
}
|
|
4077
4076
|
}
|
|
4078
4077
|
return parent = previousParent, node;
|
|
@@ -5383,6 +5382,12 @@ function deserializeBoxTSExternalModuleReference(pos) {
|
|
|
5383
5382
|
function deserializeI32(pos) {
|
|
5384
5383
|
return int32[pos >> 2];
|
|
5385
5384
|
}
|
|
5385
|
+
//#endregion
|
|
5386
|
+
//#region src-js/plugins/tokens_and_comments.ts
|
|
5387
|
+
/**
|
|
5388
|
+
* Initialization and deserialization of merged tokens-and-comments array and buffer.
|
|
5389
|
+
*/
|
|
5390
|
+
const MathMax$2 = Math.max;
|
|
5386
5391
|
let tokensAndComments = null, previousTokensAndComments = [], tokensAndCommentsInt32 = null, tokensAndCommentsLen = 0, tokensAndCommentsBackingInt32 = EMPTY_INT32_ARRAY;
|
|
5387
5392
|
/**
|
|
5388
5393
|
* Initialize tokens-and-comments buffer.
|
|
@@ -5399,7 +5404,7 @@ let tokensAndComments = null, previousTokensAndComments = [], tokensAndCommentsI
|
|
|
5399
5404
|
function initTokensAndCommentsBuffer() {
|
|
5400
5405
|
tokensInt32 === null && initTokensBuffer(), commentsInt32 === null && initCommentsBuffer(), tokensAndCommentsLen = tokensLen + commentsLen;
|
|
5401
5406
|
let requiredLen32 = tokensAndCommentsLen + 1 << 2, backingLen = tokensAndCommentsBackingInt32.length;
|
|
5402
|
-
backingLen < requiredLen32 && (tokensAndCommentsBackingInt32 = new Int32Array(MathMax(requiredLen32, backingLen === 0 ? 256 : backingLen << 1))), tokensAndCommentsInt32 = tokensAndCommentsBackingInt32, commentsLen === 0 ? fillMergedEntries(0, tokensInt32, 0, 0, tokensLen) : tokensLen === 0 ? fillMergedEntries(1, commentsInt32, 0, 0, commentsLen) : mergeTokensAndComments(tokensInt32, commentsInt32), tokensAndCommentsInt32[(tokensAndCommentsLen << 2) + 2] = 0;
|
|
5407
|
+
backingLen < requiredLen32 && (tokensAndCommentsBackingInt32 = new Int32Array(MathMax$2(requiredLen32, backingLen === 0 ? 256 : backingLen << 1))), tokensAndCommentsInt32 = tokensAndCommentsBackingInt32, commentsLen === 0 ? fillMergedEntries(0, tokensInt32, 0, 0, tokensLen) : tokensLen === 0 ? fillMergedEntries(1, commentsInt32, 0, 0, commentsLen) : mergeTokensAndComments(tokensInt32, commentsInt32), tokensAndCommentsInt32[(tokensAndCommentsLen << 2) + 2] = 0;
|
|
5403
5408
|
}
|
|
5404
5409
|
/**
|
|
5405
5410
|
* Merge tokens and comments in ascending order of `start`.
|
|
@@ -12107,6 +12112,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12107
12112
|
}
|
|
12108
12113
|
}), __exportStar(require_variable(), exports);
|
|
12109
12114
|
})))();
|
|
12115
|
+
const JSONParse$3 = JSON.parse;
|
|
12116
|
+
Array.isArray;
|
|
12117
|
+
const ObjectFreeze$6 = Object.freeze;
|
|
12110
12118
|
let globalsJSON = null, globals = null, envs = null;
|
|
12111
12119
|
/**
|
|
12112
12120
|
* Updates the globals for the file.
|
|
@@ -12125,7 +12133,7 @@ function setGlobalsForFile(globalsJSONInput) {
|
|
|
12125
12133
|
* Caller must ensure that `globalsJSON` has been initialized before calling this function.
|
|
12126
12134
|
*/
|
|
12127
12135
|
function initGlobals() {
|
|
12128
|
-
({globals, envs} = JSONParse(globalsJSON)), ObjectFreeze(globals), ObjectFreeze(envs);
|
|
12136
|
+
({globals, envs} = JSONParse$3(globalsJSON)), ObjectFreeze$6(globals), ObjectFreeze$6(envs);
|
|
12129
12137
|
}
|
|
12130
12138
|
/**
|
|
12131
12139
|
* Reset globals.
|
|
@@ -12669,9 +12677,7 @@ const ENVS = new Map([
|
|
|
12669
12677
|
"onunhandledrejection"
|
|
12670
12678
|
]
|
|
12671
12679
|
}]
|
|
12672
|
-
]);
|
|
12673
|
-
//#endregion
|
|
12674
|
-
//#region src-js/plugins/scope.ts
|
|
12680
|
+
]), ObjectHasOwn$3 = Object.hasOwn, ObjectFreeze$5 = Object.freeze;
|
|
12675
12681
|
let tsScopeManager = null;
|
|
12676
12682
|
const analyzeOptions = {
|
|
12677
12683
|
childVisitorKeys: void 0,
|
|
@@ -12709,11 +12715,11 @@ function addGlobals() {
|
|
|
12709
12715
|
let { readonly, writable } = preset;
|
|
12710
12716
|
for (let i = 0, len = readonly.length; i < len; i++) {
|
|
12711
12717
|
let varName = readonly[i];
|
|
12712
|
-
ObjectHasOwn(globals, varName) || createGlobalVariable(varName, globalScope, !1);
|
|
12718
|
+
ObjectHasOwn$3(globals, varName) || createGlobalVariable(varName, globalScope, !1);
|
|
12713
12719
|
}
|
|
12714
12720
|
for (let i = 0, len = writable.length; i < len; i++) {
|
|
12715
12721
|
let varName = writable[i];
|
|
12716
|
-
ObjectHasOwn(globals, varName) || createGlobalVariable(varName, globalScope, !0);
|
|
12722
|
+
ObjectHasOwn$3(globals, varName) || createGlobalVariable(varName, globalScope, !0);
|
|
12717
12723
|
}
|
|
12718
12724
|
}
|
|
12719
12725
|
for (let name in globals) {
|
|
@@ -12746,7 +12752,7 @@ function createGlobalVariable(name, globalScope, isWritable) {
|
|
|
12746
12752
|
function resetScopeManager() {
|
|
12747
12753
|
tsScopeManager = null;
|
|
12748
12754
|
}
|
|
12749
|
-
const SCOPE_MANAGER = ObjectFreeze({
|
|
12755
|
+
const SCOPE_MANAGER = ObjectFreeze$5({
|
|
12750
12756
|
/**
|
|
12751
12757
|
* All scopes.
|
|
12752
12758
|
*/
|
|
@@ -12856,7 +12862,7 @@ function markVariableAsUsed(name, refNode) {
|
|
|
12856
12862
|
}
|
|
12857
12863
|
//#endregion
|
|
12858
12864
|
//#region src-js/plugins/tokens_methods.ts
|
|
12859
|
-
const INCLUDE_COMMENTS_SKIP_OPTIONS = {
|
|
12865
|
+
const MathMax$1 = Math.max, MathMin$1 = Math.min, INCLUDE_COMMENTS_SKIP_OPTIONS = {
|
|
12860
12866
|
includeComments: !0,
|
|
12861
12867
|
skip: 0
|
|
12862
12868
|
};
|
|
@@ -12888,8 +12894,8 @@ function getTokens(node, countOptions, afterCount) {
|
|
|
12888
12894
|
let mid = sliceEnd + endIndex >> 1;
|
|
12889
12895
|
int32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12890
12896
|
}
|
|
12891
|
-
if (sliceStart = MathMax(0, sliceStart - beforeCount), sliceEnd = MathMin(sliceEnd + afterCount, len), typeof filter != "function") {
|
|
12892
|
-
let end = MathMin(sliceStart + (count ?? sliceEnd), sliceEnd);
|
|
12897
|
+
if (sliceStart = MathMax$1(0, sliceStart - beforeCount), sliceEnd = MathMin$1(sliceEnd + afterCount, len), typeof filter != "function") {
|
|
12898
|
+
let end = MathMin$1(sliceStart + (count ?? sliceEnd), sliceEnd);
|
|
12893
12899
|
return collectEntries(sliceStart, end, includeComments);
|
|
12894
12900
|
}
|
|
12895
12901
|
let allTokens = [];
|
|
@@ -12962,7 +12968,7 @@ function getFirstTokens(node, countOptions) {
|
|
|
12962
12968
|
let mid = sliceEnd + endIndex >> 1;
|
|
12963
12969
|
int32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12964
12970
|
}
|
|
12965
|
-
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
12971
|
+
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin$1(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
12966
12972
|
let firstTokens = [];
|
|
12967
12973
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
12968
12974
|
let token = getEntry(i, includeComments);
|
|
@@ -13030,7 +13036,7 @@ function getLastTokens(node, countOptions) {
|
|
|
13030
13036
|
let mid = sliceEnd + endIndex >> 1;
|
|
13031
13037
|
int32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
13032
13038
|
}
|
|
13033
|
-
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax(sliceStart, sliceEnd - count) : sliceStart, sliceEnd, includeComments);
|
|
13039
|
+
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax$1(sliceStart, sliceEnd - count) : sliceStart, sliceEnd, includeComments);
|
|
13034
13040
|
let lastTokens = [];
|
|
13035
13041
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
13036
13042
|
let token = getEntry(i, includeComments);
|
|
@@ -13098,14 +13104,14 @@ function getTokenOrCommentBefore(nodeOrToken, skip) {
|
|
|
13098
13104
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
13099
13105
|
*/
|
|
13100
13106
|
function getTokensBefore(nodeOrToken, countOptions) {
|
|
13101
|
-
let count = typeof countOptions == "number" ? MathMax(0, countOptions) : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), int32, len;
|
|
13107
|
+
let count = typeof countOptions == "number" ? MathMax$1(0, countOptions) : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), int32, len;
|
|
13102
13108
|
includeComments === !1 ? (tokensInt32 === null && initTokensBuffer(), int32 = tokensInt32, len = tokensLen) : (tokensAndCommentsInt32 === null && initTokensAndCommentsBuffer(), int32 = tokensAndCommentsInt32, len = tokensAndCommentsLen);
|
|
13103
13109
|
let targetStart = nodeOrToken.range[0], sliceEnd = 0;
|
|
13104
13110
|
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
13105
13111
|
let mid = sliceEnd + endIndex >> 1;
|
|
13106
13112
|
int32[mid << 2] < targetStart ? sliceEnd = mid + 1 : endIndex = mid;
|
|
13107
13113
|
}
|
|
13108
|
-
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax(0, sliceEnd - count) : 0, sliceEnd, includeComments);
|
|
13114
|
+
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax$1(0, sliceEnd - count) : 0, sliceEnd, includeComments);
|
|
13109
13115
|
let tokensBefore = [];
|
|
13110
13116
|
if (typeof count != "number") for (let i = 0; i < sliceEnd; i++) {
|
|
13111
13117
|
let token = getEntry(i, includeComments);
|
|
@@ -13178,7 +13184,7 @@ function getTokensAfter(nodeOrToken, countOptions) {
|
|
|
13178
13184
|
let mid = sliceStart + endIndex >> 1;
|
|
13179
13185
|
int32[mid << 2] < rangeEnd ? sliceStart = mid + 1 : endIndex = mid;
|
|
13180
13186
|
}
|
|
13181
|
-
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, len), includeComments) : collectEntries(sliceStart, len, includeComments);
|
|
13187
|
+
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin$1(sliceStart + count, len), includeComments) : collectEntries(sliceStart, len, includeComments);
|
|
13182
13188
|
let tokenListAfter = [];
|
|
13183
13189
|
if (typeof count != "number") for (let i = sliceStart; i < len; i++) {
|
|
13184
13190
|
let token = getEntry(i, includeComments);
|
|
@@ -13217,7 +13223,7 @@ function getTokensBetween(left, right, countOptions) {
|
|
|
13217
13223
|
let mid = sliceEnd + endIndex >> 1;
|
|
13218
13224
|
int32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
13219
13225
|
}
|
|
13220
|
-
if (sliceStart = MathMax(0, sliceStart - padding), sliceEnd = MathMin(sliceEnd + padding, len), typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
13226
|
+
if (sliceStart = MathMax$1(0, sliceStart - padding), sliceEnd = MathMin$1(sliceEnd + padding, len), typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin$1(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
13221
13227
|
let tokensBetween = [];
|
|
13222
13228
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
13223
13229
|
let token = getEntry(i, includeComments);
|
|
@@ -13287,7 +13293,7 @@ function getFirstTokensBetween(left, right, countOptions) {
|
|
|
13287
13293
|
let mid = sliceEnd + endIndex >> 1;
|
|
13288
13294
|
int32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
13289
13295
|
}
|
|
13290
|
-
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
13296
|
+
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin$1(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
13291
13297
|
let firstTokens = [];
|
|
13292
13298
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
13293
13299
|
let token = getEntry(i, includeComments);
|
|
@@ -13357,7 +13363,7 @@ function getLastTokensBetween(left, right, countOptions) {
|
|
|
13357
13363
|
let mid = sliceEnd + endIndex >> 1;
|
|
13358
13364
|
int32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
13359
13365
|
}
|
|
13360
|
-
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax(sliceStart, sliceEnd - count) : sliceStart, sliceEnd, includeComments);
|
|
13366
|
+
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax$1(sliceStart, sliceEnd - count) : sliceStart, sliceEnd, includeComments);
|
|
13361
13367
|
let tokensBetween = [];
|
|
13362
13368
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
13363
13369
|
let token = getEntry(i, includeComments);
|
|
@@ -13526,7 +13532,9 @@ function collectEntries(startIndex, endIndex, includeComments) {
|
|
|
13526
13532
|
}
|
|
13527
13533
|
//#endregion
|
|
13528
13534
|
//#region src-js/plugins/source_code.ts
|
|
13529
|
-
const
|
|
13535
|
+
const BufferPrototype = Buffer.prototype;
|
|
13536
|
+
Array.isArray;
|
|
13537
|
+
const ObjectFreeze$4 = Object.freeze, MathMax = Math.max, { utf8Slice } = BufferPrototype;
|
|
13530
13538
|
let buffer = null, hasBOM = !1, sourceText = null, sourceStartPos = 0, sourceByteLen = 0, ast = null;
|
|
13531
13539
|
/**
|
|
13532
13540
|
* Set up source for the file about to be linted.
|
|
@@ -13569,7 +13577,7 @@ function resetSourceAndAst() {
|
|
|
13569
13577
|
function fileIsJsx() {
|
|
13570
13578
|
return buffer[2147483573] === 1;
|
|
13571
13579
|
}
|
|
13572
|
-
const SOURCE_CODE = ObjectFreeze({
|
|
13580
|
+
const SOURCE_CODE = ObjectFreeze$4({
|
|
13573
13581
|
/**
|
|
13574
13582
|
* Source text.
|
|
13575
13583
|
*/
|
|
@@ -13609,7 +13617,7 @@ const SOURCE_CODE = ObjectFreeze({
|
|
|
13609
13617
|
*
|
|
13610
13618
|
* Oxlint does not offer any parser services.
|
|
13611
13619
|
*/
|
|
13612
|
-
parserServices: ObjectFreeze({}),
|
|
13620
|
+
parserServices: ObjectFreeze$4({}),
|
|
13613
13621
|
/**
|
|
13614
13622
|
* Source text as array of lines, split according to specification's definition of line breaks.
|
|
13615
13623
|
*/
|
|
@@ -13693,7 +13701,7 @@ const SOURCE_CODE = ObjectFreeze({
|
|
|
13693
13701
|
isSpaceBetween,
|
|
13694
13702
|
isSpaceBetweenTokens,
|
|
13695
13703
|
getDisableDirectives
|
|
13696
|
-
}), FIXER = ObjectFreeze({
|
|
13704
|
+
}), ObjectFreeze$3 = Object.freeze, ObjectHasOwn$2 = Object.hasOwn, SymbolIterator = Symbol.iterator, JSONStringify$3 = JSON.stringify, FIXER = ObjectFreeze$3({
|
|
13697
13705
|
insertTextBefore(nodeOrToken, text) {
|
|
13698
13706
|
let start = nodeOrToken.range[0];
|
|
13699
13707
|
return {
|
|
@@ -13781,7 +13789,7 @@ function getFixes(diagnostic, ruleDetails) {
|
|
|
13781
13789
|
* @throws {TypeError} If a suggestion's `fix` is not a function, or message is invalid
|
|
13782
13790
|
*/
|
|
13783
13791
|
function getSuggestions(diagnostic, ruleDetails) {
|
|
13784
|
-
if (!ObjectHasOwn(diagnostic, "suggest")) return null;
|
|
13792
|
+
if (!ObjectHasOwn$2(diagnostic, "suggest")) return null;
|
|
13785
13793
|
let { suggest } = diagnostic;
|
|
13786
13794
|
if (suggest == null) return null;
|
|
13787
13795
|
let suggestLen = suggest.length;
|
|
@@ -13790,7 +13798,7 @@ function getSuggestions(diagnostic, ruleDetails) {
|
|
|
13790
13798
|
for (let i = 0; i < suggestLen; i++) {
|
|
13791
13799
|
let suggestion = suggest[i], { fix } = suggestion;
|
|
13792
13800
|
if (typeof fix != "function") throw TypeError("Suggestion without a fix function");
|
|
13793
|
-
let { message, messageId } = getMessage(ObjectHasOwn(suggestion, "desc") ? suggestion.desc : null, suggestion, ruleDetails), fixes = getFixesFromFixFn(fix, suggestion);
|
|
13801
|
+
let { message, messageId } = getMessage(ObjectHasOwn$2(suggestion, "desc") ? suggestion.desc : null, suggestion, ruleDetails), fixes = getFixesFromFixFn(fix, suggestion);
|
|
13794
13802
|
fixes !== null && suggestions.push({
|
|
13795
13803
|
message,
|
|
13796
13804
|
messageId,
|
|
@@ -13853,11 +13861,11 @@ function validateAndConvertFix(fix) {
|
|
|
13853
13861
|
text: String(text)
|
|
13854
13862
|
};
|
|
13855
13863
|
}
|
|
13856
|
-
throw Error(`Fix has invalid range: ${JSONStringify(fix, null, 2)}`);
|
|
13864
|
+
throw Error(`Fix has invalid range: ${JSONStringify$3(fix, null, 2)}`);
|
|
13857
13865
|
}
|
|
13858
13866
|
//#endregion
|
|
13859
13867
|
//#region src-js/plugins/report.ts
|
|
13860
|
-
const diagnostics = [], PLACEHOLDER_REGEX = /\{\{([^{}]+)\}\}/gu;
|
|
13868
|
+
const ObjectHasOwn$1 = Object.hasOwn, ObjectKeys$3 = Object.keys, diagnostics = [], PLACEHOLDER_REGEX = /\{\{([^{}]+)\}\}/gu;
|
|
13861
13869
|
/**
|
|
13862
13870
|
* Report error.
|
|
13863
13871
|
* @param diagnostic - Diagnostic object
|
|
@@ -13868,10 +13876,10 @@ const diagnostics = [], PLACEHOLDER_REGEX = /\{\{([^{}]+)\}\}/gu;
|
|
|
13868
13876
|
function report(diagnostic, extraArgs, ruleDetails) {
|
|
13869
13877
|
if (filePath === null) throw Error("Cannot report errors in `createOnce`");
|
|
13870
13878
|
extraArgs.length > 0 && (diagnostic = convertLegacyCallArgs(diagnostic, extraArgs));
|
|
13871
|
-
let { message, messageId } = getMessage(ObjectHasOwn(diagnostic, "message") ? diagnostic.message : null, diagnostic, ruleDetails), start, end, loc;
|
|
13872
|
-
if (ObjectHasOwn(diagnostic, "loc") && (loc = diagnostic.loc) != null) {
|
|
13879
|
+
let { message, messageId } = getMessage(ObjectHasOwn$1(diagnostic, "message") ? diagnostic.message : null, diagnostic, ruleDetails), start, end, loc;
|
|
13880
|
+
if (ObjectHasOwn$1(diagnostic, "loc") && (loc = diagnostic.loc) != null) {
|
|
13873
13881
|
if (typeof loc != "object") throw TypeError("`loc` must be an object if provided");
|
|
13874
|
-
if (ObjectHasOwn(loc, "start")) {
|
|
13882
|
+
if (ObjectHasOwn$1(loc, "start")) {
|
|
13875
13883
|
let { start: startLineCol, end: endLineCol } = loc;
|
|
13876
13884
|
if (typeof startLineCol != "object" || !startLineCol) throw TypeError("`loc.start` must be an object");
|
|
13877
13885
|
if (start = getOffsetFromLineColumn(startLineCol), endLineCol == null) end = start;
|
|
@@ -13936,12 +13944,12 @@ function convertLegacyCallArgs(node, extraArgs) {
|
|
|
13936
13944
|
*/
|
|
13937
13945
|
function getMessage(message, descriptor, ruleDetails) {
|
|
13938
13946
|
let messageId = null;
|
|
13939
|
-
if (ObjectHasOwn(descriptor, "messageId") && (messageId = descriptor.messageId ?? null), messageId !== null) {
|
|
13947
|
+
if (ObjectHasOwn$1(descriptor, "messageId") && (messageId = descriptor.messageId ?? null), messageId !== null) {
|
|
13940
13948
|
if (typeof messageId != "string") throw TypeError("`messageId` must be a string");
|
|
13941
13949
|
message = resolveMessageFromMessageId(messageId, ruleDetails);
|
|
13942
13950
|
} else if (message == null) throw Error("Either `message` or `messageId` is required");
|
|
13943
13951
|
else if (typeof message != "string") throw TypeError("`message` must be a string");
|
|
13944
|
-
if (ObjectHasOwn(descriptor, "data")) {
|
|
13952
|
+
if (ObjectHasOwn$1(descriptor, "data")) {
|
|
13945
13953
|
let { data } = descriptor;
|
|
13946
13954
|
data != null && (message = replacePlaceholders(message, data));
|
|
13947
13955
|
}
|
|
@@ -13960,7 +13968,7 @@ function getMessage(message, descriptor, ruleDetails) {
|
|
|
13960
13968
|
function resolveMessageFromMessageId(messageId, ruleDetails) {
|
|
13961
13969
|
let { messages } = ruleDetails;
|
|
13962
13970
|
if (messages === null) throw Error(`Cannot use messageId '${messageId}' - rule does not define any messages in \`meta.messages\``);
|
|
13963
|
-
if (!ObjectHasOwn(messages, messageId)) throw Error(`Unknown messageId '${messageId}'. Available \`messageIds\`: ${ObjectKeys(messages).map((msg) => `'${msg}'`).join(", ")}`);
|
|
13971
|
+
if (!ObjectHasOwn$1(messages, messageId)) throw Error(`Unknown messageId '${messageId}'. Available \`messageIds\`: ${ObjectKeys$3(messages).map((msg) => `'${msg}'`).join(", ")}`);
|
|
13964
13972
|
return messages[messageId];
|
|
13965
13973
|
}
|
|
13966
13974
|
/**
|
|
@@ -14008,6 +14016,7 @@ function getOffsetFromLineColumn(lineCol) {
|
|
|
14008
14016
|
}
|
|
14009
14017
|
//#endregion
|
|
14010
14018
|
//#region src-js/plugins/json.ts
|
|
14019
|
+
const ArrayIsArray$4 = Array.isArray, ObjectFreeze$2 = Object.freeze;
|
|
14011
14020
|
/**
|
|
14012
14021
|
* Deep freeze a JSON value, recursively freezing all nested objects and arrays.
|
|
14013
14022
|
*
|
|
@@ -14016,7 +14025,7 @@ function getOffsetFromLineColumn(lineCol) {
|
|
|
14016
14025
|
* @param value - The value to deep freeze
|
|
14017
14026
|
*/
|
|
14018
14027
|
function deepFreezeJsonValue(value) {
|
|
14019
|
-
typeof value != "object" || !value || (ArrayIsArray(value) ? deepFreezeJsonArray(value) : deepFreezeJsonObject(value));
|
|
14028
|
+
typeof value != "object" || !value || (ArrayIsArray$4(value) ? deepFreezeJsonArray(value) : deepFreezeJsonObject(value));
|
|
14020
14029
|
}
|
|
14021
14030
|
/**
|
|
14022
14031
|
* Deep freeze a JSON object, recursively freezing all nested objects and arrays.
|
|
@@ -14027,7 +14036,7 @@ function deepFreezeJsonValue(value) {
|
|
|
14027
14036
|
*/
|
|
14028
14037
|
function deepFreezeJsonObject(obj) {
|
|
14029
14038
|
for (let key in obj) deepFreezeJsonValue(obj[key]);
|
|
14030
|
-
ObjectFreeze(obj);
|
|
14039
|
+
ObjectFreeze$2(obj);
|
|
14031
14040
|
}
|
|
14032
14041
|
/**
|
|
14033
14042
|
* Deep freeze a JSON array, recursively freezing all nested objects and arrays.
|
|
@@ -14038,7 +14047,7 @@ function deepFreezeJsonObject(obj) {
|
|
|
14038
14047
|
*/
|
|
14039
14048
|
function deepFreezeJsonArray(arr) {
|
|
14040
14049
|
for (let i = 0, len = arr.length; i !== len; i++) deepFreezeJsonValue(arr[i]);
|
|
14041
|
-
ObjectFreeze(arr);
|
|
14050
|
+
ObjectFreeze$2(arr);
|
|
14042
14051
|
}
|
|
14043
14052
|
/**
|
|
14044
14053
|
* Deep clone a JSON value, recursively cloning all nested objects and arrays.
|
|
@@ -14046,7 +14055,7 @@ function deepFreezeJsonArray(arr) {
|
|
|
14046
14055
|
* @returns Cloned value
|
|
14047
14056
|
*/
|
|
14048
14057
|
function deepCloneJsonValue(value) {
|
|
14049
|
-
return typeof value != "object" || !value ? value : ArrayIsArray(value) ? deepCloneJsonArray(value) : deepCloneJsonObject(value);
|
|
14058
|
+
return typeof value != "object" || !value ? value : ArrayIsArray$4(value) ? deepCloneJsonArray(value) : deepCloneJsonObject(value);
|
|
14050
14059
|
}
|
|
14051
14060
|
/**
|
|
14052
14061
|
* Deep clone a JSON object, recursively cloning all nested objects and arrays.
|
|
@@ -14057,7 +14066,7 @@ function deepCloneJsonObject(obj) {
|
|
|
14057
14066
|
let cloned = { ...obj };
|
|
14058
14067
|
for (let key in cloned) {
|
|
14059
14068
|
let value = cloned[key];
|
|
14060
|
-
typeof value != "object" || !value || (cloned[key] = ArrayIsArray(value) ? deepCloneJsonArray(value) : deepCloneJsonObject(value));
|
|
14069
|
+
typeof value != "object" || !value || (cloned[key] = ArrayIsArray$4(value) ? deepCloneJsonArray(value) : deepCloneJsonObject(value));
|
|
14061
14070
|
}
|
|
14062
14071
|
return cloned;
|
|
14063
14072
|
}
|
|
@@ -14073,6 +14082,7 @@ function deepCloneJsonArray(arr) {
|
|
|
14073
14082
|
}
|
|
14074
14083
|
//#endregion
|
|
14075
14084
|
//#region src-js/plugins/settings.ts
|
|
14085
|
+
const JSONParse$2 = JSON.parse;
|
|
14076
14086
|
let settingsJSON = null, settings = null;
|
|
14077
14087
|
/**
|
|
14078
14088
|
* Updates the settings for the file.
|
|
@@ -14089,7 +14099,7 @@ function setSettingsForFile(settingsJSONInput) {
|
|
|
14089
14099
|
* Deserialize settings from JSON.
|
|
14090
14100
|
*/
|
|
14091
14101
|
function initSettings() {
|
|
14092
|
-
settings = JSONParse(settingsJSON), deepFreezeJsonValue(settings);
|
|
14102
|
+
settings = JSONParse$2(settingsJSON), deepFreezeJsonValue(settings);
|
|
14093
14103
|
}
|
|
14094
14104
|
/**
|
|
14095
14105
|
* Reset settings.
|
|
@@ -14099,9 +14109,10 @@ function resetSettings() {
|
|
|
14099
14109
|
}
|
|
14100
14110
|
//#endregion
|
|
14101
14111
|
//#region package.json
|
|
14102
|
-
var version = "1.
|
|
14112
|
+
var version = "1.70.0";
|
|
14103
14113
|
//#endregion
|
|
14104
14114
|
//#region src-js/plugins/context.ts
|
|
14115
|
+
const ObjectFreeze$1 = Object.freeze, ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectPreventExtensions = Object.preventExtensions;
|
|
14105
14116
|
let filePath = null, cwd = null;
|
|
14106
14117
|
/**
|
|
14107
14118
|
* Set CWD. Used when switching workspaces.
|
|
@@ -14127,7 +14138,7 @@ function setupFileContext(filePathInput) {
|
|
|
14127
14138
|
function resetFileContext() {
|
|
14128
14139
|
filePath = null;
|
|
14129
14140
|
}
|
|
14130
|
-
const SUPPORTED_ECMA_VERSIONS = ObjectFreeze([
|
|
14141
|
+
const SUPPORTED_ECMA_VERSIONS = ObjectFreeze$1([
|
|
14131
14142
|
3,
|
|
14132
14143
|
5,
|
|
14133
14144
|
6,
|
|
@@ -14144,7 +14155,7 @@ const SUPPORTED_ECMA_VERSIONS = ObjectFreeze([
|
|
|
14144
14155
|
17
|
|
14145
14156
|
]);
|
|
14146
14157
|
let Syntax = null;
|
|
14147
|
-
const PARSER = ObjectFreeze({
|
|
14158
|
+
const PARSER = ObjectFreeze$1({
|
|
14148
14159
|
/**
|
|
14149
14160
|
* Parser name.
|
|
14150
14161
|
*/
|
|
@@ -14173,7 +14184,7 @@ const PARSER = ObjectFreeze({
|
|
|
14173
14184
|
if (Syntax === null) {
|
|
14174
14185
|
Syntax = ObjectCreate(null);
|
|
14175
14186
|
for (let key in keys_default) Syntax[key] = key;
|
|
14176
|
-
ObjectFreeze(Syntax);
|
|
14187
|
+
ObjectFreeze$1(Syntax);
|
|
14177
14188
|
}
|
|
14178
14189
|
return Syntax;
|
|
14179
14190
|
},
|
|
@@ -14185,7 +14196,7 @@ const PARSER = ObjectFreeze({
|
|
|
14185
14196
|
* ECMAScript versions supported by parser.
|
|
14186
14197
|
*/
|
|
14187
14198
|
supportedEcmaVersions: SUPPORTED_ECMA_VERSIONS
|
|
14188
|
-
}), PARSER_OPTIONS = ObjectFreeze({
|
|
14199
|
+
}), PARSER_OPTIONS = ObjectFreeze$1({
|
|
14189
14200
|
/**
|
|
14190
14201
|
* Source type of the file being linted.
|
|
14191
14202
|
*/
|
|
@@ -14195,7 +14206,7 @@ const PARSER = ObjectFreeze({
|
|
|
14195
14206
|
/**
|
|
14196
14207
|
* ECMA features.
|
|
14197
14208
|
*/
|
|
14198
|
-
ecmaFeatures: ObjectFreeze({
|
|
14209
|
+
ecmaFeatures: ObjectFreeze$1({
|
|
14199
14210
|
/**
|
|
14200
14211
|
* `true` if file was parsed as JSX.
|
|
14201
14212
|
*/
|
|
@@ -14247,8 +14258,8 @@ const PARSER = ObjectFreeze({
|
|
|
14247
14258
|
return envs === null && initGlobals(), envs;
|
|
14248
14259
|
}
|
|
14249
14260
|
};
|
|
14250
|
-
ObjectFreeze(LANGUAGE_OPTIONS);
|
|
14251
|
-
const FILE_CONTEXT = ObjectFreeze({
|
|
14261
|
+
ObjectFreeze$1(LANGUAGE_OPTIONS);
|
|
14262
|
+
const FILE_CONTEXT = ObjectFreeze$1({
|
|
14252
14263
|
/**
|
|
14253
14264
|
* Absolute path of the file being linted.
|
|
14254
14265
|
*/
|
|
@@ -14335,7 +14346,7 @@ const FILE_CONTEXT = ObjectFreeze({
|
|
|
14335
14346
|
* and the specified properties as its own properties.
|
|
14336
14347
|
*/
|
|
14337
14348
|
extend(extension) {
|
|
14338
|
-
return ObjectFreeze(ObjectAssign(ObjectCreate(this), extension));
|
|
14349
|
+
return ObjectFreeze$1(ObjectAssign(ObjectCreate(this), extension));
|
|
14339
14350
|
},
|
|
14340
14351
|
/**
|
|
14341
14352
|
* Parser options used to parse the file being linted.
|
|
@@ -17363,7 +17374,7 @@ function switchWorkspace(workspaceUri) {
|
|
|
17363
17374
|
}
|
|
17364
17375
|
//#endregion
|
|
17365
17376
|
//#region src-js/plugins/options.ts
|
|
17366
|
-
const DEFAULT_OPTIONS = ObjectFreeze([]);
|
|
17377
|
+
const ObjectFreeze = Object.freeze, ArrayIsArray$3 = Array.isArray, JSONStringify$2 = JSON.stringify, ObjectKeys$2 = Object.keys, JSONParse$1 = JSON.parse, MathMin = Math.min, ObjectHasOwn = Object.hasOwn, ObjectDefineProperty$3 = Object.defineProperty, DEFAULT_OPTIONS = ObjectFreeze([]);
|
|
17367
17378
|
let allOptions = null;
|
|
17368
17379
|
/**
|
|
17369
17380
|
* Set `allOptions`. Used when switching workspaces.
|
|
@@ -17401,7 +17412,7 @@ function compileSchema(schema) {
|
|
|
17401
17412
|
if (schema == null) return null;
|
|
17402
17413
|
if (schema === !1) return !1;
|
|
17403
17414
|
if (typeof schema != "object") throw TypeError("`rule.meta.schema` must be an array, object, or `false` if provided");
|
|
17404
|
-
if (ArrayIsArray(schema)) {
|
|
17415
|
+
if (ArrayIsArray$3(schema)) {
|
|
17405
17416
|
if (schema.length === 0) return null;
|
|
17406
17417
|
schema = {
|
|
17407
17418
|
type: "array",
|
|
@@ -17419,12 +17430,12 @@ function compileSchema(schema) {
|
|
|
17419
17430
|
*/
|
|
17420
17431
|
function wrapSchemaValidator(validate) {
|
|
17421
17432
|
return (options, ruleName) => {
|
|
17422
|
-
if (validate(options), validate.errors) throw Error(`Options validation failed for rule '${ruleName}':\nOptions:\n${JSONStringify(options, null, 2)}\nErrors:\n` + validate.errors.map((error) => {
|
|
17433
|
+
if (validate(options), validate.errors) throw Error(`Options validation failed for rule '${ruleName}':\nOptions:\n${JSONStringify$2(options, null, 2)}\nErrors:\n` + validate.errors.map((error) => {
|
|
17423
17434
|
if (error.keyword === "additionalProperties" && error.schema === !1 && typeof error.parentSchema?.properties == "object" && typeof error.params?.additionalProperty == "string") {
|
|
17424
|
-
let expectedProperties = ObjectKeys(error.parentSchema.properties).map((property) => `"${property}"`);
|
|
17425
|
-
return `\tValue ${JSONStringify(error.data)} ${error.message}.\n\t\tUnexpected property "${error.params.additionalProperty}". Expected properties: ${expectedProperties.join(", ")}.`;
|
|
17435
|
+
let expectedProperties = ObjectKeys$2(error.parentSchema.properties).map((property) => `"${property}"`);
|
|
17436
|
+
return `\tValue ${JSONStringify$2(error.data)} ${error.message}.\n\t\tUnexpected property "${error.params.additionalProperty}". Expected properties: ${expectedProperties.join(", ")}.`;
|
|
17426
17437
|
}
|
|
17427
|
-
return `\tValue ${JSONStringify(error.data)} ${error.message}.`;
|
|
17438
|
+
return `\tValue ${JSONStringify$2(error.data)} ${error.message}.`;
|
|
17428
17439
|
}).join("\n"));
|
|
17429
17440
|
};
|
|
17430
17441
|
}
|
|
@@ -17435,7 +17446,7 @@ function wrapSchemaValidator(validate) {
|
|
|
17435
17446
|
* @throws `Error` if options fail validation
|
|
17436
17447
|
*/
|
|
17437
17448
|
function setOptions(optionsJson) {
|
|
17438
|
-
let details = JSONParse(optionsJson);
|
|
17449
|
+
let details = JSONParse$1(optionsJson);
|
|
17439
17450
|
allOptions = details.options;
|
|
17440
17451
|
let { ruleIds, cwd } = details, { workspaceUri } = details;
|
|
17441
17452
|
workspaceUri !== null && switchWorkspace(workspaceUri), setCwd(cwd);
|
|
@@ -17512,8 +17523,8 @@ function mergeOptions(configOptions, defaultOptions) {
|
|
|
17512
17523
|
* @returns Merged value (mutable)
|
|
17513
17524
|
*/
|
|
17514
17525
|
function mergeValues(configValue, defaultValue) {
|
|
17515
|
-
if (typeof configValue != "object" || !configValue || ArrayIsArray(configValue) || typeof defaultValue != "object" || !defaultValue || ArrayIsArray(defaultValue)) return configValue;
|
|
17516
|
-
for (let key in defaultValue) ObjectHasOwn(configValue, key) ? configValue[key] = mergeValues(configValue[key], defaultValue[key]) : ObjectDefineProperty(configValue, key, {
|
|
17526
|
+
if (typeof configValue != "object" || !configValue || ArrayIsArray$3(configValue) || typeof defaultValue != "object" || !defaultValue || ArrayIsArray$3(defaultValue)) return configValue;
|
|
17527
|
+
for (let key in defaultValue) ObjectHasOwn(configValue, key) ? configValue[key] = mergeValues(configValue[key], defaultValue[key]) : ObjectDefineProperty$3(configValue, key, {
|
|
17517
17528
|
value: deepCloneJsonValue(defaultValue[key]),
|
|
17518
17529
|
writable: !0,
|
|
17519
17530
|
enumerable: !0,
|
|
@@ -17523,6 +17534,7 @@ function mergeValues(configValue, defaultValue) {
|
|
|
17523
17534
|
}
|
|
17524
17535
|
//#endregion
|
|
17525
17536
|
//#region src-js/plugins/load.ts
|
|
17537
|
+
const JSONStringify$1 = JSON.stringify, ObjectKeys$1 = Object.keys, ArrayIsArray$2 = Array.isArray, ObjectDefineProperty$2 = Object.defineProperty, JSONParse = JSON.parse;
|
|
17526
17538
|
let registeredRules = [];
|
|
17527
17539
|
/**
|
|
17528
17540
|
* Set `registeredRules`. Used when switching workspaces.
|
|
@@ -17546,9 +17558,9 @@ const neverRunBeforeHook = () => !1;
|
|
|
17546
17558
|
async function loadPlugin(url, pluginName, pluginNameIsAlias, workspaceUri) {
|
|
17547
17559
|
try {
|
|
17548
17560
|
let plugin = (await import(url)).default;
|
|
17549
|
-
return JSONStringify({ Success: registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) });
|
|
17561
|
+
return JSONStringify$1({ Success: registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) });
|
|
17550
17562
|
} catch (err) {
|
|
17551
|
-
return JSONStringify({ Failure: getErrorMessage(err) });
|
|
17563
|
+
return JSONStringify$1({ Failure: getErrorMessage(err) });
|
|
17552
17564
|
}
|
|
17553
17565
|
}
|
|
17554
17566
|
/**
|
|
@@ -17565,7 +17577,7 @@ async function loadPlugin(url, pluginName, pluginNameIsAlias, workspaceUri) {
|
|
|
17565
17577
|
*/
|
|
17566
17578
|
function registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) {
|
|
17567
17579
|
pluginName = getPluginName(plugin, pluginName, pluginNameIsAlias), workspaceUri !== null && switchWorkspace(workspaceUri);
|
|
17568
|
-
let offset = registeredRules.length, { rules } = plugin, ruleNames = ObjectKeys(rules), ruleNamesLen = ruleNames.length;
|
|
17580
|
+
let offset = registeredRules.length, { rules } = plugin, ruleNames = ObjectKeys$1(rules), ruleNamesLen = ruleNames.length;
|
|
17569
17581
|
for (let i = 0; i < ruleNamesLen; i++) {
|
|
17570
17582
|
let ruleName = ruleNames[i], rule = rules[ruleName], fullRuleName = `${pluginName}/${ruleName}`, isFixable = !1, hasSuggestions = !1, messages = null, defaultOptions = DEFAULT_OPTIONS, schemaValidator = null, ruleMeta = rule.meta;
|
|
17571
17583
|
if (ruleMeta != null) {
|
|
@@ -17581,7 +17593,7 @@ function registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) {
|
|
|
17581
17593
|
schemaValidator = compileSchema(ruleMeta.schema);
|
|
17582
17594
|
let inputDefaultOptions = ruleMeta.defaultOptions;
|
|
17583
17595
|
if (inputDefaultOptions != null) {
|
|
17584
|
-
if (!ArrayIsArray(inputDefaultOptions)) throw TypeError("`rule.meta.defaultOptions` must be an array if provided");
|
|
17596
|
+
if (!ArrayIsArray$2(inputDefaultOptions)) throw TypeError("`rule.meta.defaultOptions` must be an array if provided");
|
|
17585
17597
|
if (inputDefaultOptions.length !== 0) {
|
|
17586
17598
|
if (defaultOptions = conformDefaultOptions(inputDefaultOptions), schemaValidator === null) throw Error(`Rule ${fullRuleName}:\nRules which accept options must provide a schema as \`rule.meta.schema\`, or disable schema validation with \`rule.meta.schema: false\` (not recommended).`);
|
|
17587
17599
|
schemaValidator !== !1 && schemaValidator(defaultOptions, fullRuleName), deepFreezeJsonArray(defaultOptions);
|
|
@@ -17610,9 +17622,9 @@ function registerPlugin(plugin, pluginName, pluginNameIsAlias, workspaceUri) {
|
|
|
17610
17622
|
let visitorWithHooks = rule.createOnce(context);
|
|
17611
17623
|
if (typeof visitorWithHooks != "object" || !visitorWithHooks) throw TypeError("`createOnce` must return an object");
|
|
17612
17624
|
let { before: beforeHook, after: afterHook, ...visitor } = visitorWithHooks;
|
|
17613
|
-
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;
|
|
17625
|
+
beforeHook = conformHookFn(beforeHook, "before"), afterHook = conformHookFn(afterHook, "after"), ObjectKeys$1(visitor).length === 0 && (beforeHook = neverRunBeforeHook, afterHook = null), ruleDetails.visitor = visitor, ruleDetails.beforeHook = beforeHook, ruleDetails.afterHook = afterHook;
|
|
17614
17626
|
}
|
|
17615
|
-
ObjectDefineProperty(ruleDetails.context, "id", { value: fullRuleName }), registeredRules.push(ruleDetails);
|
|
17627
|
+
ObjectDefineProperty$2(ruleDetails.context, "id", { value: fullRuleName }), registeredRules.push(ruleDetails);
|
|
17616
17628
|
}
|
|
17617
17629
|
return {
|
|
17618
17630
|
name: pluginName,
|
|
@@ -17646,12 +17658,15 @@ function getPluginName(plugin, pluginName, pluginNameIsAlias) {
|
|
|
17646
17658
|
throw Error("Plugin must either define `meta.name`, be loaded from an NPM package with a `name` field in `package.json`, or be given an alias in config");
|
|
17647
17659
|
}
|
|
17648
17660
|
/**
|
|
17649
|
-
* Normalize plugin name by stripping common
|
|
17661
|
+
* Normalize plugin name by stripping common plugin prefixes and suffixes.
|
|
17650
17662
|
*
|
|
17651
|
-
* This handles the various naming conventions used in the ESLint
|
|
17663
|
+
* This handles the various naming conventions used in the ESLint and Oxlint plugin ecosystems:
|
|
17652
17664
|
* - `eslint-plugin-foo` -> `foo`
|
|
17665
|
+
* - `oxlint-plugin-foo` -> `foo`
|
|
17653
17666
|
* - `@scope/eslint-plugin` -> `@scope`
|
|
17654
17667
|
* - `@scope/eslint-plugin-foo` -> `@scope/foo`
|
|
17668
|
+
* - `@scope/oxlint-plugin` -> `@scope`
|
|
17669
|
+
* - `@scope/oxlint-plugin-foo` -> `@scope/foo`
|
|
17655
17670
|
*
|
|
17656
17671
|
* This logic is replicated on Rust side in `normalize_plugin_name` in `crates/oxc_linter/src/config/plugins.rs`.
|
|
17657
17672
|
* The 2 implementations must be kept in sync.
|
|
@@ -17660,10 +17675,21 @@ function getPluginName(plugin, pluginName, pluginNameIsAlias) {
|
|
|
17660
17675
|
* @returns Normalized plugin name
|
|
17661
17676
|
*/
|
|
17662
17677
|
function normalizePluginName(name) {
|
|
17663
|
-
let slashIndex = name.indexOf("/");
|
|
17664
|
-
if (slashIndex === -1)
|
|
17678
|
+
let pluginPrefixes = ["eslint-plugin", "oxlint-plugin"], slashIndex = name.indexOf("/");
|
|
17679
|
+
if (slashIndex === -1) {
|
|
17680
|
+
for (let prefix of pluginPrefixes) {
|
|
17681
|
+
let prefixWithDash = `${prefix}-`;
|
|
17682
|
+
if (name.startsWith(prefixWithDash)) return name.slice(prefixWithDash.length);
|
|
17683
|
+
}
|
|
17684
|
+
return name;
|
|
17685
|
+
}
|
|
17665
17686
|
let scope = name.slice(0, slashIndex), rest = name.slice(slashIndex + 1);
|
|
17666
|
-
|
|
17687
|
+
for (let prefix of pluginPrefixes) {
|
|
17688
|
+
if (rest === prefix) return scope;
|
|
17689
|
+
let prefixWithDash = `${prefix}-`;
|
|
17690
|
+
if (rest.startsWith(prefixWithDash)) return `${scope}/${rest.slice(prefixWithDash.length)}`;
|
|
17691
|
+
}
|
|
17692
|
+
return name;
|
|
17667
17693
|
}
|
|
17668
17694
|
/**
|
|
17669
17695
|
* Serialize default options to JSON and deserialize again.
|
|
@@ -17681,18 +17707,18 @@ function normalizePluginName(name) {
|
|
|
17681
17707
|
function conformDefaultOptions(defaultOptions) {
|
|
17682
17708
|
let json, containsInfinity = !1;
|
|
17683
17709
|
try {
|
|
17684
|
-
json = JSONStringify(defaultOptions, (key, value) => value === Infinity || value === -Infinity ? (containsInfinity = !0, value === Infinity ? POS_INFINITY_PLACEHOLDER : NEG_INFINITY_PLACEHOLDER) : value);
|
|
17710
|
+
json = JSONStringify$1(defaultOptions, (key, value) => value === Infinity || value === -Infinity ? (containsInfinity = !0, value === Infinity ? POS_INFINITY_PLACEHOLDER : NEG_INFINITY_PLACEHOLDER) : value);
|
|
17685
17711
|
} catch (err) {
|
|
17686
17712
|
throw Error(`\`rule.meta.defaultOptions\` must be JSON-serializable: ${getErrorMessage(err)}`);
|
|
17687
17713
|
}
|
|
17688
17714
|
if (containsInfinity) {
|
|
17689
|
-
let plainJson = JSONStringify(defaultOptions);
|
|
17715
|
+
let plainJson = JSONStringify$1(defaultOptions);
|
|
17690
17716
|
if (plainJson.includes(POS_INFINITY_PLACEHOLDER) || plainJson.includes(NEG_INFINITY_PLACEHOLDER)) throw Error(`\`rule.meta.defaultOptions\` cannot contain the strings "${POS_INFINITY_PLACEHOLDER}" or "${NEG_INFINITY_PLACEHOLDER}"`);
|
|
17691
17717
|
json = json.replaceAll(POS_INFINITY_PLACEHOLDER_STR, "1e+400").replaceAll(NEG_INFINITY_PLACEHOLDER_STR, "-1e+400");
|
|
17692
17718
|
}
|
|
17693
17719
|
return JSONParse(json);
|
|
17694
17720
|
}
|
|
17695
|
-
const POS_INFINITY_PLACEHOLDER = "$_$_$_POS_INFINITY_$_$_$", NEG_INFINITY_PLACEHOLDER = "$_$_$_NEG_INFINITY_$_$_$", POS_INFINITY_PLACEHOLDER_STR = JSONStringify(POS_INFINITY_PLACEHOLDER), NEG_INFINITY_PLACEHOLDER_STR = JSONStringify(NEG_INFINITY_PLACEHOLDER);
|
|
17721
|
+
const POS_INFINITY_PLACEHOLDER = "$_$_$_POS_INFINITY_$_$_$", NEG_INFINITY_PLACEHOLDER = "$_$_$_NEG_INFINITY_$_$_$", POS_INFINITY_PLACEHOLDER_STR = JSONStringify$1(POS_INFINITY_PLACEHOLDER), NEG_INFINITY_PLACEHOLDER_STR = JSONStringify$1(NEG_INFINITY_PLACEHOLDER);
|
|
17696
17722
|
/**
|
|
17697
17723
|
* Validate and conform `before` / `after` hook function.
|
|
17698
17724
|
* @param hookFn - Hook function, or `null` / `undefined`
|
|
@@ -17706,7 +17732,7 @@ function conformHookFn(hookFn, hookName) {
|
|
|
17706
17732
|
return hookFn;
|
|
17707
17733
|
}
|
|
17708
17734
|
//#endregion
|
|
17709
|
-
//#region ../../node_modules/.pnpm/eslint@10.4.
|
|
17735
|
+
//#region ../../node_modules/.pnpm/eslint@10.4.1/node_modules/eslint/lib/shared/assert.js
|
|
17710
17736
|
/**
|
|
17711
17737
|
* @fileoverview Assertion utilities equivalent to the Node.js node:asserts module.
|
|
17712
17738
|
* @author Josh Goldberg
|
|
@@ -19340,15 +19366,16 @@ var require_assert = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19340
19366
|
forkContext.reachable && (getReturnContext(this).returnedForkContext.add(leavingSegments), getThrowContext(this).thrownForkContext.add(leavingSegments), forkContext.replaceHead(forkContext.makeNext(-1, -1)));
|
|
19341
19367
|
}
|
|
19342
19368
|
/**
|
|
19343
|
-
* Makes a code path segment from the first throwable node to the `catch`
|
|
19344
|
-
* block or the `finally` block
|
|
19369
|
+
* Makes a code path segment from the first throwable node in a `try` block to the `catch`
|
|
19370
|
+
* block or the `finally` block or from the first throwable node in a `catch` block
|
|
19371
|
+
* to the `finally` block.
|
|
19345
19372
|
* @returns {void}
|
|
19346
19373
|
*/
|
|
19347
|
-
|
|
19374
|
+
makeFirstThrowablePathInTryOrCatchBlock() {
|
|
19348
19375
|
let forkContext = this.forkContext;
|
|
19349
19376
|
if (!forkContext.reachable) return;
|
|
19350
19377
|
let context = getThrowContext(this);
|
|
19351
|
-
context === this || context.position !== "try" || !context.
|
|
19378
|
+
context === this || !context.thrownForkContext.empty || context.position !== "try" && (context.position !== "catch" || !context.hasFinalizer) || (context.thrownForkContext.add(forkContext.head), forkContext.replaceHead(forkContext.makeNext(-1, -1)));
|
|
19352
19379
|
}
|
|
19353
19380
|
/**
|
|
19354
19381
|
* Creates a context object of a loop statement and stacks it.
|
|
@@ -20085,13 +20112,13 @@ var require_assert = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20085
20112
|
forwardCurrentToHead(analyzer, node), state.makeThrow(), dontForward = !0;
|
|
20086
20113
|
break;
|
|
20087
20114
|
case "Identifier":
|
|
20088
|
-
isIdentifierReference(node) && (state.
|
|
20115
|
+
isIdentifierReference(node) && (state.makeFirstThrowablePathInTryOrCatchBlock(), dontForward = !0);
|
|
20089
20116
|
break;
|
|
20090
20117
|
case "CallExpression":
|
|
20091
20118
|
case "ImportExpression":
|
|
20092
20119
|
case "MemberExpression":
|
|
20093
20120
|
case "NewExpression":
|
|
20094
|
-
state.
|
|
20121
|
+
state.makeFirstThrowablePathInTryOrCatchBlock();
|
|
20095
20122
|
break;
|
|
20096
20123
|
case "YieldExpression":
|
|
20097
20124
|
state.makeYield();
|
|
@@ -20494,9 +20521,9 @@ const NODE_TYPE_IDS_MAP = new Map([
|
|
|
20494
20521
|
30,
|
|
20495
20522
|
55,
|
|
20496
20523
|
56
|
|
20497
|
-
], ancestors = [];
|
|
20524
|
+
], ArrayIsArray$1 = Array.isArray, ancestors = [];
|
|
20498
20525
|
function walkNode(node, visitors) {
|
|
20499
|
-
if (node != null) if (ArrayIsArray(node)) {
|
|
20526
|
+
if (node != null) if (ArrayIsArray$1(node)) {
|
|
20500
20527
|
let len = node.length;
|
|
20501
20528
|
for (let i = 0; i < len; i++) walkNode(node[i], visitors);
|
|
20502
20529
|
} else switch (node.type) {
|
|
@@ -21659,16 +21686,7 @@ function walkTSUnionType(node, visitors) {
|
|
|
21659
21686
|
}
|
|
21660
21687
|
//#endregion
|
|
21661
21688
|
//#region src-js/plugins/cfg.ts
|
|
21662
|
-
|
|
21663
|
-
* Offset added to type IDs for exit visits to distinguish them from enter visits.
|
|
21664
|
-
* Using 256 as it's a power of 2 and larger than the maximum type ID (171).
|
|
21665
|
-
*
|
|
21666
|
-
* Type ID encoding:
|
|
21667
|
-
* - Enter visit (nodes): 0 to NODE_TYPES_COUNT - 1 (0-164)
|
|
21668
|
-
* - Call method (CFG events): NODE_TYPES_COUNT to TYPE_IDS_COUNT - 1 (165-171)
|
|
21669
|
-
* - Exit visit (non-leaf nodes): Node type ID + EXIT_TYPE_ID_OFFSET (256+)
|
|
21670
|
-
*/
|
|
21671
|
-
const stepTypeIds = [], stepData = [];
|
|
21689
|
+
const ArrayIsArray = Array.isArray, stepTypeIds = [], stepData = [];
|
|
21672
21690
|
/**
|
|
21673
21691
|
* Reset state for walking AST with CFG.
|
|
21674
21692
|
*
|
|
@@ -21791,7 +21809,7 @@ function traverseNode(node, enter, leave) {
|
|
|
21791
21809
|
*
|
|
21792
21810
|
* See: https://github.com/oxc-project/oxc/issues/20700
|
|
21793
21811
|
*/
|
|
21794
|
-
const trackedWeakMaps = [], registry = new FinalizationRegistry((entryToRemove) => {
|
|
21812
|
+
const ObjectDefineProperty$1 = Object.defineProperty, trackedWeakMaps = [], registry = new FinalizationRegistry((entryToRemove) => {
|
|
21795
21813
|
let lastEntry = trackedWeakMaps.pop();
|
|
21796
21814
|
if (lastEntry !== entryToRemove) {
|
|
21797
21815
|
let { index } = entryToRemove;
|
|
@@ -21886,7 +21904,7 @@ var PatchedWeakMap = class extends WeakMap {
|
|
|
21886
21904
|
};
|
|
21887
21905
|
}
|
|
21888
21906
|
};
|
|
21889
|
-
ObjectDefineProperty(PatchedWeakMap, "name", { value: "WeakMap" }), globalThis.WeakMap = PatchedWeakMap;
|
|
21907
|
+
ObjectDefineProperty$1(PatchedWeakMap, "name", { value: "WeakMap" }), globalThis.WeakMap = PatchedWeakMap;
|
|
21890
21908
|
const resetWeakMaps = resetWeakMapsFn, { matches: esqueryMatches, parse: esqueryParse } = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21891
21909
|
(function(e, t) {
|
|
21892
21910
|
typeof exports == "object" && module !== void 0 ? module.exports = t() : typeof define == "function" && define.amd ? define(t) : (e ||= self).esquery = t();
|
|
@@ -23311,7 +23329,9 @@ function wrapVisitFnWithSelectorMatch(visitFn, esquerySelector) {
|
|
|
23311
23329
|
esqueryMatches(node, esquerySelector, ancestors, ESQUERY_OPTIONS) && visitFn(node);
|
|
23312
23330
|
};
|
|
23313
23331
|
}
|
|
23314
|
-
|
|
23332
|
+
//#endregion
|
|
23333
|
+
//#region src-js/plugins/visitor.ts
|
|
23334
|
+
const ObjectKeys = Object.keys, compilingLeafVisitor = [], compilingNonLeafVisitor = [], compilingCfgVisitor = [];
|
|
23315
23335
|
for (let i = 27; i !== 0; i--) compilingLeafVisitor.push([]);
|
|
23316
23336
|
for (let i = 138; i !== 0; i--) compilingNonLeafVisitor.push({
|
|
23317
23337
|
enter: [],
|
|
@@ -23567,7 +23587,9 @@ const mergers = [
|
|
|
23567
23587
|
visit1(...args), visit2(...args), visit3(...args);
|
|
23568
23588
|
};
|
|
23569
23589
|
}
|
|
23570
|
-
],
|
|
23590
|
+
], JSONStringify = JSON.stringify;
|
|
23591
|
+
Array.isArray;
|
|
23592
|
+
const ObjectDefineProperty = Object.defineProperty, buffers = [], afterHooks = [], OPTIONS_DESCRIPTOR = { value: null };
|
|
23571
23593
|
/**
|
|
23572
23594
|
* Lint a file.
|
|
23573
23595
|
*
|