eslint-linter-browserify 9.4.0 → 9.6.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/linter.cjs +1363 -555
- package/linter.js +1363 -555
- package/linter.min.js +2 -2
- package/linter.mjs +1363 -555
- package/package.json +6 -6
package/linter.cjs
CHANGED
|
@@ -8024,7 +8024,7 @@ function requireAcorn () {
|
|
|
8024
8024
|
|
|
8025
8025
|
// ## Parser utilities
|
|
8026
8026
|
|
|
8027
|
-
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")
|
|
8027
|
+
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/s;
|
|
8028
8028
|
pp$9.strictDirective = function(start) {
|
|
8029
8029
|
if (this.options.ecmaVersion < 5) { return false }
|
|
8030
8030
|
for (;;) {
|
|
@@ -8210,7 +8210,7 @@ function requireAcorn () {
|
|
|
8210
8210
|
// Statement) is allowed here. If context is not empty then only a Statement
|
|
8211
8211
|
// is allowed. However, `let [` is an explicit negative lookahead for
|
|
8212
8212
|
// ExpressionStatement, so special-case it first.
|
|
8213
|
-
if (nextCh === 91 || nextCh === 92) { return true } // '[', '
|
|
8213
|
+
if (nextCh === 91 || nextCh === 92) { return true } // '[', '\'
|
|
8214
8214
|
if (context) { return false }
|
|
8215
8215
|
|
|
8216
8216
|
if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral
|
|
@@ -8403,13 +8403,19 @@ function requireAcorn () {
|
|
|
8403
8403
|
return this.parseFor(node, init$1)
|
|
8404
8404
|
}
|
|
8405
8405
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
8406
|
+
var containsEsc = this.containsEsc;
|
|
8406
8407
|
var refDestructuringErrors = new DestructuringErrors;
|
|
8407
|
-
var
|
|
8408
|
+
var initPos = this.start;
|
|
8409
|
+
var init = awaitAt > -1
|
|
8410
|
+
? this.parseExprSubscripts(refDestructuringErrors, "await")
|
|
8411
|
+
: this.parseExpression(true, refDestructuringErrors);
|
|
8408
8412
|
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
8409
|
-
if (
|
|
8410
|
-
if (this.type === types$1._in) {
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
+
if (awaitAt > -1) { // implies `ecmaVersion >= 9` (see declaration of awaitAt)
|
|
8414
|
+
if (this.type === types$1._in) { this.unexpected(awaitAt); }
|
|
8415
|
+
node.await = true;
|
|
8416
|
+
} else if (isForOf && this.options.ecmaVersion >= 8) {
|
|
8417
|
+
if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") { this.unexpected(); }
|
|
8418
|
+
else if (this.options.ecmaVersion >= 9) { node.await = false; }
|
|
8413
8419
|
}
|
|
8414
8420
|
if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); }
|
|
8415
8421
|
this.toAssignable(init, false, refDestructuringErrors);
|
|
@@ -10022,8 +10028,7 @@ function requireAcorn () {
|
|
|
10022
10028
|
node.argument = this.parseMaybeUnary(null, true, update, forInit);
|
|
10023
10029
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
10024
10030
|
if (update) { this.checkLValSimple(node.argument); }
|
|
10025
|
-
else if (this.strict && node.operator === "delete" &&
|
|
10026
|
-
node.argument.type === "Identifier")
|
|
10031
|
+
else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument))
|
|
10027
10032
|
{ this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
|
|
10028
10033
|
else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
|
|
10029
10034
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
@@ -10058,10 +10063,18 @@ function requireAcorn () {
|
|
|
10058
10063
|
}
|
|
10059
10064
|
};
|
|
10060
10065
|
|
|
10066
|
+
function isLocalVariableAccess(node) {
|
|
10067
|
+
return (
|
|
10068
|
+
node.type === "Identifier" ||
|
|
10069
|
+
node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression)
|
|
10070
|
+
)
|
|
10071
|
+
}
|
|
10072
|
+
|
|
10061
10073
|
function isPrivateFieldAccess(node) {
|
|
10062
10074
|
return (
|
|
10063
10075
|
node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
|
|
10064
|
-
node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
|
|
10076
|
+
node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) ||
|
|
10077
|
+
node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression)
|
|
10065
10078
|
)
|
|
10066
10079
|
}
|
|
10067
10080
|
|
|
@@ -10488,7 +10501,7 @@ function requireAcorn () {
|
|
|
10488
10501
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
10489
10502
|
}
|
|
10490
10503
|
elem.value = {
|
|
10491
|
-
raw: this.value,
|
|
10504
|
+
raw: this.value.replace(/\r\n?/g, "\n"),
|
|
10492
10505
|
cooked: null
|
|
10493
10506
|
};
|
|
10494
10507
|
} else {
|
|
@@ -11163,6 +11176,30 @@ function requireAcorn () {
|
|
|
11163
11176
|
|
|
11164
11177
|
var pp$1 = Parser.prototype;
|
|
11165
11178
|
|
|
11179
|
+
// Track disjunction structure to determine whether a duplicate
|
|
11180
|
+
// capture group name is allowed because it is in a separate branch.
|
|
11181
|
+
var BranchID = function BranchID(parent, base) {
|
|
11182
|
+
// Parent disjunction branch
|
|
11183
|
+
this.parent = parent;
|
|
11184
|
+
// Identifies this set of sibling branches
|
|
11185
|
+
this.base = base || this;
|
|
11186
|
+
};
|
|
11187
|
+
|
|
11188
|
+
BranchID.prototype.separatedFrom = function separatedFrom (alt) {
|
|
11189
|
+
// A branch is separate from another branch if they or any of
|
|
11190
|
+
// their parents are siblings in a given disjunction
|
|
11191
|
+
for (var self = this; self; self = self.parent) {
|
|
11192
|
+
for (var other = alt; other; other = other.parent) {
|
|
11193
|
+
if (self.base === other.base && self !== other) { return true }
|
|
11194
|
+
}
|
|
11195
|
+
}
|
|
11196
|
+
return false
|
|
11197
|
+
};
|
|
11198
|
+
|
|
11199
|
+
BranchID.prototype.sibling = function sibling () {
|
|
11200
|
+
return new BranchID(this.parent, this.base)
|
|
11201
|
+
};
|
|
11202
|
+
|
|
11166
11203
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
11167
11204
|
this.parser = parser;
|
|
11168
11205
|
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
@@ -11179,8 +11216,9 @@ function requireAcorn () {
|
|
|
11179
11216
|
this.lastAssertionIsQuantifiable = false;
|
|
11180
11217
|
this.numCapturingParens = 0;
|
|
11181
11218
|
this.maxBackReference = 0;
|
|
11182
|
-
this.groupNames =
|
|
11219
|
+
this.groupNames = Object.create(null);
|
|
11183
11220
|
this.backReferenceNames = [];
|
|
11221
|
+
this.branchID = null;
|
|
11184
11222
|
};
|
|
11185
11223
|
|
|
11186
11224
|
RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
|
|
@@ -11312,6 +11350,11 @@ function requireAcorn () {
|
|
|
11312
11350
|
}
|
|
11313
11351
|
};
|
|
11314
11352
|
|
|
11353
|
+
function hasProp(obj) {
|
|
11354
|
+
for (var _ in obj) { return true }
|
|
11355
|
+
return false
|
|
11356
|
+
}
|
|
11357
|
+
|
|
11315
11358
|
/**
|
|
11316
11359
|
* Validate the pattern part of a given RegExpLiteral.
|
|
11317
11360
|
*
|
|
@@ -11326,7 +11369,7 @@ function requireAcorn () {
|
|
|
11326
11369
|
// |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
|
|
11327
11370
|
// exception if _P_ did not conform to the grammar, if any elements of _P_
|
|
11328
11371
|
// were not matched by the parse, or if any Early Error conditions exist.
|
|
11329
|
-
if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames
|
|
11372
|
+
if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {
|
|
11330
11373
|
state.switchN = true;
|
|
11331
11374
|
this.regexp_pattern(state);
|
|
11332
11375
|
}
|
|
@@ -11340,8 +11383,9 @@ function requireAcorn () {
|
|
|
11340
11383
|
state.lastAssertionIsQuantifiable = false;
|
|
11341
11384
|
state.numCapturingParens = 0;
|
|
11342
11385
|
state.maxBackReference = 0;
|
|
11343
|
-
state.groupNames
|
|
11386
|
+
state.groupNames = Object.create(null);
|
|
11344
11387
|
state.backReferenceNames.length = 0;
|
|
11388
|
+
state.branchID = null;
|
|
11345
11389
|
|
|
11346
11390
|
this.regexp_disjunction(state);
|
|
11347
11391
|
|
|
@@ -11360,7 +11404,7 @@ function requireAcorn () {
|
|
|
11360
11404
|
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
|
|
11361
11405
|
var name = list[i];
|
|
11362
11406
|
|
|
11363
|
-
if (state.groupNames
|
|
11407
|
+
if (!state.groupNames[name]) {
|
|
11364
11408
|
state.raise("Invalid named capture referenced");
|
|
11365
11409
|
}
|
|
11366
11410
|
}
|
|
@@ -11368,10 +11412,14 @@ function requireAcorn () {
|
|
|
11368
11412
|
|
|
11369
11413
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
11370
11414
|
pp$1.regexp_disjunction = function(state) {
|
|
11415
|
+
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
11416
|
+
if (trackDisjunction) { state.branchID = new BranchID(state.branchID, null); }
|
|
11371
11417
|
this.regexp_alternative(state);
|
|
11372
11418
|
while (state.eat(0x7C /* | */)) {
|
|
11419
|
+
if (trackDisjunction) { state.branchID = state.branchID.sibling(); }
|
|
11373
11420
|
this.regexp_alternative(state);
|
|
11374
11421
|
}
|
|
11422
|
+
if (trackDisjunction) { state.branchID = state.branchID.parent; }
|
|
11375
11423
|
|
|
11376
11424
|
// Make the same message as V8.
|
|
11377
11425
|
if (this.regexp_eatQuantifier(state, true)) {
|
|
@@ -11384,8 +11432,7 @@ function requireAcorn () {
|
|
|
11384
11432
|
|
|
11385
11433
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
11386
11434
|
pp$1.regexp_alternative = function(state) {
|
|
11387
|
-
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
11388
|
-
{ }
|
|
11435
|
+
while (state.pos < state.source.length && this.regexp_eatTerm(state)) {}
|
|
11389
11436
|
};
|
|
11390
11437
|
|
|
11391
11438
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
@@ -11623,14 +11670,26 @@ function requireAcorn () {
|
|
|
11623
11670
|
// `?` GroupName
|
|
11624
11671
|
pp$1.regexp_groupSpecifier = function(state) {
|
|
11625
11672
|
if (state.eat(0x3F /* ? */)) {
|
|
11626
|
-
if (this.regexp_eatGroupName(state)) {
|
|
11627
|
-
|
|
11673
|
+
if (!this.regexp_eatGroupName(state)) { state.raise("Invalid group"); }
|
|
11674
|
+
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
11675
|
+
var known = state.groupNames[state.lastStringValue];
|
|
11676
|
+
if (known) {
|
|
11677
|
+
if (trackDisjunction) {
|
|
11678
|
+
for (var i = 0, list = known; i < list.length; i += 1) {
|
|
11679
|
+
var altID = list[i];
|
|
11680
|
+
|
|
11681
|
+
if (!altID.separatedFrom(state.branchID))
|
|
11682
|
+
{ state.raise("Duplicate capture group name"); }
|
|
11683
|
+
}
|
|
11684
|
+
} else {
|
|
11628
11685
|
state.raise("Duplicate capture group name");
|
|
11629
11686
|
}
|
|
11630
|
-
state.groupNames.push(state.lastStringValue);
|
|
11631
|
-
return
|
|
11632
11687
|
}
|
|
11633
|
-
|
|
11688
|
+
if (trackDisjunction) {
|
|
11689
|
+
(known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
|
|
11690
|
+
} else {
|
|
11691
|
+
state.groupNames[state.lastStringValue] = true;
|
|
11692
|
+
}
|
|
11634
11693
|
}
|
|
11635
11694
|
};
|
|
11636
11695
|
|
|
@@ -13135,15 +13194,18 @@ function requireAcorn () {
|
|
|
13135
13194
|
break
|
|
13136
13195
|
|
|
13137
13196
|
case "$":
|
|
13138
|
-
if (this.input[this.pos + 1] !== "{") {
|
|
13139
|
-
|
|
13140
|
-
}
|
|
13141
|
-
|
|
13142
|
-
// falls through
|
|
13197
|
+
if (this.input[this.pos + 1] !== "{") { break }
|
|
13198
|
+
// fall through
|
|
13143
13199
|
case "`":
|
|
13144
13200
|
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
13145
13201
|
|
|
13146
|
-
|
|
13202
|
+
case "\r":
|
|
13203
|
+
if (this.input[this.pos + 1] === "\n") { ++this.pos; }
|
|
13204
|
+
// fall through
|
|
13205
|
+
case "\n": case "\u2028": case "\u2029":
|
|
13206
|
+
++this.curLine;
|
|
13207
|
+
this.lineStart = this.pos + 1;
|
|
13208
|
+
break
|
|
13147
13209
|
}
|
|
13148
13210
|
}
|
|
13149
13211
|
this.raise(this.start, "Unterminated template");
|
|
@@ -13206,6 +13268,7 @@ function requireAcorn () {
|
|
|
13206
13268
|
if (isNewLine(ch)) {
|
|
13207
13269
|
// Unicode new line characters after \ get removed from output in both
|
|
13208
13270
|
// template literals and strings
|
|
13271
|
+
if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
|
|
13209
13272
|
return ""
|
|
13210
13273
|
}
|
|
13211
13274
|
return String.fromCharCode(ch)
|
|
@@ -13284,7 +13347,7 @@ function requireAcorn () {
|
|
|
13284
13347
|
// [walk]: util/walk.js
|
|
13285
13348
|
|
|
13286
13349
|
|
|
13287
|
-
var version = "8.
|
|
13350
|
+
var version = "8.12.0";
|
|
13288
13351
|
|
|
13289
13352
|
Parser.acorn = {
|
|
13290
13353
|
Parser: Parser,
|
|
@@ -14595,7 +14658,7 @@ function requireEspree () {
|
|
|
14595
14658
|
*/
|
|
14596
14659
|
function convertTemplatePart(tokens, code) {
|
|
14597
14660
|
const firstToken = tokens[0],
|
|
14598
|
-
lastTemplateToken = tokens
|
|
14661
|
+
lastTemplateToken = tokens.at(-1);
|
|
14599
14662
|
|
|
14600
14663
|
const token = {
|
|
14601
14664
|
type: Token.Template,
|
|
@@ -14832,7 +14895,8 @@ function requireEspree () {
|
|
|
14832
14895
|
12, // 2021
|
|
14833
14896
|
13, // 2022
|
|
14834
14897
|
14, // 2023
|
|
14835
|
-
15 // 2024
|
|
14898
|
+
15, // 2024
|
|
14899
|
+
16 // 2025
|
|
14836
14900
|
];
|
|
14837
14901
|
|
|
14838
14902
|
/**
|
|
@@ -14840,7 +14904,7 @@ function requireEspree () {
|
|
|
14840
14904
|
* @returns {number} The latest ECMAScript version.
|
|
14841
14905
|
*/
|
|
14842
14906
|
function getLatestEcmaVersion() {
|
|
14843
|
-
return SUPPORTED_VERSIONS
|
|
14907
|
+
return SUPPORTED_VERSIONS.at(-1);
|
|
14844
14908
|
}
|
|
14845
14909
|
|
|
14846
14910
|
/**
|
|
@@ -15282,9 +15346,64 @@ function requireEspree () {
|
|
|
15282
15346
|
};
|
|
15283
15347
|
};
|
|
15284
15348
|
|
|
15285
|
-
const version$1 = "10.0
|
|
15349
|
+
const version$1 = "10.1.0";
|
|
15286
15350
|
|
|
15287
|
-
|
|
15351
|
+
/**
|
|
15352
|
+
* @fileoverview Main Espree file that converts Acorn into Esprima output.
|
|
15353
|
+
*
|
|
15354
|
+
* This file contains code from the following MIT-licensed projects:
|
|
15355
|
+
* 1. Acorn
|
|
15356
|
+
* 2. Babylon
|
|
15357
|
+
* 3. Babel-ESLint
|
|
15358
|
+
*
|
|
15359
|
+
* This file also contains code from Esprima, which is BSD licensed.
|
|
15360
|
+
*
|
|
15361
|
+
* Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)
|
|
15362
|
+
* Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)
|
|
15363
|
+
* Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie <sebmck@gmail.com>
|
|
15364
|
+
*
|
|
15365
|
+
* Redistribution and use in source and binary forms, with or without
|
|
15366
|
+
* modification, are permitted provided that the following conditions are met:
|
|
15367
|
+
*
|
|
15368
|
+
* * Redistributions of source code must retain the above copyright
|
|
15369
|
+
* notice, this list of conditions and the following disclaimer.
|
|
15370
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
15371
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
15372
|
+
* documentation and/or other materials provided with the distribution.
|
|
15373
|
+
*
|
|
15374
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
15375
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
15376
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
15377
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
15378
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
15379
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
15380
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
15381
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
15382
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
15383
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
15384
|
+
*
|
|
15385
|
+
* Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
|
|
15386
|
+
*
|
|
15387
|
+
* Redistribution and use in source and binary forms, with or without
|
|
15388
|
+
* modification, are permitted provided that the following conditions are met:
|
|
15389
|
+
*
|
|
15390
|
+
* * Redistributions of source code must retain the above copyright
|
|
15391
|
+
* notice, this list of conditions and the following disclaimer.
|
|
15392
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
15393
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
15394
|
+
* documentation and/or other materials provided with the distribution.
|
|
15395
|
+
*
|
|
15396
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
15397
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
15398
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
15399
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
15400
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
15401
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
15402
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
15403
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
15404
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
15405
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
15406
|
+
*/
|
|
15288
15407
|
|
|
15289
15408
|
|
|
15290
15409
|
// To initialize lazily.
|
|
@@ -15380,7 +15499,7 @@ function requireEspree () {
|
|
|
15380
15499
|
}
|
|
15381
15500
|
|
|
15382
15501
|
for (key in VisitorKeys) {
|
|
15383
|
-
if (Object.
|
|
15502
|
+
if (Object.hasOwn(VisitorKeys, key)) {
|
|
15384
15503
|
types[key] = key;
|
|
15385
15504
|
}
|
|
15386
15505
|
}
|
|
@@ -17382,7 +17501,7 @@ function requireLodash_merge () {
|
|
|
17382
17501
|
}
|
|
17383
17502
|
|
|
17384
17503
|
var name = "eslint";
|
|
17385
|
-
var version = "9.
|
|
17504
|
+
var version = "9.6.0";
|
|
17386
17505
|
var author = "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>";
|
|
17387
17506
|
var description$2 = "An AST-based pattern checker for JavaScript.";
|
|
17388
17507
|
var bin = {
|
|
@@ -17430,15 +17549,15 @@ var files = [
|
|
|
17430
17549
|
"messages"
|
|
17431
17550
|
];
|
|
17432
17551
|
var repository = "eslint/eslint";
|
|
17433
|
-
var funding = "https://
|
|
17552
|
+
var funding = "https://eslint.org/donate";
|
|
17434
17553
|
var homepage = "https://eslint.org";
|
|
17435
17554
|
var bugs = "https://github.com/eslint/eslint/issues/";
|
|
17436
17555
|
var dependencies$2 = {
|
|
17437
17556
|
"@eslint-community/eslint-utils": "^4.2.0",
|
|
17438
17557
|
"@eslint-community/regexpp": "^4.6.1",
|
|
17439
|
-
"@eslint/config-array": "^0.
|
|
17558
|
+
"@eslint/config-array": "^0.17.0",
|
|
17440
17559
|
"@eslint/eslintrc": "^3.1.0",
|
|
17441
|
-
"@eslint/js": "9.
|
|
17560
|
+
"@eslint/js": "9.6.0",
|
|
17442
17561
|
"@humanwhocodes/module-importer": "^1.0.1",
|
|
17443
17562
|
"@humanwhocodes/retry": "^0.3.0",
|
|
17444
17563
|
"@nodelib/fs.walk": "^1.2.8",
|
|
@@ -17449,8 +17568,8 @@ var dependencies$2 = {
|
|
|
17449
17568
|
"escape-string-regexp": "^4.0.0",
|
|
17450
17569
|
"eslint-scope": "^8.0.1",
|
|
17451
17570
|
"eslint-visitor-keys": "^4.0.0",
|
|
17452
|
-
espree: "^10.0
|
|
17453
|
-
esquery: "^1.
|
|
17571
|
+
espree: "^10.1.0",
|
|
17572
|
+
esquery: "^1.5.0",
|
|
17454
17573
|
esutils: "^2.0.2",
|
|
17455
17574
|
"fast-deep-equal": "^3.1.3",
|
|
17456
17575
|
"file-entry-cache": "^8.0.0",
|
|
@@ -17472,14 +17591,12 @@ var dependencies$2 = {
|
|
|
17472
17591
|
var devDependencies = {
|
|
17473
17592
|
"@babel/core": "^7.4.3",
|
|
17474
17593
|
"@babel/preset-env": "^7.4.3",
|
|
17475
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
|
|
17476
17594
|
"@types/estree": "^1.0.5",
|
|
17477
17595
|
"@types/node": "^20.11.5",
|
|
17478
|
-
"@wdio/browser-runner": "^8.
|
|
17479
|
-
"@wdio/cli": "^8.
|
|
17480
|
-
"@wdio/concise-reporter": "^8.
|
|
17481
|
-
"@wdio/
|
|
17482
|
-
"@wdio/mocha-framework": "^8.14.0",
|
|
17596
|
+
"@wdio/browser-runner": "^8.38.3",
|
|
17597
|
+
"@wdio/cli": "^8.38.2",
|
|
17598
|
+
"@wdio/concise-reporter": "^8.38.2",
|
|
17599
|
+
"@wdio/mocha-framework": "^8.38.2",
|
|
17483
17600
|
"babel-loader": "^8.0.5",
|
|
17484
17601
|
c8: "^7.12.0",
|
|
17485
17602
|
chai: "^4.0.1",
|
|
@@ -17490,11 +17607,8 @@ var devDependencies = {
|
|
|
17490
17607
|
eslint: "file:.",
|
|
17491
17608
|
"eslint-config-eslint": "file:packages/eslint-config-eslint",
|
|
17492
17609
|
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
17493
|
-
"eslint-plugin-internal-rules": "file:tools/internal-rules",
|
|
17494
|
-
"eslint-plugin-jsdoc": "^48.2.3",
|
|
17495
|
-
"eslint-plugin-n": "^17.2.0",
|
|
17496
|
-
"eslint-plugin-unicorn": "^52.0.0",
|
|
17497
17610
|
"eslint-release": "^3.2.2",
|
|
17611
|
+
"eslint-rule-composer": "^0.3.0",
|
|
17498
17612
|
eslump: "^3.0.0",
|
|
17499
17613
|
esprima: "^4.0.1",
|
|
17500
17614
|
"fast-glob": "^3.2.11",
|
|
@@ -17504,13 +17618,13 @@ var devDependencies = {
|
|
|
17504
17618
|
got: "^11.8.3",
|
|
17505
17619
|
"gray-matter": "^4.0.3",
|
|
17506
17620
|
"js-yaml": "^4.1.0",
|
|
17507
|
-
knip: "^5.
|
|
17621
|
+
knip: "^5.21.0",
|
|
17508
17622
|
"lint-staged": "^11.0.0",
|
|
17509
17623
|
"load-perf": "^0.2.0",
|
|
17510
17624
|
"markdown-it": "^12.2.0",
|
|
17511
17625
|
"markdown-it-container": "^3.0.0",
|
|
17512
17626
|
markdownlint: "^0.34.0",
|
|
17513
|
-
"markdownlint-cli": "^0.
|
|
17627
|
+
"markdownlint-cli": "^0.41.0",
|
|
17514
17628
|
marked: "^4.0.8",
|
|
17515
17629
|
metascraper: "^5.25.7",
|
|
17516
17630
|
"metascraper-description": "^5.25.7",
|
|
@@ -17583,44 +17697,6 @@ var require$$5 = {
|
|
|
17583
17697
|
engines: engines
|
|
17584
17698
|
};
|
|
17585
17699
|
|
|
17586
|
-
/**
|
|
17587
|
-
* @fileoverview Common utils for AST.
|
|
17588
|
-
*
|
|
17589
|
-
* This file contains only shared items for core and rules.
|
|
17590
|
-
* If you make a utility for rules, please see `../rules/utils/ast-utils.js`.
|
|
17591
|
-
*
|
|
17592
|
-
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
17593
|
-
*/
|
|
17594
|
-
|
|
17595
|
-
var astUtils$1;
|
|
17596
|
-
var hasRequiredAstUtils$1;
|
|
17597
|
-
|
|
17598
|
-
function requireAstUtils$1 () {
|
|
17599
|
-
if (hasRequiredAstUtils$1) return astUtils$1;
|
|
17600
|
-
hasRequiredAstUtils$1 = 1;
|
|
17601
|
-
|
|
17602
|
-
const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/u;
|
|
17603
|
-
const lineBreakPattern = /\r\n|[\r\n\u2028\u2029]/u;
|
|
17604
|
-
const shebangPattern = /^#!([^\r\n]+)/u;
|
|
17605
|
-
|
|
17606
|
-
/**
|
|
17607
|
-
* Creates a version of the `lineBreakPattern` regex with the global flag.
|
|
17608
|
-
* Global regexes are mutable, so this needs to be a function instead of a constant.
|
|
17609
|
-
* @returns {RegExp} A global regular expression that matches line terminators
|
|
17610
|
-
*/
|
|
17611
|
-
function createGlobalLinebreakMatcher() {
|
|
17612
|
-
return new RegExp(lineBreakPattern.source, "gu");
|
|
17613
|
-
}
|
|
17614
|
-
|
|
17615
|
-
astUtils$1 = {
|
|
17616
|
-
breakableTypePattern,
|
|
17617
|
-
lineBreakPattern,
|
|
17618
|
-
createGlobalLinebreakMatcher,
|
|
17619
|
-
shebangPattern
|
|
17620
|
-
};
|
|
17621
|
-
return astUtils$1;
|
|
17622
|
-
}
|
|
17623
|
-
|
|
17624
17700
|
/**
|
|
17625
17701
|
* @fileoverview Common utils for directives.
|
|
17626
17702
|
*
|
|
@@ -33416,6 +33492,44 @@ function requireTokenStore () {
|
|
|
33416
33492
|
return tokenStore;
|
|
33417
33493
|
}
|
|
33418
33494
|
|
|
33495
|
+
/**
|
|
33496
|
+
* @fileoverview Common utils for AST.
|
|
33497
|
+
*
|
|
33498
|
+
* This file contains only shared items for core and rules.
|
|
33499
|
+
* If you make a utility for rules, please see `../rules/utils/ast-utils.js`.
|
|
33500
|
+
*
|
|
33501
|
+
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
33502
|
+
*/
|
|
33503
|
+
|
|
33504
|
+
var astUtils$1;
|
|
33505
|
+
var hasRequiredAstUtils$1;
|
|
33506
|
+
|
|
33507
|
+
function requireAstUtils$1 () {
|
|
33508
|
+
if (hasRequiredAstUtils$1) return astUtils$1;
|
|
33509
|
+
hasRequiredAstUtils$1 = 1;
|
|
33510
|
+
|
|
33511
|
+
const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/u;
|
|
33512
|
+
const lineBreakPattern = /\r\n|[\r\n\u2028\u2029]/u;
|
|
33513
|
+
const shebangPattern = /^#!([^\r\n]+)/u;
|
|
33514
|
+
|
|
33515
|
+
/**
|
|
33516
|
+
* Creates a version of the `lineBreakPattern` regex with the global flag.
|
|
33517
|
+
* Global regexes are mutable, so this needs to be a function instead of a constant.
|
|
33518
|
+
* @returns {RegExp} A global regular expression that matches line terminators
|
|
33519
|
+
*/
|
|
33520
|
+
function createGlobalLinebreakMatcher() {
|
|
33521
|
+
return new RegExp(lineBreakPattern.source, "gu");
|
|
33522
|
+
}
|
|
33523
|
+
|
|
33524
|
+
astUtils$1 = {
|
|
33525
|
+
breakableTypePattern,
|
|
33526
|
+
lineBreakPattern,
|
|
33527
|
+
createGlobalLinebreakMatcher,
|
|
33528
|
+
shebangPattern
|
|
33529
|
+
};
|
|
33530
|
+
return astUtils$1;
|
|
33531
|
+
}
|
|
33532
|
+
|
|
33419
33533
|
/**
|
|
33420
33534
|
* @fileoverview Globals for ecmaVersion/sourceType
|
|
33421
33535
|
* @author Nicholas C. Zakas
|
|
@@ -33556,6 +33670,10 @@ function requireGlobals () {
|
|
|
33556
33670
|
...es2023
|
|
33557
33671
|
};
|
|
33558
33672
|
|
|
33673
|
+
const es2025 = {
|
|
33674
|
+
...es2024
|
|
33675
|
+
};
|
|
33676
|
+
|
|
33559
33677
|
|
|
33560
33678
|
//-----------------------------------------------------------------------------
|
|
33561
33679
|
// Exports
|
|
@@ -33574,7 +33692,8 @@ function requireGlobals () {
|
|
|
33574
33692
|
es2021,
|
|
33575
33693
|
es2022,
|
|
33576
33694
|
es2023,
|
|
33577
|
-
es2024
|
|
33695
|
+
es2024,
|
|
33696
|
+
es2025
|
|
33578
33697
|
};
|
|
33579
33698
|
return globals;
|
|
33580
33699
|
}
|
|
@@ -40371,12 +40490,6 @@ function requireConfigCommentParser () {
|
|
|
40371
40490
|
|
|
40372
40491
|
const debug = requireSrc()("eslint:config-comment-parser");
|
|
40373
40492
|
|
|
40374
|
-
//------------------------------------------------------------------------------
|
|
40375
|
-
// Typedefs
|
|
40376
|
-
//------------------------------------------------------------------------------
|
|
40377
|
-
|
|
40378
|
-
/** @typedef {import("../shared/types").LintMessage} LintMessage */
|
|
40379
|
-
|
|
40380
40493
|
//------------------------------------------------------------------------------
|
|
40381
40494
|
// Public Interface
|
|
40382
40495
|
//------------------------------------------------------------------------------
|
|
@@ -40418,10 +40531,9 @@ function requireConfigCommentParser () {
|
|
|
40418
40531
|
/**
|
|
40419
40532
|
* Parses a JSON-like config.
|
|
40420
40533
|
* @param {string} string The string to parse.
|
|
40421
|
-
* @
|
|
40422
|
-
* @returns {({success: true, config: Object}|{success: false, error: LintMessage})} Result map object
|
|
40534
|
+
* @returns {({success: true, config: Object}|{success: false, error: {message: string}})} Result map object
|
|
40423
40535
|
*/
|
|
40424
|
-
parseJsonConfig(string
|
|
40536
|
+
parseJsonConfig(string) {
|
|
40425
40537
|
debug("Parsing JSON config");
|
|
40426
40538
|
|
|
40427
40539
|
// Parses a JSON-like comment by the same way as parsing CLI option.
|
|
@@ -40464,13 +40576,7 @@ function requireConfigCommentParser () {
|
|
|
40464
40576
|
return {
|
|
40465
40577
|
success: false,
|
|
40466
40578
|
error: {
|
|
40467
|
-
|
|
40468
|
-
fatal: true,
|
|
40469
|
-
severity: 2,
|
|
40470
|
-
message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`,
|
|
40471
|
-
line: location.start.line,
|
|
40472
|
-
column: location.start.column + 1,
|
|
40473
|
-
nodeType: null
|
|
40579
|
+
message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`
|
|
40474
40580
|
}
|
|
40475
40581
|
};
|
|
40476
40582
|
|
|
@@ -40558,11 +40664,9 @@ function requireSourceCode$1 () {
|
|
|
40558
40664
|
directivesPattern
|
|
40559
40665
|
} = requireDirectives(),
|
|
40560
40666
|
|
|
40561
|
-
/* eslint-disable n/no-restricted-require -- Should eventually be moved into SourceCode. */
|
|
40562
40667
|
CodePathAnalyzer = requireCodePathAnalyzer(),
|
|
40563
40668
|
createEmitter = requireSafeEmitter(),
|
|
40564
40669
|
ConfigCommentParser = requireConfigCommentParser(),
|
|
40565
|
-
/* eslint-enable n/no-restricted-require -- Should eventually be moved into SourceCode. */
|
|
40566
40670
|
|
|
40567
40671
|
eslintScope = requireEslintScope();
|
|
40568
40672
|
|
|
@@ -40981,24 +41085,28 @@ function requireSourceCode$1 () {
|
|
|
40981
41085
|
#steps;
|
|
40982
41086
|
|
|
40983
41087
|
/**
|
|
41088
|
+
* Creates a new instance.
|
|
40984
41089
|
* @param {string|Object} textOrConfig The source code text or config object.
|
|
40985
41090
|
* @param {string} textOrConfig.text The source code text.
|
|
40986
41091
|
* @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
|
|
41092
|
+
* @param {boolean} textOrConfig.hasBOM Indicates if the text has a Unicode BOM.
|
|
40987
41093
|
* @param {Object|null} textOrConfig.parserServices The parser services.
|
|
40988
41094
|
* @param {ScopeManager|null} textOrConfig.scopeManager The scope of this source code.
|
|
40989
41095
|
* @param {Object|null} textOrConfig.visitorKeys The visitor keys to traverse AST.
|
|
40990
41096
|
* @param {ASTNode} [astIfNoConfig] The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
|
|
40991
41097
|
*/
|
|
40992
41098
|
constructor(textOrConfig, astIfNoConfig) {
|
|
40993
|
-
let text, ast, parserServices, scopeManager, visitorKeys;
|
|
41099
|
+
let text, hasBOM, ast, parserServices, scopeManager, visitorKeys;
|
|
40994
41100
|
|
|
40995
|
-
// Process overloading
|
|
41101
|
+
// Process overloading of arguments
|
|
40996
41102
|
if (typeof textOrConfig === "string") {
|
|
40997
41103
|
text = textOrConfig;
|
|
40998
41104
|
ast = astIfNoConfig;
|
|
41105
|
+
hasBOM = false;
|
|
40999
41106
|
} else if (typeof textOrConfig === "object" && textOrConfig !== null) {
|
|
41000
41107
|
text = textOrConfig.text;
|
|
41001
41108
|
ast = textOrConfig.ast;
|
|
41109
|
+
hasBOM = textOrConfig.hasBOM;
|
|
41002
41110
|
parserServices = textOrConfig.parserServices;
|
|
41003
41111
|
scopeManager = textOrConfig.scopeManager;
|
|
41004
41112
|
visitorKeys = textOrConfig.visitorKeys;
|
|
@@ -41016,18 +41124,39 @@ function requireSourceCode$1 () {
|
|
|
41016
41124
|
["configNodes", void 0]
|
|
41017
41125
|
]);
|
|
41018
41126
|
|
|
41127
|
+
/**
|
|
41128
|
+
* Indicates if the AST is ESTree compatible.
|
|
41129
|
+
* @type {boolean}
|
|
41130
|
+
*/
|
|
41131
|
+
this.isESTree = ast.type === "Program";
|
|
41132
|
+
|
|
41133
|
+
/*
|
|
41134
|
+
* Backwards compatibility for BOM handling.
|
|
41135
|
+
*
|
|
41136
|
+
* The `hasBOM` property has been available on the `SourceCode` object
|
|
41137
|
+
* for a long time and is used to indicate if the source contains a BOM.
|
|
41138
|
+
* The linter strips the BOM and just passes the `hasBOM` property to the
|
|
41139
|
+
* `SourceCode` constructor to make it easier for languages to not deal with
|
|
41140
|
+
* the BOM.
|
|
41141
|
+
*
|
|
41142
|
+
* However, the text passed in to the `SourceCode` constructor might still
|
|
41143
|
+
* have a BOM if the constructor is called outside of the linter, so we still
|
|
41144
|
+
* need to check for the BOM in the text.
|
|
41145
|
+
*/
|
|
41146
|
+
const textHasBOM = text.charCodeAt(0) === 0xFEFF;
|
|
41147
|
+
|
|
41019
41148
|
/**
|
|
41020
41149
|
* The flag to indicate that the source code has Unicode BOM.
|
|
41021
41150
|
* @type {boolean}
|
|
41022
41151
|
*/
|
|
41023
|
-
this.hasBOM =
|
|
41152
|
+
this.hasBOM = textHasBOM || !!hasBOM;
|
|
41024
41153
|
|
|
41025
41154
|
/**
|
|
41026
41155
|
* The original text source code.
|
|
41027
41156
|
* BOM was stripped from this text.
|
|
41028
41157
|
* @type {string}
|
|
41029
41158
|
*/
|
|
41030
|
-
this.text = (
|
|
41159
|
+
this.text = (textHasBOM ? text.slice(1) : text);
|
|
41031
41160
|
|
|
41032
41161
|
/**
|
|
41033
41162
|
* The parsed AST for the source code.
|
|
@@ -41616,7 +41745,7 @@ function requireSourceCode$1 () {
|
|
|
41616
41745
|
/**
|
|
41617
41746
|
* Applies configuration found inside of the source code. This method is only
|
|
41618
41747
|
* called when ESLint is running with inline configuration allowed.
|
|
41619
|
-
* @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,
|
|
41748
|
+
* @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,loc:Location}}} Information
|
|
41620
41749
|
* that ESLint needs to further process the inline configuration.
|
|
41621
41750
|
*/
|
|
41622
41751
|
applyInlineConfig() {
|
|
@@ -41664,17 +41793,21 @@ function requireSourceCode$1 () {
|
|
|
41664
41793
|
break;
|
|
41665
41794
|
|
|
41666
41795
|
case "eslint": {
|
|
41667
|
-
const parseResult = commentParser.parseJsonConfig(directiveValue
|
|
41796
|
+
const parseResult = commentParser.parseJsonConfig(directiveValue);
|
|
41668
41797
|
|
|
41669
41798
|
if (parseResult.success) {
|
|
41670
41799
|
configs.push({
|
|
41671
41800
|
config: {
|
|
41672
41801
|
rules: parseResult.config
|
|
41673
41802
|
},
|
|
41674
|
-
|
|
41803
|
+
loc: comment.loc
|
|
41675
41804
|
});
|
|
41676
41805
|
} else {
|
|
41677
|
-
problems.push(
|
|
41806
|
+
problems.push({
|
|
41807
|
+
ruleId: null,
|
|
41808
|
+
loc: comment.loc,
|
|
41809
|
+
message: parseResult.error.message
|
|
41810
|
+
});
|
|
41678
41811
|
}
|
|
41679
41812
|
|
|
41680
41813
|
break;
|
|
@@ -41704,12 +41837,11 @@ function requireSourceCode$1 () {
|
|
|
41704
41837
|
*/
|
|
41705
41838
|
finalize() {
|
|
41706
41839
|
|
|
41707
|
-
// Step 1: ensure that all of the necessary variables are up to date
|
|
41708
41840
|
const varsCache = this[caches].get("vars");
|
|
41709
|
-
const globalScope = this.scopeManager.scopes[0];
|
|
41710
41841
|
const configGlobals = varsCache.get("configGlobals");
|
|
41711
41842
|
const inlineGlobals = varsCache.get("inlineGlobals");
|
|
41712
41843
|
const exportedVariables = varsCache.get("exportedVariables");
|
|
41844
|
+
const globalScope = this.scopeManager.scopes[0];
|
|
41713
41845
|
|
|
41714
41846
|
addDeclaredGlobals(globalScope, configGlobals, inlineGlobals);
|
|
41715
41847
|
|
|
@@ -41767,9 +41899,7 @@ function requireSourceCode$1 () {
|
|
|
41767
41899
|
* Program node at the top level. This is not a perfect heuristic, but it
|
|
41768
41900
|
* is good enough for now.
|
|
41769
41901
|
*/
|
|
41770
|
-
|
|
41771
|
-
|
|
41772
|
-
if (isESTree) {
|
|
41902
|
+
if (this.isESTree) {
|
|
41773
41903
|
analyzer = new CodePathAnalyzer(analyzer);
|
|
41774
41904
|
|
|
41775
41905
|
CODE_PATH_EVENTS.forEach(eventName => {
|
|
@@ -42222,6 +42352,8 @@ function requireApplyDisableDirectives () {
|
|
|
42222
42352
|
|
|
42223
42353
|
const processed = processUnusedDirectives(unusedDisableDirectivesToReport)
|
|
42224
42354
|
.concat(processUnusedDirectives(unusedEnableDirectivesToReport));
|
|
42355
|
+
const columnOffset = options.language.columnStart === 1 ? 0 : 1;
|
|
42356
|
+
const lineOffset = options.language.lineStart === 1 ? 0 : 1;
|
|
42225
42357
|
|
|
42226
42358
|
const unusedDirectives = processed
|
|
42227
42359
|
.map(({ description, fix, unprocessedDirective }) => {
|
|
@@ -42241,8 +42373,8 @@ function requireApplyDisableDirectives () {
|
|
|
42241
42373
|
return {
|
|
42242
42374
|
ruleId: null,
|
|
42243
42375
|
message,
|
|
42244
|
-
line: type === "disable-next-line" ? parentDirective.node.loc.start.line : line,
|
|
42245
|
-
column: type === "disable-next-line" ? parentDirective.node.loc.start.column +
|
|
42376
|
+
line: type === "disable-next-line" ? parentDirective.node.loc.start.line + lineOffset : line,
|
|
42377
|
+
column: type === "disable-next-line" ? parentDirective.node.loc.start.column + columnOffset : column,
|
|
42246
42378
|
severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
|
|
42247
42379
|
nodeType: null,
|
|
42248
42380
|
...options.disableFixes ? {} : { fix }
|
|
@@ -42256,6 +42388,7 @@ function requireApplyDisableDirectives () {
|
|
|
42256
42388
|
* Given a list of directive comments (i.e. metadata about eslint-disable and eslint-enable comments) and a list
|
|
42257
42389
|
* of reported problems, adds the suppression information to the problems.
|
|
42258
42390
|
* @param {Object} options Information about directives and problems
|
|
42391
|
+
* @param {Language} options.language The language being linted.
|
|
42259
42392
|
* @param {{
|
|
42260
42393
|
* type: ("disable"|"enable"|"disable-line"|"disable-next-line"),
|
|
42261
42394
|
* ruleId: (string|null),
|
|
@@ -42274,7 +42407,7 @@ function requireApplyDisableDirectives () {
|
|
|
42274
42407
|
* @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]}
|
|
42275
42408
|
* An object with a list of reported problems, the suppressed of which contain the suppression information.
|
|
42276
42409
|
*/
|
|
42277
|
-
applyDisableDirectives = ({ directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
|
|
42410
|
+
applyDisableDirectives = ({ language, directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
|
|
42278
42411
|
const blockDirectives = directives
|
|
42279
42412
|
.filter(directive => directive.type === "disable" || directive.type === "enable")
|
|
42280
42413
|
.map(directive => Object.assign({}, directive, { unprocessedDirective: directive }))
|
|
@@ -42323,6 +42456,7 @@ function requireApplyDisableDirectives () {
|
|
|
42323
42456
|
}
|
|
42324
42457
|
|
|
42325
42458
|
const blockDirectivesResult = applyDirectives({
|
|
42459
|
+
language,
|
|
42326
42460
|
problems,
|
|
42327
42461
|
directives: blockDirectives,
|
|
42328
42462
|
disableFixes,
|
|
@@ -42330,6 +42464,7 @@ function requireApplyDisableDirectives () {
|
|
|
42330
42464
|
rulesToIgnore
|
|
42331
42465
|
});
|
|
42332
42466
|
const lineDirectivesResult = applyDirectives({
|
|
42467
|
+
language,
|
|
42333
42468
|
problems: blockDirectivesResult.problems,
|
|
42334
42469
|
directives: lineDirectives,
|
|
42335
42470
|
disableFixes,
|
|
@@ -42347,7 +42482,7 @@ function requireApplyDisableDirectives () {
|
|
|
42347
42482
|
return applyDisableDirectives;
|
|
42348
42483
|
}
|
|
42349
42484
|
|
|
42350
|
-
function e(t){return (e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,s=[],u=!0,l=!1;try{if(a=(r=r.call(e)).next,0===t);else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e;}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return "Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t){return e(t={exports:{}},t.exports),t.exports}var i=a((function(e,t){!function e(t){var r,n,o,a,i,s;function u(e){var t,r,n={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r&&null!==r?u(r):r);return n}function l(e,t){this.parent=e,this.key=t;}function c(e,t,r,n){this.node=e,this.path=t,this.wrap=r,this.ref=n;}function f(){}function p(e){return null!=e&&("object"==typeof e&&"string"==typeof e.type)}function h(e,t){return (e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function y(e,t){for(var r=e.length-1;r>=0;--r)if(e[r].node===t)return !0;return !1}function d(e,t){return (new f).traverse(e,t)}function m(e,t){var r;return r=function(e,t){var r,n,o,a;for(n=e.length,o=0;n;)t(e[a=o+(r=n>>>1)])?n=r:(o=a+1,n-=r+1);return o}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},o={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n={Break:a={},Skip:i={},Remove:s={}},l.prototype.replace=function(e){this.parent[this.key]=e;},l.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},f.prototype.path=function(){var e,t,r,n,o;function a(e,t){if(Array.isArray(t))for(r=0,n=t.length;r<n;++r)e.push(t[r]);else e.push(t);}if(!this.__current.path)return null;for(o=[],e=2,t=this.__leavelist.length;e<t;++e)a(o,this.__leavelist[e].path);return a(o,this.__current.path),o},f.prototype.type=function(){return this.current().type||this.__current.wrap},f.prototype.parents=function(){var e,t,r;for(r=[],e=1,t=this.__leavelist.length;e<t;++e)r.push(this.__leavelist[e].node);return r},f.prototype.current=function(){return this.__current.node},f.prototype.__execute=function(e,t){var r,n;return n=void 0,r=this.__current,this.__current=t,this.__state=null,e&&(n=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=r,n},f.prototype.notify=function(e){this.__state=e;},f.prototype.skip=function(){this.notify(i);},f.prototype.break=function(){this.notify(a);},f.prototype.remove=function(){this.notify(s);},f.prototype.__initialize=function(e,t){this.visitor=t,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,"iteration"===t.fallback?this.__fallback=Object.keys:"function"==typeof t.fallback&&(this.__fallback=t.fallback),this.__keys=o,t.keys&&(this.__keys=Object.assign(Object.create(this.__keys),t.keys));},f.prototype.traverse=function(e,t){var r,n,o,s,u,l,f,d,m,x,v,g;for(this.__initialize(e,t),g={},r=this.__worklist,n=this.__leavelist,r.push(new c(e,null,null,null)),n.push(new c(null,null,null,null));r.length;)if((o=r.pop())!==g){if(o.node){if(l=this.__execute(t.enter,o),this.__state===a||l===a)return;if(r.push(g),n.push(o),this.__state===i||l===i)continue;if(u=(s=o.node).type||o.wrap,!(x=this.__keys[u])){if(!this.__fallback)throw new Error("Unknown node type "+u+".");x=this.__fallback(s);}for(d=x.length;(d-=1)>=0;)if(v=s[f=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]&&!y(n,v[m])){if(h(u,x[d]))o=new c(v[m],[f,m],"Property",null);else {if(!p(v[m]))continue;o=new c(v[m],[f,m],null,null);}r.push(o);}}else if(p(v)){if(y(n,v))continue;r.push(new c(v,f,null,null));}}}else if(o=n.pop(),l=this.__execute(t.leave,o),this.__state===a||l===a)return},f.prototype.replace=function(e,t){var r,n,o,u,f,y,d,m,x,v,g,A,b;function E(e){var t,n,o,a;if(e.ref.remove())for(n=e.ref.key,a=e.ref.parent,t=r.length;t--;)if((o=r[t]).ref&&o.ref.parent===a){if(o.ref.key<n)break;--o.ref.key;}}for(this.__initialize(e,t),g={},r=this.__worklist,n=this.__leavelist,y=new c(e,null,null,new l(A={root:e},"root")),r.push(y),n.push(y);r.length;)if((y=r.pop())!==g){if(void 0!==(f=this.__execute(t.enter,y))&&f!==a&&f!==i&&f!==s&&(y.ref.replace(f),y.node=f),this.__state!==s&&f!==s||(E(y),y.node=null),this.__state===a||f===a)return A.root;if((o=y.node)&&(r.push(g),n.push(y),this.__state!==i&&f!==i)){if(u=o.type||y.wrap,!(x=this.__keys[u])){if(!this.__fallback)throw new Error("Unknown node type "+u+".");x=this.__fallback(o);}for(d=x.length;(d-=1)>=0;)if(v=o[b=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]){if(h(u,x[d]))y=new c(v[m],[b,m],"Property",new l(v,m));else {if(!p(v[m]))continue;y=new c(v[m],[b,m],null,new l(v,m));}r.push(y);}}else p(v)&&r.push(new c(v,b,null,new l(o,b)));}}else if(y=n.pop(),void 0!==(f=this.__execute(t.leave,y))&&f!==a&&f!==i&&f!==s&&y.ref.replace(f),this.__state!==s&&f!==s||E(y),this.__state===a||f===a)return A.root;return A.root},t.Syntax=r,t.traverse=d,t.replace=function(e,t){return (new f).replace(e,t)},t.attachComments=function(e,t,r){var o,a,i,s,l=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(i=0,a=t.length;i<a;i+=1)(o=u(t[i])).extendedRange=[0,e.range[0]],l.push(o);e.leadingComments=l;}return e}for(i=0,a=t.length;i<a;i+=1)l.push(m(u(t[i]),r));return s=0,d(e,{enter:function(e){for(var t;s<l.length&&!((t=l[s]).extendedRange[1]>e.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?n.Break:l[s].extendedRange[0]>e.range[1]?n.Skip:void 0}}),s=0,d(e,{leave:function(e){for(var t;s<l.length&&(t=l[s],!(e.range[1]<t.extendedRange[0]));)e.range[1]===t.extendedRange[0]?(e.trailingComments||(e.trailingComments=[]),e.trailingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?n.Break:l[s].extendedRange[0]>e.range[1]?n.Skip:void 0}}),e},t.VisitorKeys=o,t.VisitorOption=n,t.Controller=f,t.cloneEnvironment=function(){return e({})},t}(t);})),s=a((function(e){e.exports&&(e.exports=function(){function e(t,r,n,o){this.message=t,this.expected=r,this.found=n,this.location=o,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e);}return function(e,t){function r(){this.constructor=e;}r.prototype=t.prototype,e.prototype=new r;}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return '"'+o(e.text)+'"'},class:function(e){var t,r="";for(t=0;t<e.parts.length;t++)r+=e.parts[t]instanceof Array?a(e.parts[t][0])+"-"+a(e.parts[t][1]):a(e.parts[t]);return "["+(e.inverted?"^":"")+r+"]"},any:function(e){return "any character"},end:function(e){return "end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return "\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return "\\x"+n(e)}))}function a(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return "\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return "\\x"+n(e)}))}return "Expected "+function(e){var t,n,o,a=new Array(e.length);for(t=0;t<e.length;t++)a[t]=(o=e[t],r[o.type](o));if(a.sort(),a.length>0){for(t=1,n=1;t<a.length;t++)a[t-1]!==a[t]&&(a[n]=a[t],n++);a.length=n;}switch(a.length){case 1:return a[0];case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."},{SyntaxError:e,parse:function(t,r){r=void 0!==r?r:{};var n,o,a,i,s={},u={start:Ae},l=Ae,c=de(" ",!1),f=/^[^ [\],():#!=><~+.]/,p=me([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),h=de(">",!1),y=de("~",!1),d=de("+",!1),m=de(",",!1),x=de("!",!1),v=de("*",!1),g=de("#",!1),A=de("[",!1),b=de("]",!1),E=/^[><!]/,S=me([">","<","!"],!1,!1),_=de("=",!1),C=function(e){return (e||"")+"="},w=/^[><]/,P=me([">","<"],!1,!1),k=de(".",!1),D=function(e,t,r){return {type:"attribute",name:e,operator:t,value:r}},I=de('"',!1),j=/^[^\\"]/,F=me(["\\",'"'],!0,!1),T=de("\\",!1),L={type:"any"},R=function(e,t){return e+t},O=function(e){return {type:"literal",value:(t=e.join(""),t.replace(/\\(.)/g,(function(e,t){switch(t){case"b":return "\b";case"f":return "\f";case"n":return "\n";case"r":return "\r";case"t":return "\t";case"v":return "\v";default:return t}})))};var t;},M=de("'",!1),B=/^[^\\']/,U=me(["\\","'"],!0,!1),W=/^[0-9]/,V=me([["0","9"]],!1,!1),q=de("type(",!1),N=/^[^ )]/,K=me([" ",")"],!0,!1),G=de(")",!1),z=/^[imsu]/,H=me(["i","m","s","u"],!1,!1),Y=de("/",!1),$=/^[^\/]/,J=me(["/"],!0,!1),Q=de(":not(",!1),X=de(":matches(",!1),Z=de(":has(",!1),ee=de(":first-child",!1),te=de(":last-child",!1),re=de(":nth-child(",!1),ne=de(":nth-last-child(",!1),oe=de(":",!1),ae=de("statement",!0),ie=de("expression",!0),se=de("declaration",!0),ue=de("function",!0),le=de("pattern",!0),ce=0,fe=[{line:1,column:1}],pe=0,he=[],ye={};if("startRule"in r){if(!(r.startRule in u))throw new Error("Can't start parsing from rule \""+r.startRule+'".');l=u[r.startRule];}function de(e,t){return {type:"literal",text:e,ignoreCase:t}}function me(e,t,r){return {type:"class",parts:e,inverted:t,ignoreCase:r}}function xe(e){var r,n=fe[e];if(n)return n;for(r=e-1;!fe[r];)r--;for(n={line:(n=fe[r]).line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return fe[e]=n,n}function ve(e,t){var r=xe(e),n=xe(t);return {start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function ge(e){ce<pe||(ce>pe&&(pe=ce,he=[]),he.push(e));}function Ae(){var e,t,r,n,o=30*ce+0,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,(t=be())!==s&&(r=_e())!==s&&be()!==s?e=t=1===(n=r).length?n[0]:{type:"matches",selectors:n}:(ce=e,e=s),e===s&&(e=ce,(t=be())!==s&&(t=void 0),e=t),ye[o]={nextPos:ce,result:e},e)}function be(){var e,r,n=30*ce+1,o=ye[n];if(o)return ce=o.nextPos,o.result;for(e=[],32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c));r!==s;)e.push(r),32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c));return ye[n]={nextPos:ce,result:e},e}function Ee(){var e,r,n,o=30*ce+2,a=ye[o];if(a)return ce=a.nextPos,a.result;if(r=[],f.test(t.charAt(ce))?(n=t.charAt(ce),ce++):(n=s,ge(p)),n!==s)for(;n!==s;)r.push(n),f.test(t.charAt(ce))?(n=t.charAt(ce),ce++):(n=s,ge(p));else r=s;return r!==s&&(r=r.join("")),e=r,ye[o]={nextPos:ce,result:e},e}function Se(){var e,r,n,o=30*ce+3,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,(r=be())!==s?(62===t.charCodeAt(ce)?(n=">",ce++):(n=s,ge(h)),n!==s&&be()!==s?e=r="child":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=be())!==s?(126===t.charCodeAt(ce)?(n="~",ce++):(n=s,ge(y)),n!==s&&be()!==s?e=r="sibling":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=be())!==s?(43===t.charCodeAt(ce)?(n="+",ce++):(n=s,ge(d)),n!==s&&be()!==s?e=r="adjacent":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c)),r!==s&&(n=be())!==s?e=r="descendant":(ce=e,e=s)))),ye[o]={nextPos:ce,result:e},e)}function _e(){var e,r,n,o,a,i,u,l,c=30*ce+4,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,(r=Ce())!==s){for(n=[],o=ce,(a=be())!==s?(44===t.charCodeAt(ce)?(i=",",ce++):(i=s,ge(m)),i!==s&&(u=be())!==s&&(l=Ce())!==s?o=a=[a,i,u,l]:(ce=o,o=s)):(ce=o,o=s);o!==s;)n.push(o),o=ce,(a=be())!==s?(44===t.charCodeAt(ce)?(i=",",ce++):(i=s,ge(m)),i!==s&&(u=be())!==s&&(l=Ce())!==s?o=a=[a,i,u,l]:(ce=o,o=s)):(ce=o,o=s);n!==s?e=r=[r].concat(n.map((function(e){return e[3]}))):(ce=e,e=s);}else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}function Ce(){var e,t,r,n,o,a,i,u=30*ce+5,l=ye[u];if(l)return ce=l.nextPos,l.result;if(e=ce,(t=we())!==s){for(r=[],n=ce,(o=Se())!==s&&(a=we())!==s?n=o=[o,a]:(ce=n,n=s);n!==s;)r.push(n),n=ce,(o=Se())!==s&&(a=we())!==s?n=o=[o,a]:(ce=n,n=s);r!==s?(i=t,e=t=r.reduce((function(e,t){return {type:t[0],left:e,right:t[1]}}),i)):(ce=e,e=s);}else ce=e,e=s;return ye[u]={nextPos:ce,result:e},e}function we(){var e,r,n,o,a,i,u,l=30*ce+6,c=ye[l];if(c)return ce=c.nextPos,c.result;if(e=ce,33===t.charCodeAt(ce)?(r="!",ce++):(r=s,ge(x)),r===s&&(r=null),r!==s){if(n=[],(o=Pe())!==s)for(;o!==s;)n.push(o),o=Pe();else n=s;n!==s?(a=r,u=1===(i=n).length?i[0]:{type:"compound",selectors:i},a&&(u.subject=!0),e=r=u):(ce=e,e=s);}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}function Pe(){var e,r=30*ce+7,n=ye[r];return n?(ce=n.nextPos,n.result):((e=function(){var e,r,n=30*ce+8,o=ye[n];return o?(ce=o.nextPos,o.result):(42===t.charCodeAt(ce)?(r="*",ce++):(r=s,ge(v)),r!==s&&(r={type:"wildcard",value:r}),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o=30*ce+9,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,35===t.charCodeAt(ce)?(r="#",ce++):(r=s,ge(g)),r===s&&(r=null),r!==s&&(n=Ee())!==s?e=r={type:"identifier",value:n}:(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a=30*ce+10,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,91===t.charCodeAt(ce)?(r="[",ce++):(r=s,ge(A)),r!==s&&be()!==s&&(n=function(){var e,r,n,o,a=30*ce+14,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,(r=ke())!==s&&be()!==s&&(n=function(){var e,r,n,o=30*ce+12,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,33===t.charCodeAt(ce)?(r="!",ce++):(r=s,ge(x)),r===s&&(r=null),r!==s?(61===t.charCodeAt(ce)?(n="=",ce++):(n=s,ge(_)),n!==s?(r=C(r),e=r):(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())!==s&&be()!==s?((o=function(){var e,r,n,o,a,i=30*ce+18,u=ye[i];if(u)return ce=u.nextPos,u.result;if(e=ce,"type("===t.substr(ce,5)?(r="type(",ce+=5):(r=s,ge(q)),r!==s)if(be()!==s){if(n=[],N.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(K)),o!==s)for(;o!==s;)n.push(o),N.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(K));else n=s;n!==s&&(o=be())!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?(r={type:"type",value:n.join("")},e=r):(ce=e,e=s)):(ce=e,e=s);}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(o=function(){var e,r,n,o,a,i,u=30*ce+20,l=ye[u];if(l)return ce=l.nextPos,l.result;if(e=ce,47===t.charCodeAt(ce)?(r="/",ce++):(r=s,ge(Y)),r!==s){if(n=[],$.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(J)),o!==s)for(;o!==s;)n.push(o),$.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(J));else n=s;n!==s?(47===t.charCodeAt(ce)?(o="/",ce++):(o=s,ge(Y)),o!==s?((a=function(){var e,r,n=30*ce+19,o=ye[n];if(o)return ce=o.nextPos,o.result;if(e=[],z.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(H)),r!==s)for(;r!==s;)e.push(r),z.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(H));else e=s;return ye[n]={nextPos:ce,result:e},e}())===s&&(a=null),a!==s?(i=a,r={type:"regexp",value:new RegExp(n.join(""),i?i.join(""):"")},e=r):(ce=e,e=s)):(ce=e,e=s)):(ce=e,e=s);}else ce=e,e=s;return ye[u]={nextPos:ce,result:e},e}()),o!==s?(r=D(r,n,o),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=ke())!==s&&be()!==s&&(n=function(){var e,r,n,o=30*ce+11,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,E.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(S)),r===s&&(r=null),r!==s?(61===t.charCodeAt(ce)?(n="=",ce++):(n=s,ge(_)),n!==s?(r=C(r),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(w.test(t.charAt(ce))?(e=t.charAt(ce),ce++):(e=s,ge(P))),ye[o]={nextPos:ce,result:e},e)}())!==s&&be()!==s?((o=function(){var e,r,n,o,a,i,u=30*ce+15,l=ye[u];if(l)return ce=l.nextPos,l.result;if(e=ce,34===t.charCodeAt(ce)?(r='"',ce++):(r=s,ge(I)),r!==s){for(n=[],j.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(F)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(T)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=R(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));o!==s;)n.push(o),j.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(F)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(T)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=R(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));n!==s?(34===t.charCodeAt(ce)?(o='"',ce++):(o=s,ge(I)),o!==s?(r=O(n),e=r):(ce=e,e=s)):(ce=e,e=s);}else ce=e,e=s;if(e===s)if(e=ce,39===t.charCodeAt(ce)?(r="'",ce++):(r=s,ge(M)),r!==s){for(n=[],B.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(U)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(T)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=R(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));o!==s;)n.push(o),B.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(U)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(T)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=R(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));n!==s?(39===t.charCodeAt(ce)?(o="'",ce++):(o=s,ge(M)),o!==s?(r=O(n),e=r):(ce=e,e=s)):(ce=e,e=s);}else ce=e,e=s;return ye[u]={nextPos:ce,result:e},e}())===s&&(o=function(){var e,r,n,o,a,i,u,l=30*ce+16,c=ye[l];if(c)return ce=c.nextPos,c.result;for(e=ce,r=ce,n=[],W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));o!==s;)n.push(o),W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));if(n!==s?(46===t.charCodeAt(ce)?(o=".",ce++):(o=s,ge(k)),o!==s?r=n=[n,o]:(ce=r,r=s)):(ce=r,r=s),r===s&&(r=null),r!==s){if(n=[],W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V)),o!==s)for(;o!==s;)n.push(o),W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));else n=s;n!==s?(i=n,u=(a=r)?[].concat.apply([],a).join(""):"",r={type:"literal",value:parseFloat(u+i.join(""))},e=r):(ce=e,e=s);}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}())===s&&(o=function(){var e,t,r=30*ce+17,n=ye[r];return n?(ce=n.nextPos,n.result):((t=Ee())!==s&&(t={type:"literal",value:t}),e=t,ye[r]={nextPos:ce,result:e},e)}()),o!==s?(r=D(r,n,o),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=ke())!==s&&(r={type:"attribute",name:r}),e=r)),ye[a]={nextPos:ce,result:e},e)}())!==s&&be()!==s?(93===t.charCodeAt(ce)?(o="]",ce++):(o=s,ge(b)),o!==s?e=r=n:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a,i,u,l,c=30*ce+21,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,46===t.charCodeAt(ce)?(r=".",ce++):(r=s,ge(k)),r!==s)if((n=Ee())!==s){for(o=[],a=ce,46===t.charCodeAt(ce)?(i=".",ce++):(i=s,ge(k)),i!==s&&(u=Ee())!==s?a=i=[i,u]:(ce=a,a=s);a!==s;)o.push(a),a=ce,46===t.charCodeAt(ce)?(i=".",ce++):(i=s,ge(k)),i!==s&&(u=Ee())!==s?a=i=[i,u]:(ce=a,a=s);o!==s?(l=n,r={type:"field",name:o.reduce((function(e,t){return e+t[0]+t[1]}),l)},e=r):(ce=e,e=s);}else ce=e,e=s;else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,o,a=30*ce+22,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,":not("===t.substr(ce,5)?(r=":not(",ce+=5):(r=s,ge(Q)),r!==s&&be()!==s&&(n=_e())!==s&&be()!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?e=r={type:"not",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a=30*ce+23,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,":matches("===t.substr(ce,9)?(r=":matches(",ce+=9):(r=s,ge(X)),r!==s&&be()!==s&&(n=_e())!==s&&be()!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?e=r={type:"matches",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a=30*ce+24,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,":has("===t.substr(ce,5)?(r=":has(",ce+=5):(r=s,ge(Z)),r!==s&&be()!==s&&(n=_e())!==s&&be()!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?e=r={type:"has",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n=30*ce+25,o=ye[n];return o?(ce=o.nextPos,o.result):(":first-child"===t.substr(ce,12)?(r=":first-child",ce+=12):(r=s,ge(ee)),r!==s&&(r=De(1)),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n=30*ce+26,o=ye[n];return o?(ce=o.nextPos,o.result):(":last-child"===t.substr(ce,11)?(r=":last-child",ce+=11):(r=s,ge(te)),r!==s&&(r=Ie(1)),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a,i=30*ce+27,u=ye[i];if(u)return ce=u.nextPos,u.result;if(e=ce,":nth-child("===t.substr(ce,11)?(r=":nth-child(",ce+=11):(r=s,ge(re)),r!==s)if(be()!==s){if(n=[],W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V)),o!==s)for(;o!==s;)n.push(o),W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));else n=s;n!==s&&(o=be())!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?(r=De(parseInt(n.join(""),10)),e=r):(ce=e,e=s)):(ce=e,e=s);}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,o,a,i=30*ce+28,u=ye[i];if(u)return ce=u.nextPos,u.result;if(e=ce,":nth-last-child("===t.substr(ce,16)?(r=":nth-last-child(",ce+=16):(r=s,ge(ne)),r!==s)if(be()!==s){if(n=[],W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V)),o!==s)for(;o!==s;)n.push(o),W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));else n=s;n!==s&&(o=be())!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?(r=Ie(parseInt(n.join(""),10)),e=r):(ce=e,e=s)):(ce=e,e=s);}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,o=30*ce+29,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,58===t.charCodeAt(ce)?(r=":",ce++):(r=s,ge(oe)),r!==s?("statement"===t.substr(ce,9).toLowerCase()?(n=t.substr(ce,9),ce+=9):(n=s,ge(ae)),n===s&&("expression"===t.substr(ce,10).toLowerCase()?(n=t.substr(ce,10),ce+=10):(n=s,ge(ie)),n===s&&("declaration"===t.substr(ce,11).toLowerCase()?(n=t.substr(ce,11),ce+=11):(n=s,ge(se)),n===s&&("function"===t.substr(ce,8).toLowerCase()?(n=t.substr(ce,8),ce+=8):(n=s,ge(ue)),n===s&&("pattern"===t.substr(ce,7).toLowerCase()?(n=t.substr(ce,7),ce+=7):(n=s,ge(le)))))),n!==s?e=r={type:"class",name:n}:(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}()),ye[r]={nextPos:ce,result:e},e)}function ke(){var e,r,n,o,a,i,u,l,c=30*ce+13,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,(r=Ee())!==s){for(n=[],o=ce,46===t.charCodeAt(ce)?(a=".",ce++):(a=s,ge(k)),a!==s&&(i=Ee())!==s?o=a=[a,i]:(ce=o,o=s);o!==s;)n.push(o),o=ce,46===t.charCodeAt(ce)?(a=".",ce++):(a=s,ge(k)),a!==s&&(i=Ee())!==s?o=a=[a,i]:(ce=o,o=s);n!==s?(u=r,l=n,e=r=[].concat.apply([u],l).join("")):(ce=e,e=s);}else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}function De(e){return {type:"nth-child",index:{type:"literal",value:e}}}function Ie(e){return {type:"nth-last-child",index:{type:"literal",value:e}}}if((n=l())!==s&&ce===t.length)return n;throw n!==s&&ce<t.length&&ge({type:"end"}),o=he,a=pe<t.length?t.charAt(pe):null,i=pe<t.length?ve(pe,pe+1):ve(pe,pe),new e(e.buildMessage(o,a),o,a,i)}}}());}));function u(e,t){for(var r=0;r<t.length;++r){if(null==e)return e;e=e[t[r]];}return e}var l="function"==typeof WeakMap?new WeakMap:null;function c(e){if(null==e)return function(){return !0};if(null!=l){var t=l.get(e);return null!=t||(t=f(e),l.set(e,t)),t}return f(e)}function f(t){switch(t.type){case"wildcard":return function(){return !0};case"identifier":var r=t.value.toLowerCase();return function(e){return r===e.type.toLowerCase()};case"field":var n=t.name.split(".");return function(e,t){return function e(t,r,n,o){for(var a=r,i=o;i<n.length;++i){if(null==a)return !1;var s=a[n[i]];if(Array.isArray(s)){for(var u=0;u<s.length;++u)if(e(t,s[u],n,i+1))return !0;return !1}a=s;}return t===a}(e,t[n.length-1],n,0)};case"matches":var o=t.selectors.map(c);return function(e,t,r){for(var n=0;n<o.length;++n)if(o[n](e,t,r))return !0;return !1};case"compound":var a=t.selectors.map(c);return function(e,t,r){for(var n=0;n<a.length;++n)if(!a[n](e,t,r))return !1;return !0};case"not":var s=t.selectors.map(c);return function(e,t,r){for(var n=0;n<s.length;++n)if(s[n](e,t,r))return !1;return !0};case"has":var l=t.selectors.map(c);return function(e,t,r){var n=!1,o=[];return i.traverse(e,{enter:function(e,t){null!=t&&o.unshift(t);for(var a=0;a<l.length;++a)if(l[a](e,o,r))return n=!0,void this.break()},leave:function(){o.shift();},keys:r&&r.visitorKeys,fallback:r&&r.fallback||"iteration"}),n};case"child":var f=c(t.left),p=c(t.right);return function(e,t,r){return !!(t.length>0&&p(e,t,r))&&f(t[0],t.slice(1),r)};case"descendant":var h=c(t.left),x=c(t.right);return function(e,t,r){if(x(e,t,r))for(var n=0,o=t.length;n<o;++n)if(h(t[n],t.slice(n+1),r))return !0;return !1};case"attribute":var v=t.name.split(".");switch(t.operator){case void 0:return function(e){return null!=u(e,v)};case"=":switch(t.value.type){case"regexp":return function(e){var r=u(e,v);return "string"==typeof r&&t.value.value.test(r)};case"literal":var g="".concat(t.value.value);return function(e){return g==="".concat(u(e,v))};case"type":return function(r){return t.value.value===e(u(r,v))}}throw new Error("Unknown selector value type: ".concat(t.value.type));case"!=":switch(t.value.type){case"regexp":return function(e){return !t.value.value.test(u(e,v))};case"literal":var A="".concat(t.value.value);return function(e){return A!=="".concat(u(e,v))};case"type":return function(r){return t.value.value!==e(u(r,v))}}throw new Error("Unknown selector value type: ".concat(t.value.type));case"<=":return function(e){return u(e,v)<=t.value.value};case"<":return function(e){return u(e,v)<t.value.value};case">":return function(e){return u(e,v)>t.value.value};case">=":return function(e){return u(e,v)>=t.value.value}}throw new Error("Unknown operator: ".concat(t.operator));case"sibling":var b=c(t.left),E=c(t.right);return function(e,r,n){return E(e,r,n)&&y(e,b,r,"LEFT_SIDE",n)||t.left.subject&&b(e,r,n)&&y(e,E,r,"RIGHT_SIDE",n)};case"adjacent":var S=c(t.left),_=c(t.right);return function(e,r,n){return _(e,r,n)&&d(e,S,r,"LEFT_SIDE",n)||t.right.subject&&S(e,r,n)&&d(e,_,r,"RIGHT_SIDE",n)};case"nth-child":var C=t.index.value,w=c(t.right);return function(e,t,r){return w(e,t,r)&&m(e,t,C,r)};case"nth-last-child":var P=-t.index.value,k=c(t.right);return function(e,t,r){return k(e,t,r)&&m(e,t,P,r)};case"class":var D=t.name.toLowerCase();return function(e,r){switch(D){case"statement":if("Statement"===e.type.slice(-9))return !0;case"declaration":return "Declaration"===e.type.slice(-11);case"pattern":if("Pattern"===e.type.slice(-7))return !0;case"expression":return "Expression"===e.type.slice(-10)||"Literal"===e.type.slice(-7)||"Identifier"===e.type&&(0===r.length||"MetaProperty"!==r[0].type)||"MetaProperty"===e.type;case"function":return "FunctionDeclaration"===e.type||"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type}throw new Error("Unknown class name: ".concat(t.name))}}throw new Error("Unknown selector type: ".concat(t.type))}function p(e,t){var r=e.type;return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:i.VisitorKeys[r]?i.VisitorKeys[r]:t&&"function"==typeof t.fallback?t.fallback(e):Object.keys(e).filter((function(e){return "type"!==e}))}function h(t){return null!==t&&"object"===e(t)&&"string"==typeof t.type}function y(e,r,n,o,a){var i=t(n,1)[0];if(!i)return !1;for(var s=p(i,a),u=0;u<s.length;++u){var l=i[s[u]];if(Array.isArray(l)){var c=l.indexOf(e);if(c<0)continue;var f=void 0,y=void 0;"LEFT_SIDE"===o?(f=0,y=c):(f=c+1,y=l.length);for(var d=f;d<y;++d)if(h(l[d])&&r(l[d],n,a))return !0}}return !1}function d(e,r,n,o,a){var i=t(n,1)[0];if(!i)return !1;for(var s=p(i,a),u=0;u<s.length;++u){var l=i[s[u]];if(Array.isArray(l)){var c=l.indexOf(e);if(c<0)continue;if("LEFT_SIDE"===o&&c>0&&h(l[c-1])&&r(l[c-1],n,a))return !0;if("RIGHT_SIDE"===o&&c<l.length-1&&h(l[c+1])&&r(l[c+1],n,a))return !0}}return !1}function m(e,r,n,o){if(0===n)return !1;var a=t(r,1)[0];if(!a)return !1;for(var i=p(a,o),s=0;s<i.length;++s){var u=a[i[s]];if(Array.isArray(u)){var l=n<0?u.length+n:n-1;if(l>=0&&l<u.length&&u[l]===e)return !0}}return !1}function x(t,n,o,a){if(n){var s=[],u=c(n),l=function t(n,o){if(null==n||"object"!=e(n))return [];null==o&&(o=n);for(var a=n.subject?[o]:[],i=Object.keys(n),s=0;s<i.length;++s){var u=i[s],l=n[u];a.push.apply(a,r(t(l,"left"===u?l:o)));}return a}(n).map(c);i.traverse(t,{enter:function(e,t){if(null!=t&&s.unshift(t),u(e,s,a))if(l.length)for(var r=0,n=l.length;r<n;++r){l[r](e,s,a)&&o(e,t,s);for(var i=0,c=s.length;i<c;++i){var f=s.slice(i+1);l[r](s[i],f,a)&&o(s[i],t,f);}}else o(e,t,s);},leave:function(){s.shift();},keys:a&&a.visitorKeys,fallback:a&&a.fallback||"iteration"});}}function v(e,t,r){var n=[];return x(e,t,(function(e){n.push(e);}),r),n}function g(e){return s.parse(e)}function A(e,t,r){return v(e,g(t),r)}A.parse=g,A.match=v,A.traverse=x,A.matches=function(e,t,r,n){return !t||!!e&&(r||(r=[]),c(t)(e,r,n))},A.query=A;
|
|
42485
|
+
function e(t){return (e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],u=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,a=e;}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw a}}return s}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return "Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var i=o((function(e,t){!function e(t){var r,n,a,o,i,s;function u(e){var t,r,n={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r&&null!==r?u(r):r);return n}function l(e,t){this.parent=e,this.key=t;}function c(e,t,r,n){this.node=e,this.path=t,this.wrap=r,this.ref=n;}function f(){}function p(e){return null!=e&&("object"==typeof e&&"string"==typeof e.type)}function h(e,t){return (e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function y(e,t){for(var r=e.length-1;r>=0;--r)if(e[r].node===t)return !0;return !1}function d(e,t){return (new f).traverse(e,t)}function m(e,t){var r;return r=function(e,t){var r,n,a,o;for(n=e.length,a=0;n;)t(e[o=a+(r=n>>>1)])?n=r:(a=o+1,n-=r+1);return a}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},a={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n={Break:o={},Skip:i={},Remove:s={}},l.prototype.replace=function(e){this.parent[this.key]=e;},l.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},f.prototype.path=function(){var e,t,r,n,a;function o(e,t){if(Array.isArray(t))for(r=0,n=t.length;r<n;++r)e.push(t[r]);else e.push(t);}if(!this.__current.path)return null;for(a=[],e=2,t=this.__leavelist.length;e<t;++e)o(a,this.__leavelist[e].path);return o(a,this.__current.path),a},f.prototype.type=function(){return this.current().type||this.__current.wrap},f.prototype.parents=function(){var e,t,r;for(r=[],e=1,t=this.__leavelist.length;e<t;++e)r.push(this.__leavelist[e].node);return r},f.prototype.current=function(){return this.__current.node},f.prototype.__execute=function(e,t){var r,n;return n=void 0,r=this.__current,this.__current=t,this.__state=null,e&&(n=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=r,n},f.prototype.notify=function(e){this.__state=e;},f.prototype.skip=function(){this.notify(i);},f.prototype.break=function(){this.notify(o);},f.prototype.remove=function(){this.notify(s);},f.prototype.__initialize=function(e,t){this.visitor=t,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,"iteration"===t.fallback?this.__fallback=Object.keys:"function"==typeof t.fallback&&(this.__fallback=t.fallback),this.__keys=a,t.keys&&(this.__keys=Object.assign(Object.create(this.__keys),t.keys));},f.prototype.traverse=function(e,t){var r,n,a,s,u,l,f,d,m,x,v,g;for(this.__initialize(e,t),g={},r=this.__worklist,n=this.__leavelist,r.push(new c(e,null,null,null)),n.push(new c(null,null,null,null));r.length;)if((a=r.pop())!==g){if(a.node){if(l=this.__execute(t.enter,a),this.__state===o||l===o)return;if(r.push(g),n.push(a),this.__state===i||l===i)continue;if(u=(s=a.node).type||a.wrap,!(x=this.__keys[u])){if(!this.__fallback)throw new Error("Unknown node type "+u+".");x=this.__fallback(s);}for(d=x.length;(d-=1)>=0;)if(v=s[f=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]&&!y(n,v[m])){if(h(u,x[d]))a=new c(v[m],[f,m],"Property",null);else {if(!p(v[m]))continue;a=new c(v[m],[f,m],null,null);}r.push(a);}}else if(p(v)){if(y(n,v))continue;r.push(new c(v,f,null,null));}}}else if(a=n.pop(),l=this.__execute(t.leave,a),this.__state===o||l===o)return},f.prototype.replace=function(e,t){var r,n,a,u,f,y,d,m,x,v,g,A,E;function b(e){var t,n,a,o;if(e.ref.remove())for(n=e.ref.key,o=e.ref.parent,t=r.length;t--;)if((a=r[t]).ref&&a.ref.parent===o){if(a.ref.key<n)break;--a.ref.key;}}for(this.__initialize(e,t),g={},r=this.__worklist,n=this.__leavelist,y=new c(e,null,null,new l(A={root:e},"root")),r.push(y),n.push(y);r.length;)if((y=r.pop())!==g){if(void 0!==(f=this.__execute(t.enter,y))&&f!==o&&f!==i&&f!==s&&(y.ref.replace(f),y.node=f),this.__state!==s&&f!==s||(b(y),y.node=null),this.__state===o||f===o)return A.root;if((a=y.node)&&(r.push(g),n.push(y),this.__state!==i&&f!==i)){if(u=a.type||y.wrap,!(x=this.__keys[u])){if(!this.__fallback)throw new Error("Unknown node type "+u+".");x=this.__fallback(a);}for(d=x.length;(d-=1)>=0;)if(v=a[E=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]){if(h(u,x[d]))y=new c(v[m],[E,m],"Property",new l(v,m));else {if(!p(v[m]))continue;y=new c(v[m],[E,m],null,new l(v,m));}r.push(y);}}else p(v)&&r.push(new c(v,E,null,new l(a,E)));}}else if(y=n.pop(),void 0!==(f=this.__execute(t.leave,y))&&f!==o&&f!==i&&f!==s&&y.ref.replace(f),this.__state!==s&&f!==s||b(y),this.__state===o||f===o)return A.root;return A.root},t.Syntax=r,t.traverse=d,t.replace=function(e,t){return (new f).replace(e,t)},t.attachComments=function(e,t,r){var a,o,i,s,l=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(i=0,o=t.length;i<o;i+=1)(a=u(t[i])).extendedRange=[0,e.range[0]],l.push(a);e.leadingComments=l;}return e}for(i=0,o=t.length;i<o;i+=1)l.push(m(u(t[i]),r));return s=0,d(e,{enter:function(e){for(var t;s<l.length&&!((t=l[s]).extendedRange[1]>e.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?n.Break:l[s].extendedRange[0]>e.range[1]?n.Skip:void 0}}),s=0,d(e,{leave:function(e){for(var t;s<l.length&&(t=l[s],!(e.range[1]<t.extendedRange[0]));)e.range[1]===t.extendedRange[0]?(e.trailingComments||(e.trailingComments=[]),e.trailingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?n.Break:l[s].extendedRange[0]>e.range[1]?n.Skip:void 0}}),e},t.VisitorKeys=a,t.VisitorOption=n,t.Controller=f,t.cloneEnvironment=function(){return e({})},t}(t);})),s=o((function(e){e.exports&&(e.exports=function(){function e(t,r,n,a){this.message=t,this.expected=r,this.found=n,this.location=a,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e);}return function(e,t){function r(){this.constructor=e;}r.prototype=t.prototype,e.prototype=new r;}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return '"'+a(e.text)+'"'},class:function(e){var t,r="";for(t=0;t<e.parts.length;t++)r+=e.parts[t]instanceof Array?o(e.parts[t][0])+"-"+o(e.parts[t][1]):o(e.parts[t]);return "["+(e.inverted?"^":"")+r+"]"},any:function(e){return "any character"},end:function(e){return "end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function a(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return "\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return "\\x"+n(e)}))}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return "\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return "\\x"+n(e)}))}return "Expected "+function(e){var t,n,a,o=new Array(e.length);for(t=0;t<e.length;t++)o[t]=(a=e[t],r[a.type](a));if(o.sort(),o.length>0){for(t=1,n=1;t<o.length;t++)o[t-1]!==o[t]&&(o[n]=o[t],n++);o.length=n;}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+function(e){return e?'"'+a(e)+'"':"end of input"}(t)+" found."},{SyntaxError:e,parse:function(t,r){r=void 0!==r?r:{};var n,a,o,i,s={},u={start:de},l=de,c=ce(" ",!1),f=/^[^ [\],():#!=><~+.]/,p=fe([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),h=ce(">",!1),y=ce("~",!1),d=ce("+",!1),m=ce(",",!1),x=ce("!",!1),v=ce("*",!1),g=ce("#",!1),A=ce("[",!1),E=ce("]",!1),b=/^[><!]/,S=fe([">","<","!"],!1,!1),_=ce("=",!1),C=function(e){return (e||"")+"="},w=/^[><]/,P=fe([">","<"],!1,!1),k=ce(".",!1),D=function(e,t,r){return {type:"attribute",name:e,operator:t,value:r}},I=ce('"',!1),j=/^[^\\"]/,T=fe(["\\",'"'],!0,!1),F=ce("\\",!1),R={type:"any"},O=function(e,t){return e+t},L=function(e){return {type:"literal",value:(t=e.join(""),t.replace(/\\(.)/g,(function(e,t){switch(t){case"b":return "\b";case"f":return "\f";case"n":return "\n";case"r":return "\r";case"t":return "\t";case"v":return "\v";default:return t}})))};var t;},M=ce("'",!1),B=/^[^\\']/,U=fe(["\\","'"],!0,!1),K=/^[0-9]/,W=fe([["0","9"]],!1,!1),V=ce("type(",!1),q=/^[^ )]/,N=fe([" ",")"],!0,!1),G=ce(")",!1),z=/^[imsu]/,H=fe(["i","m","s","u"],!1,!1),Y=ce("/",!1),$=/^[^\/]/,J=fe(["/"],!0,!1),Q=ce(":not(",!1),X=ce(":matches(",!1),Z=ce(":has(",!1),ee=ce(":first-child",!1),te=ce(":last-child",!1),re=ce(":nth-child(",!1),ne=ce(":nth-last-child(",!1),ae=ce(":",!1),oe=0,ie=[{line:1,column:1}],se=0,ue=[],le={};if("startRule"in r){if(!(r.startRule in u))throw new Error("Can't start parsing from rule \""+r.startRule+'".');l=u[r.startRule];}function ce(e,t){return {type:"literal",text:e,ignoreCase:t}}function fe(e,t,r){return {type:"class",parts:e,inverted:t,ignoreCase:r}}function pe(e){var r,n=ie[e];if(n)return n;for(r=e-1;!ie[r];)r--;for(n={line:(n=ie[r]).line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return ie[e]=n,n}function he(e,t){var r=pe(e),n=pe(t);return {start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function ye(e){oe<se||(oe>se&&(se=oe,ue=[]),ue.push(e));}function de(){var e,t,r,n,a=30*oe+0,o=le[a];return o?(oe=o.nextPos,o.result):(e=oe,(t=me())!==s&&(r=ge())!==s&&me()!==s?e=t=1===(n=r).length?n[0]:{type:"matches",selectors:n}:(oe=e,e=s),e===s&&(e=oe,(t=me())!==s&&(t=void 0),e=t),le[a]={nextPos:oe,result:e},e)}function me(){var e,r,n=30*oe+1,a=le[n];if(a)return oe=a.nextPos,a.result;for(e=[],32===t.charCodeAt(oe)?(r=" ",oe++):(r=s,ye(c));r!==s;)e.push(r),32===t.charCodeAt(oe)?(r=" ",oe++):(r=s,ye(c));return le[n]={nextPos:oe,result:e},e}function xe(){var e,r,n,a=30*oe+2,o=le[a];if(o)return oe=o.nextPos,o.result;if(r=[],f.test(t.charAt(oe))?(n=t.charAt(oe),oe++):(n=s,ye(p)),n!==s)for(;n!==s;)r.push(n),f.test(t.charAt(oe))?(n=t.charAt(oe),oe++):(n=s,ye(p));else r=s;return r!==s&&(r=r.join("")),e=r,le[a]={nextPos:oe,result:e},e}function ve(){var e,r,n,a=30*oe+3,o=le[a];return o?(oe=o.nextPos,o.result):(e=oe,(r=me())!==s?(62===t.charCodeAt(oe)?(n=">",oe++):(n=s,ye(h)),n!==s&&me()!==s?e=r="child":(oe=e,e=s)):(oe=e,e=s),e===s&&(e=oe,(r=me())!==s?(126===t.charCodeAt(oe)?(n="~",oe++):(n=s,ye(y)),n!==s&&me()!==s?e=r="sibling":(oe=e,e=s)):(oe=e,e=s),e===s&&(e=oe,(r=me())!==s?(43===t.charCodeAt(oe)?(n="+",oe++):(n=s,ye(d)),n!==s&&me()!==s?e=r="adjacent":(oe=e,e=s)):(oe=e,e=s),e===s&&(e=oe,32===t.charCodeAt(oe)?(r=" ",oe++):(r=s,ye(c)),r!==s&&(n=me())!==s?e=r="descendant":(oe=e,e=s)))),le[a]={nextPos:oe,result:e},e)}function ge(){var e,r,n,a,o,i,u,l,c=30*oe+4,f=le[c];if(f)return oe=f.nextPos,f.result;if(e=oe,(r=Ae())!==s){for(n=[],a=oe,(o=me())!==s?(44===t.charCodeAt(oe)?(i=",",oe++):(i=s,ye(m)),i!==s&&(u=me())!==s&&(l=Ae())!==s?a=o=[o,i,u,l]:(oe=a,a=s)):(oe=a,a=s);a!==s;)n.push(a),a=oe,(o=me())!==s?(44===t.charCodeAt(oe)?(i=",",oe++):(i=s,ye(m)),i!==s&&(u=me())!==s&&(l=Ae())!==s?a=o=[o,i,u,l]:(oe=a,a=s)):(oe=a,a=s);n!==s?e=r=[r].concat(n.map((function(e){return e[3]}))):(oe=e,e=s);}else oe=e,e=s;return le[c]={nextPos:oe,result:e},e}function Ae(){var e,t,r,n,a,o,i,u=30*oe+5,l=le[u];if(l)return oe=l.nextPos,l.result;if(e=oe,(t=Ee())!==s){for(r=[],n=oe,(a=ve())!==s&&(o=Ee())!==s?n=a=[a,o]:(oe=n,n=s);n!==s;)r.push(n),n=oe,(a=ve())!==s&&(o=Ee())!==s?n=a=[a,o]:(oe=n,n=s);r!==s?(i=t,e=t=r.reduce((function(e,t){return {type:t[0],left:e,right:t[1]}}),i)):(oe=e,e=s);}else oe=e,e=s;return le[u]={nextPos:oe,result:e},e}function Ee(){var e,r,n,a,o,i,u,l=30*oe+6,c=le[l];if(c)return oe=c.nextPos,c.result;if(e=oe,33===t.charCodeAt(oe)?(r="!",oe++):(r=s,ye(x)),r===s&&(r=null),r!==s){if(n=[],(a=be())!==s)for(;a!==s;)n.push(a),a=be();else n=s;n!==s?(o=r,u=1===(i=n).length?i[0]:{type:"compound",selectors:i},o&&(u.subject=!0),e=r=u):(oe=e,e=s);}else oe=e,e=s;return le[l]={nextPos:oe,result:e},e}function be(){var e,r=30*oe+7,n=le[r];return n?(oe=n.nextPos,n.result):((e=function(){var e,r,n=30*oe+8,a=le[n];return a?(oe=a.nextPos,a.result):(42===t.charCodeAt(oe)?(r="*",oe++):(r=s,ye(v)),r!==s&&(r={type:"wildcard",value:r}),e=r,le[n]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n,a=30*oe+9,o=le[a];return o?(oe=o.nextPos,o.result):(e=oe,35===t.charCodeAt(oe)?(r="#",oe++):(r=s,ye(g)),r===s&&(r=null),r!==s&&(n=xe())!==s?e=r={type:"identifier",value:n}:(oe=e,e=s),le[a]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n,a,o=30*oe+10,i=le[o];return i?(oe=i.nextPos,i.result):(e=oe,91===t.charCodeAt(oe)?(r="[",oe++):(r=s,ye(A)),r!==s&&me()!==s&&(n=function(){var e,r,n,a,o=30*oe+14,i=le[o];return i?(oe=i.nextPos,i.result):(e=oe,(r=Se())!==s&&me()!==s&&(n=function(){var e,r,n,a=30*oe+12,o=le[a];return o?(oe=o.nextPos,o.result):(e=oe,33===t.charCodeAt(oe)?(r="!",oe++):(r=s,ye(x)),r===s&&(r=null),r!==s?(61===t.charCodeAt(oe)?(n="=",oe++):(n=s,ye(_)),n!==s?(r=C(r),e=r):(oe=e,e=s)):(oe=e,e=s),le[a]={nextPos:oe,result:e},e)}())!==s&&me()!==s?((a=function(){var e,r,n,a,o,i=30*oe+18,u=le[i];if(u)return oe=u.nextPos,u.result;if(e=oe,"type("===t.substr(oe,5)?(r="type(",oe+=5):(r=s,ye(V)),r!==s)if(me()!==s){if(n=[],q.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(N)),a!==s)for(;a!==s;)n.push(a),q.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(N));else n=s;n!==s&&(a=me())!==s?(41===t.charCodeAt(oe)?(o=")",oe++):(o=s,ye(G)),o!==s?(r={type:"type",value:n.join("")},e=r):(oe=e,e=s)):(oe=e,e=s);}else oe=e,e=s;else oe=e,e=s;return le[i]={nextPos:oe,result:e},e}())===s&&(a=function(){var e,r,n,a,o,i,u=30*oe+20,l=le[u];if(l)return oe=l.nextPos,l.result;if(e=oe,47===t.charCodeAt(oe)?(r="/",oe++):(r=s,ye(Y)),r!==s){if(n=[],$.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(J)),a!==s)for(;a!==s;)n.push(a),$.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(J));else n=s;n!==s?(47===t.charCodeAt(oe)?(a="/",oe++):(a=s,ye(Y)),a!==s?((o=function(){var e,r,n=30*oe+19,a=le[n];if(a)return oe=a.nextPos,a.result;if(e=[],z.test(t.charAt(oe))?(r=t.charAt(oe),oe++):(r=s,ye(H)),r!==s)for(;r!==s;)e.push(r),z.test(t.charAt(oe))?(r=t.charAt(oe),oe++):(r=s,ye(H));else e=s;return le[n]={nextPos:oe,result:e},e}())===s&&(o=null),o!==s?(i=o,r={type:"regexp",value:new RegExp(n.join(""),i?i.join(""):"")},e=r):(oe=e,e=s)):(oe=e,e=s)):(oe=e,e=s);}else oe=e,e=s;return le[u]={nextPos:oe,result:e},e}()),a!==s?(r=D(r,n,a),e=r):(oe=e,e=s)):(oe=e,e=s),e===s&&(e=oe,(r=Se())!==s&&me()!==s&&(n=function(){var e,r,n,a=30*oe+11,o=le[a];return o?(oe=o.nextPos,o.result):(e=oe,b.test(t.charAt(oe))?(r=t.charAt(oe),oe++):(r=s,ye(S)),r===s&&(r=null),r!==s?(61===t.charCodeAt(oe)?(n="=",oe++):(n=s,ye(_)),n!==s?(r=C(r),e=r):(oe=e,e=s)):(oe=e,e=s),e===s&&(w.test(t.charAt(oe))?(e=t.charAt(oe),oe++):(e=s,ye(P))),le[a]={nextPos:oe,result:e},e)}())!==s&&me()!==s?((a=function(){var e,r,n,a,o,i,u=30*oe+15,l=le[u];if(l)return oe=l.nextPos,l.result;if(e=oe,34===t.charCodeAt(oe)?(r='"',oe++):(r=s,ye(I)),r!==s){for(n=[],j.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(T)),a===s&&(a=oe,92===t.charCodeAt(oe)?(o="\\",oe++):(o=s,ye(F)),o!==s?(t.length>oe?(i=t.charAt(oe),oe++):(i=s,ye(R)),i!==s?(o=O(o,i),a=o):(oe=a,a=s)):(oe=a,a=s));a!==s;)n.push(a),j.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(T)),a===s&&(a=oe,92===t.charCodeAt(oe)?(o="\\",oe++):(o=s,ye(F)),o!==s?(t.length>oe?(i=t.charAt(oe),oe++):(i=s,ye(R)),i!==s?(o=O(o,i),a=o):(oe=a,a=s)):(oe=a,a=s));n!==s?(34===t.charCodeAt(oe)?(a='"',oe++):(a=s,ye(I)),a!==s?(r=L(n),e=r):(oe=e,e=s)):(oe=e,e=s);}else oe=e,e=s;if(e===s)if(e=oe,39===t.charCodeAt(oe)?(r="'",oe++):(r=s,ye(M)),r!==s){for(n=[],B.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(U)),a===s&&(a=oe,92===t.charCodeAt(oe)?(o="\\",oe++):(o=s,ye(F)),o!==s?(t.length>oe?(i=t.charAt(oe),oe++):(i=s,ye(R)),i!==s?(o=O(o,i),a=o):(oe=a,a=s)):(oe=a,a=s));a!==s;)n.push(a),B.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(U)),a===s&&(a=oe,92===t.charCodeAt(oe)?(o="\\",oe++):(o=s,ye(F)),o!==s?(t.length>oe?(i=t.charAt(oe),oe++):(i=s,ye(R)),i!==s?(o=O(o,i),a=o):(oe=a,a=s)):(oe=a,a=s));n!==s?(39===t.charCodeAt(oe)?(a="'",oe++):(a=s,ye(M)),a!==s?(r=L(n),e=r):(oe=e,e=s)):(oe=e,e=s);}else oe=e,e=s;return le[u]={nextPos:oe,result:e},e}())===s&&(a=function(){var e,r,n,a,o,i,u,l=30*oe+16,c=le[l];if(c)return oe=c.nextPos,c.result;for(e=oe,r=oe,n=[],K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W));a!==s;)n.push(a),K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W));if(n!==s?(46===t.charCodeAt(oe)?(a=".",oe++):(a=s,ye(k)),a!==s?r=n=[n,a]:(oe=r,r=s)):(oe=r,r=s),r===s&&(r=null),r!==s){if(n=[],K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W)),a!==s)for(;a!==s;)n.push(a),K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W));else n=s;n!==s?(i=n,u=(o=r)?[].concat.apply([],o).join(""):"",r={type:"literal",value:parseFloat(u+i.join(""))},e=r):(oe=e,e=s);}else oe=e,e=s;return le[l]={nextPos:oe,result:e},e}())===s&&(a=function(){var e,t,r=30*oe+17,n=le[r];return n?(oe=n.nextPos,n.result):((t=xe())!==s&&(t={type:"literal",value:t}),e=t,le[r]={nextPos:oe,result:e},e)}()),a!==s?(r=D(r,n,a),e=r):(oe=e,e=s)):(oe=e,e=s),e===s&&(e=oe,(r=Se())!==s&&(r={type:"attribute",name:r}),e=r)),le[o]={nextPos:oe,result:e},e)}())!==s&&me()!==s?(93===t.charCodeAt(oe)?(a="]",oe++):(a=s,ye(E)),a!==s?e=r=n:(oe=e,e=s)):(oe=e,e=s),le[o]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n,a,o,i,u,l,c=30*oe+21,f=le[c];if(f)return oe=f.nextPos,f.result;if(e=oe,46===t.charCodeAt(oe)?(r=".",oe++):(r=s,ye(k)),r!==s)if((n=xe())!==s){for(a=[],o=oe,46===t.charCodeAt(oe)?(i=".",oe++):(i=s,ye(k)),i!==s&&(u=xe())!==s?o=i=[i,u]:(oe=o,o=s);o!==s;)a.push(o),o=oe,46===t.charCodeAt(oe)?(i=".",oe++):(i=s,ye(k)),i!==s&&(u=xe())!==s?o=i=[i,u]:(oe=o,o=s);a!==s?(l=n,r={type:"field",name:a.reduce((function(e,t){return e+t[0]+t[1]}),l)},e=r):(oe=e,e=s);}else oe=e,e=s;else oe=e,e=s;return le[c]={nextPos:oe,result:e},e}())===s&&(e=function(){var e,r,n,a,o=30*oe+22,i=le[o];return i?(oe=i.nextPos,i.result):(e=oe,":not("===t.substr(oe,5)?(r=":not(",oe+=5):(r=s,ye(Q)),r!==s&&me()!==s&&(n=ge())!==s&&me()!==s?(41===t.charCodeAt(oe)?(a=")",oe++):(a=s,ye(G)),a!==s?e=r={type:"not",selectors:n}:(oe=e,e=s)):(oe=e,e=s),le[o]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n,a,o=30*oe+23,i=le[o];return i?(oe=i.nextPos,i.result):(e=oe,":matches("===t.substr(oe,9)?(r=":matches(",oe+=9):(r=s,ye(X)),r!==s&&me()!==s&&(n=ge())!==s&&me()!==s?(41===t.charCodeAt(oe)?(a=")",oe++):(a=s,ye(G)),a!==s?e=r={type:"matches",selectors:n}:(oe=e,e=s)):(oe=e,e=s),le[o]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n,a,o=30*oe+24,i=le[o];return i?(oe=i.nextPos,i.result):(e=oe,":has("===t.substr(oe,5)?(r=":has(",oe+=5):(r=s,ye(Z)),r!==s&&me()!==s&&(n=ge())!==s&&me()!==s?(41===t.charCodeAt(oe)?(a=")",oe++):(a=s,ye(G)),a!==s?e=r={type:"has",selectors:n}:(oe=e,e=s)):(oe=e,e=s),le[o]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n=30*oe+25,a=le[n];return a?(oe=a.nextPos,a.result):(":first-child"===t.substr(oe,12)?(r=":first-child",oe+=12):(r=s,ye(ee)),r!==s&&(r=_e(1)),e=r,le[n]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n=30*oe+26,a=le[n];return a?(oe=a.nextPos,a.result):(":last-child"===t.substr(oe,11)?(r=":last-child",oe+=11):(r=s,ye(te)),r!==s&&(r=Ce(1)),e=r,le[n]={nextPos:oe,result:e},e)}())===s&&(e=function(){var e,r,n,a,o,i=30*oe+27,u=le[i];if(u)return oe=u.nextPos,u.result;if(e=oe,":nth-child("===t.substr(oe,11)?(r=":nth-child(",oe+=11):(r=s,ye(re)),r!==s)if(me()!==s){if(n=[],K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W)),a!==s)for(;a!==s;)n.push(a),K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W));else n=s;n!==s&&(a=me())!==s?(41===t.charCodeAt(oe)?(o=")",oe++):(o=s,ye(G)),o!==s?(r=_e(parseInt(n.join(""),10)),e=r):(oe=e,e=s)):(oe=e,e=s);}else oe=e,e=s;else oe=e,e=s;return le[i]={nextPos:oe,result:e},e}())===s&&(e=function(){var e,r,n,a,o,i=30*oe+28,u=le[i];if(u)return oe=u.nextPos,u.result;if(e=oe,":nth-last-child("===t.substr(oe,16)?(r=":nth-last-child(",oe+=16):(r=s,ye(ne)),r!==s)if(me()!==s){if(n=[],K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W)),a!==s)for(;a!==s;)n.push(a),K.test(t.charAt(oe))?(a=t.charAt(oe),oe++):(a=s,ye(W));else n=s;n!==s&&(a=me())!==s?(41===t.charCodeAt(oe)?(o=")",oe++):(o=s,ye(G)),o!==s?(r=Ce(parseInt(n.join(""),10)),e=r):(oe=e,e=s)):(oe=e,e=s);}else oe=e,e=s;else oe=e,e=s;return le[i]={nextPos:oe,result:e},e}())===s&&(e=function(){var e,r,n,a=30*oe+29,o=le[a];return o?(oe=o.nextPos,o.result):(e=oe,58===t.charCodeAt(oe)?(r=":",oe++):(r=s,ye(ae)),r!==s&&(n=xe())!==s?e=r={type:"class",name:n}:(oe=e,e=s),le[a]={nextPos:oe,result:e},e)}()),le[r]={nextPos:oe,result:e},e)}function Se(){var e,r,n,a,o,i,u,l,c=30*oe+13,f=le[c];if(f)return oe=f.nextPos,f.result;if(e=oe,(r=xe())!==s){for(n=[],a=oe,46===t.charCodeAt(oe)?(o=".",oe++):(o=s,ye(k)),o!==s&&(i=xe())!==s?a=o=[o,i]:(oe=a,a=s);a!==s;)n.push(a),a=oe,46===t.charCodeAt(oe)?(o=".",oe++):(o=s,ye(k)),o!==s&&(i=xe())!==s?a=o=[o,i]:(oe=a,a=s);n!==s?(u=r,l=n,e=r=[].concat.apply([u],l).join("")):(oe=e,e=s);}else oe=e,e=s;return le[c]={nextPos:oe,result:e},e}function _e(e){return {type:"nth-child",index:{type:"literal",value:e}}}function Ce(e){return {type:"nth-last-child",index:{type:"literal",value:e}}}if((n=l())!==s&&oe===t.length)return n;throw n!==s&&oe<t.length&&ye({type:"end"}),a=ue,o=se<t.length?t.charAt(se):null,i=se<t.length?he(se,se+1):he(se,se),new e(e.buildMessage(a,o),a,o,i)}}}());}));function u(e,t){for(var r=0;r<t.length;++r){if(null==e)return e;e=e[t[r]];}return e}var l="function"==typeof WeakMap?new WeakMap:null;function c(e){if(null==e)return function(){return !0};if(null!=l){var t=l.get(e);return null!=t||(t=f(e),l.set(e,t)),t}return f(e)}function f(t){switch(t.type){case"wildcard":return function(){return !0};case"identifier":var r=t.value.toLowerCase();return function(e,t,n){var a=n&&n.nodeTypeKey||"type";return r===e[a].toLowerCase()};case"field":var n=t.name.split(".");return function(e,t){return function e(t,r,n,a){for(var o=r,i=a;i<n.length;++i){if(null==o)return !1;var s=o[n[i]];if(Array.isArray(s)){for(var u=0;u<s.length;++u)if(e(t,s[u],n,i+1))return !0;return !1}o=s;}return t===o}(e,t[n.length-1],n,0)};case"matches":var a=t.selectors.map(c);return function(e,t,r){for(var n=0;n<a.length;++n)if(a[n](e,t,r))return !0;return !1};case"compound":var o=t.selectors.map(c);return function(e,t,r){for(var n=0;n<o.length;++n)if(!o[n](e,t,r))return !1;return !0};case"not":var s=t.selectors.map(c);return function(e,t,r){for(var n=0;n<s.length;++n)if(s[n](e,t,r))return !1;return !0};case"has":var l=t.selectors.map(c);return function(e,t,r){var n=!1,a=[];return i.traverse(e,{enter:function(e,t){null!=t&&a.unshift(t);for(var o=0;o<l.length;++o)if(l[o](e,a,r))return n=!0,void this.break()},leave:function(){a.shift();},keys:r&&r.visitorKeys,fallback:r&&r.fallback||"iteration"}),n};case"child":var f=c(t.left),p=c(t.right);return function(e,t,r){return !!(t.length>0&&p(e,t,r))&&f(t[0],t.slice(1),r)};case"descendant":var h=c(t.left),x=c(t.right);return function(e,t,r){if(x(e,t,r))for(var n=0,a=t.length;n<a;++n)if(h(t[n],t.slice(n+1),r))return !0;return !1};case"attribute":var v=t.name.split(".");switch(t.operator){case void 0:return function(e){return null!=u(e,v)};case"=":switch(t.value.type){case"regexp":return function(e){var r=u(e,v);return "string"==typeof r&&t.value.value.test(r)};case"literal":var g="".concat(t.value.value);return function(e){return g==="".concat(u(e,v))};case"type":return function(r){return t.value.value===e(u(r,v))}}throw new Error("Unknown selector value type: ".concat(t.value.type));case"!=":switch(t.value.type){case"regexp":return function(e){return !t.value.value.test(u(e,v))};case"literal":var A="".concat(t.value.value);return function(e){return A!=="".concat(u(e,v))};case"type":return function(r){return t.value.value!==e(u(r,v))}}throw new Error("Unknown selector value type: ".concat(t.value.type));case"<=":return function(e){return u(e,v)<=t.value.value};case"<":return function(e){return u(e,v)<t.value.value};case">":return function(e){return u(e,v)>t.value.value};case">=":return function(e){return u(e,v)>=t.value.value}}throw new Error("Unknown operator: ".concat(t.operator));case"sibling":var E=c(t.left),b=c(t.right);return function(e,r,n){return b(e,r,n)&&y(e,E,r,"LEFT_SIDE",n)||t.left.subject&&E(e,r,n)&&y(e,b,r,"RIGHT_SIDE",n)};case"adjacent":var S=c(t.left),_=c(t.right);return function(e,r,n){return _(e,r,n)&&d(e,S,r,"LEFT_SIDE",n)||t.right.subject&&S(e,r,n)&&d(e,_,r,"RIGHT_SIDE",n)};case"nth-child":var C=t.index.value,w=c(t.right);return function(e,t,r){return w(e,t,r)&&m(e,t,C,r)};case"nth-last-child":var P=-t.index.value,k=c(t.right);return function(e,t,r){return k(e,t,r)&&m(e,t,P,r)};case"class":return function(e,r,n){if(n&&n.matchClass)return n.matchClass(t.name,e,r);if(n&&n.nodeTypeKey)return !1;switch(t.name.toLowerCase()){case"statement":if("Statement"===e.type.slice(-9))return !0;case"declaration":return "Declaration"===e.type.slice(-11);case"pattern":if("Pattern"===e.type.slice(-7))return !0;case"expression":return "Expression"===e.type.slice(-10)||"Literal"===e.type.slice(-7)||"Identifier"===e.type&&(0===r.length||"MetaProperty"!==r[0].type)||"MetaProperty"===e.type;case"function":return "FunctionDeclaration"===e.type||"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type}throw new Error("Unknown class name: ".concat(t.name))}}throw new Error("Unknown selector type: ".concat(t.type))}function p(e,t){var r=t&&t.nodeTypeKey||"type",n=e[r];return t&&t.visitorKeys&&t.visitorKeys[n]?t.visitorKeys[n]:i.VisitorKeys[n]?i.VisitorKeys[n]:t&&"function"==typeof t.fallback?t.fallback(e):Object.keys(e).filter((function(e){return e!==r}))}function h(t,r){var n=r&&r.nodeTypeKey||"type";return null!==t&&"object"===e(t)&&"string"==typeof t[n]}function y(e,r,n,a,o){var i=t(n,1)[0];if(!i)return !1;for(var s=p(i,o),u=0;u<s.length;++u){var l=i[s[u]];if(Array.isArray(l)){var c=l.indexOf(e);if(c<0)continue;var f=void 0,y=void 0;"LEFT_SIDE"===a?(f=0,y=c):(f=c+1,y=l.length);for(var d=f;d<y;++d)if(h(l[d],o)&&r(l[d],n,o))return !0}}return !1}function d(e,r,n,a,o){var i=t(n,1)[0];if(!i)return !1;for(var s=p(i,o),u=0;u<s.length;++u){var l=i[s[u]];if(Array.isArray(l)){var c=l.indexOf(e);if(c<0)continue;if("LEFT_SIDE"===a&&c>0&&h(l[c-1],o)&&r(l[c-1],n,o))return !0;if("RIGHT_SIDE"===a&&c<l.length-1&&h(l[c+1],o)&&r(l[c+1],n,o))return !0}}return !1}function m(e,r,n,a){if(0===n)return !1;var o=t(r,1)[0];if(!o)return !1;for(var i=p(o,a),s=0;s<i.length;++s){var u=o[i[s]];if(Array.isArray(u)){var l=n<0?u.length+n:n-1;if(l>=0&&l<u.length&&u[l]===e)return !0}}return !1}function x(t,n,a,o){if(n){var s=[],u=c(n),l=function t(n,a){if(null==n||"object"!=e(n))return [];null==a&&(a=n);for(var o=n.subject?[a]:[],i=Object.keys(n),s=0;s<i.length;++s){var u=i[s],l=n[u];o.push.apply(o,r(t(l,"left"===u?l:a)));}return o}(n).map(c);i.traverse(t,{enter:function(e,t){if(null!=t&&s.unshift(t),u(e,s,o))if(l.length)for(var r=0,n=l.length;r<n;++r){l[r](e,s,o)&&a(e,t,s);for(var i=0,c=s.length;i<c;++i){var f=s.slice(i+1);l[r](s[i],f,o)&&a(s[i],t,f);}}else a(e,t,s);},leave:function(){s.shift();},keys:o&&o.visitorKeys,fallback:o&&o.fallback||"iteration"});}}function v(e,t,r){var n=[];return x(e,t,(function(e){n.push(e);}),r),n}function g(e){return s.parse(e)}function A(e,t,r){return v(e,g(t),r)}A.parse=g,A.match=v,A.traverse=x,A.matches=function(e,t,r,n){return !t||!!e&&(r||(r=[]),c(t)(e,r,n))},A.query=A;
|
|
42351
42486
|
|
|
42352
42487
|
/**
|
|
42353
42488
|
* @fileoverview The event generator for AST nodes.
|
|
@@ -43165,15 +43300,22 @@ function requireReportTranslator () {
|
|
|
43165
43300
|
* @param {{start: SourceLocation, end: (SourceLocation|null)}} options.loc Start and end location
|
|
43166
43301
|
* @param {{text: string, range: (number[]|null)}} options.fix The fix object
|
|
43167
43302
|
* @param {Array<{text: string, range: (number[]|null)}>} options.suggestions The array of suggestions objects
|
|
43303
|
+
* @param {Language} [options.language] The language to use to adjust line and column offsets.
|
|
43168
43304
|
* @returns {LintMessage} Information about the report
|
|
43169
43305
|
*/
|
|
43170
43306
|
function createProblem(options) {
|
|
43307
|
+
const { language } = options;
|
|
43308
|
+
|
|
43309
|
+
// calculate offsets based on the language in use
|
|
43310
|
+
const columnOffset = language.columnStart === 1 ? 0 : 1;
|
|
43311
|
+
const lineOffset = language.lineStart === 1 ? 0 : 1;
|
|
43312
|
+
|
|
43171
43313
|
const problem = {
|
|
43172
43314
|
ruleId: options.ruleId,
|
|
43173
43315
|
severity: options.severity,
|
|
43174
43316
|
message: options.message,
|
|
43175
|
-
line: options.loc.start.line,
|
|
43176
|
-
column: options.loc.start.column +
|
|
43317
|
+
line: options.loc.start.line + lineOffset,
|
|
43318
|
+
column: options.loc.start.column + columnOffset,
|
|
43177
43319
|
nodeType: options.node && options.node.type || null
|
|
43178
43320
|
};
|
|
43179
43321
|
|
|
@@ -43186,8 +43328,8 @@ function requireReportTranslator () {
|
|
|
43186
43328
|
}
|
|
43187
43329
|
|
|
43188
43330
|
if (options.loc.end) {
|
|
43189
|
-
problem.endLine = options.loc.end.line;
|
|
43190
|
-
problem.endColumn = options.loc.end.column +
|
|
43331
|
+
problem.endLine = options.loc.end.line + lineOffset;
|
|
43332
|
+
problem.endColumn = options.loc.end.column + columnOffset;
|
|
43191
43333
|
}
|
|
43192
43334
|
|
|
43193
43335
|
if (options.fix) {
|
|
@@ -43238,8 +43380,7 @@ function requireReportTranslator () {
|
|
|
43238
43380
|
/**
|
|
43239
43381
|
* Returns a function that converts the arguments of a `context.report` call from a rule into a reported
|
|
43240
43382
|
* problem for the Node.js API.
|
|
43241
|
-
* @param {{ruleId: string, severity: number, sourceCode: SourceCode, messageIds: Object, disableFixes: boolean}} metadata Metadata for the reported problem
|
|
43242
|
-
* @param {SourceCode} sourceCode The `SourceCode` instance for the text being linted
|
|
43383
|
+
* @param {{ruleId: string, severity: number, sourceCode: SourceCode, messageIds: Object, disableFixes: boolean, language:Language}} metadata Metadata for the reported problem
|
|
43243
43384
|
* @returns {function(...args): LintMessage} Function that returns information about the report
|
|
43244
43385
|
*/
|
|
43245
43386
|
|
|
@@ -43288,7 +43429,8 @@ function requireReportTranslator () {
|
|
|
43288
43429
|
messageId: descriptor.messageId,
|
|
43289
43430
|
loc: normalizeReportLoc(descriptor),
|
|
43290
43431
|
fix: metadata.disableFixes ? null : normalizeFixes(descriptor, metadata.sourceCode),
|
|
43291
|
-
suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, metadata.sourceCode, messages)
|
|
43432
|
+
suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, metadata.sourceCode, messages),
|
|
43433
|
+
language: metadata.language
|
|
43292
43434
|
});
|
|
43293
43435
|
};
|
|
43294
43436
|
};
|
|
@@ -43953,7 +44095,7 @@ function requireEcmaVersion () {
|
|
|
43953
44095
|
* The latest ECMAScript version supported by ESLint.
|
|
43954
44096
|
* @type {number} year-based ECMAScript version
|
|
43955
44097
|
*/
|
|
43956
|
-
const LATEST_ECMA_VERSION =
|
|
44098
|
+
const LATEST_ECMA_VERSION = 2025;
|
|
43957
44099
|
|
|
43958
44100
|
ecmaVersion = {
|
|
43959
44101
|
LATEST_ECMA_VERSION
|
|
@@ -89011,6 +89153,8 @@ function requireNoSparseArrays () {
|
|
|
89011
89153
|
if (hasRequiredNoSparseArrays) return noSparseArrays;
|
|
89012
89154
|
hasRequiredNoSparseArrays = 1;
|
|
89013
89155
|
|
|
89156
|
+
const astUtils = requireAstUtils();
|
|
89157
|
+
|
|
89014
89158
|
//------------------------------------------------------------------------------
|
|
89015
89159
|
// Rule Definition
|
|
89016
89160
|
//------------------------------------------------------------------------------
|
|
@@ -89043,11 +89187,32 @@ function requireNoSparseArrays () {
|
|
|
89043
89187
|
return {
|
|
89044
89188
|
|
|
89045
89189
|
ArrayExpression(node) {
|
|
89190
|
+
if (!node.elements.includes(null)) {
|
|
89191
|
+
return;
|
|
89192
|
+
}
|
|
89193
|
+
|
|
89194
|
+
const { sourceCode } = context;
|
|
89195
|
+
let commaToken;
|
|
89196
|
+
|
|
89197
|
+
for (const [index, element] of node.elements.entries()) {
|
|
89198
|
+
if (index === node.elements.length - 1 && element) {
|
|
89199
|
+
return;
|
|
89200
|
+
}
|
|
89201
|
+
|
|
89202
|
+
commaToken = sourceCode.getTokenAfter(
|
|
89203
|
+
element ?? commaToken ?? sourceCode.getFirstToken(node),
|
|
89204
|
+
astUtils.isCommaToken
|
|
89205
|
+
);
|
|
89046
89206
|
|
|
89047
|
-
|
|
89207
|
+
if (element) {
|
|
89208
|
+
continue;
|
|
89209
|
+
}
|
|
89048
89210
|
|
|
89049
|
-
|
|
89050
|
-
|
|
89211
|
+
context.report({
|
|
89212
|
+
node,
|
|
89213
|
+
loc: commaToken.loc,
|
|
89214
|
+
messageId: "unexpectedSparseArray"
|
|
89215
|
+
});
|
|
89051
89216
|
}
|
|
89052
89217
|
}
|
|
89053
89218
|
|
|
@@ -92896,6 +93061,36 @@ function requireNoUnusedVars () {
|
|
|
92896
93061
|
}
|
|
92897
93062
|
}
|
|
92898
93063
|
|
|
93064
|
+
/**
|
|
93065
|
+
* Determines what variable type a def is.
|
|
93066
|
+
* @param {Object} def the declaration to check
|
|
93067
|
+
* @returns {VariableType} a simple name for the types of variables that this rule supports
|
|
93068
|
+
*/
|
|
93069
|
+
function defToVariableType(def) {
|
|
93070
|
+
|
|
93071
|
+
/*
|
|
93072
|
+
* This `destructuredArrayIgnorePattern` error report works differently from the catch
|
|
93073
|
+
* clause and parameter error reports. _Both_ the `varsIgnorePattern` and the
|
|
93074
|
+
* `destructuredArrayIgnorePattern` will be checked for array destructuring. However,
|
|
93075
|
+
* for the purposes of the report, the currently defined behavior is to only inform the
|
|
93076
|
+
* user of the `destructuredArrayIgnorePattern` if it's present (regardless of the fact
|
|
93077
|
+
* that the `varsIgnorePattern` would also apply). If it's not present, the user will be
|
|
93078
|
+
* informed of the `varsIgnorePattern`, assuming that's present.
|
|
93079
|
+
*/
|
|
93080
|
+
if (config.destructuredArrayIgnorePattern && def.name.parent.type === "ArrayPattern") {
|
|
93081
|
+
return "array-destructure";
|
|
93082
|
+
}
|
|
93083
|
+
|
|
93084
|
+
switch (def.type) {
|
|
93085
|
+
case "CatchClause":
|
|
93086
|
+
return "catch-clause";
|
|
93087
|
+
case "Parameter":
|
|
93088
|
+
return "parameter";
|
|
93089
|
+
default:
|
|
93090
|
+
return "variable";
|
|
93091
|
+
}
|
|
93092
|
+
}
|
|
93093
|
+
|
|
92899
93094
|
/**
|
|
92900
93095
|
* Gets a given variable's description and configured ignore pattern
|
|
92901
93096
|
* based on the provided variableType
|
|
@@ -92916,7 +93111,7 @@ function requireNoUnusedVars () {
|
|
|
92916
93111
|
|
|
92917
93112
|
case "catch-clause":
|
|
92918
93113
|
pattern = config.caughtErrorsIgnorePattern;
|
|
92919
|
-
variableDescription = "
|
|
93114
|
+
variableDescription = "caught errors";
|
|
92920
93115
|
break;
|
|
92921
93116
|
|
|
92922
93117
|
case "parameter":
|
|
@@ -92951,28 +93146,7 @@ function requireNoUnusedVars () {
|
|
|
92951
93146
|
let additionalMessageData = "";
|
|
92952
93147
|
|
|
92953
93148
|
if (def) {
|
|
92954
|
-
|
|
92955
|
-
let variableDescription;
|
|
92956
|
-
|
|
92957
|
-
switch (def.type) {
|
|
92958
|
-
case "CatchClause":
|
|
92959
|
-
if (config.caughtErrorsIgnorePattern) {
|
|
92960
|
-
[variableDescription, pattern] = getVariableDescription("catch-clause");
|
|
92961
|
-
}
|
|
92962
|
-
break;
|
|
92963
|
-
|
|
92964
|
-
case "Parameter":
|
|
92965
|
-
if (config.argsIgnorePattern) {
|
|
92966
|
-
[variableDescription, pattern] = getVariableDescription("parameter");
|
|
92967
|
-
}
|
|
92968
|
-
break;
|
|
92969
|
-
|
|
92970
|
-
default:
|
|
92971
|
-
if (config.varsIgnorePattern) {
|
|
92972
|
-
[variableDescription, pattern] = getVariableDescription("variable");
|
|
92973
|
-
}
|
|
92974
|
-
break;
|
|
92975
|
-
}
|
|
93149
|
+
const [variableDescription, pattern] = getVariableDescription(defToVariableType(def));
|
|
92976
93150
|
|
|
92977
93151
|
if (pattern && variableDescription) {
|
|
92978
93152
|
additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`;
|
|
@@ -92997,14 +93171,7 @@ function requireNoUnusedVars () {
|
|
|
92997
93171
|
let additionalMessageData = "";
|
|
92998
93172
|
|
|
92999
93173
|
if (def) {
|
|
93000
|
-
|
|
93001
|
-
let variableDescription;
|
|
93002
|
-
|
|
93003
|
-
if (def.name.parent.type === "ArrayPattern" && config.destructuredArrayIgnorePattern) {
|
|
93004
|
-
[variableDescription, pattern] = getVariableDescription("array-destructure");
|
|
93005
|
-
} else if (config.varsIgnorePattern) {
|
|
93006
|
-
[variableDescription, pattern] = getVariableDescription("variable");
|
|
93007
|
-
}
|
|
93174
|
+
const [variableDescription, pattern] = getVariableDescription(defToVariableType(def));
|
|
93008
93175
|
|
|
93009
93176
|
if (pattern && variableDescription) {
|
|
93010
93177
|
additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`;
|
|
@@ -111920,7 +112087,7 @@ var rules = {
|
|
|
111920
112087
|
"spaced-comment"
|
|
111921
112088
|
]
|
|
111922
112089
|
};
|
|
111923
|
-
var require$$
|
|
112090
|
+
var require$$18 = {
|
|
111924
112091
|
rules: rules
|
|
111925
112092
|
};
|
|
111926
112093
|
|
|
@@ -113327,10 +113494,9 @@ function requireCjs$1 () {
|
|
|
113327
113494
|
hasRequiredCjs$1 = 1;
|
|
113328
113495
|
|
|
113329
113496
|
/**
|
|
113330
|
-
* @
|
|
113497
|
+
* @fileoverview Merge Strategy
|
|
113331
113498
|
*/
|
|
113332
113499
|
|
|
113333
|
-
|
|
113334
113500
|
//-----------------------------------------------------------------------------
|
|
113335
113501
|
// Class
|
|
113336
113502
|
//-----------------------------------------------------------------------------
|
|
@@ -113377,10 +113543,9 @@ function requireCjs$1 () {
|
|
|
113377
113543
|
}
|
|
113378
113544
|
|
|
113379
113545
|
/**
|
|
113380
|
-
* @
|
|
113546
|
+
* @fileoverview Validation Strategy
|
|
113381
113547
|
*/
|
|
113382
113548
|
|
|
113383
|
-
|
|
113384
113549
|
//-----------------------------------------------------------------------------
|
|
113385
113550
|
// Class
|
|
113386
113551
|
//-----------------------------------------------------------------------------
|
|
@@ -113475,7 +113640,7 @@ function requireCjs$1 () {
|
|
|
113475
113640
|
}
|
|
113476
113641
|
|
|
113477
113642
|
/**
|
|
113478
|
-
* @
|
|
113643
|
+
* @fileoverview Object Schema
|
|
113479
113644
|
*/
|
|
113480
113645
|
|
|
113481
113646
|
|
|
@@ -113591,9 +113756,9 @@ function requireCjs$1 () {
|
|
|
113591
113756
|
super(`Key "${key}": ${source.message}`, { cause: source });
|
|
113592
113757
|
|
|
113593
113758
|
// copy over custom properties that aren't represented
|
|
113594
|
-
for (const
|
|
113595
|
-
if (!(
|
|
113596
|
-
this[
|
|
113759
|
+
for (const sourceKey of Object.keys(source)) {
|
|
113760
|
+
if (!(sourceKey in this)) {
|
|
113761
|
+
this[sourceKey] = source[sourceKey];
|
|
113597
113762
|
}
|
|
113598
113763
|
}
|
|
113599
113764
|
}
|
|
@@ -113700,7 +113865,9 @@ function requireCjs$1 () {
|
|
|
113700
113865
|
}
|
|
113701
113866
|
|
|
113702
113867
|
if (
|
|
113703
|
-
objects.some(
|
|
113868
|
+
objects.some(
|
|
113869
|
+
object => object === null || typeof object !== "object",
|
|
113870
|
+
)
|
|
113704
113871
|
) {
|
|
113705
113872
|
throw new TypeError("All arguments must be objects.");
|
|
113706
113873
|
}
|
|
@@ -113994,6 +114161,7 @@ function requireCjs () {
|
|
|
113994
114161
|
const MINIMATCH_OPTIONS = {
|
|
113995
114162
|
// matchBase: true,
|
|
113996
114163
|
dot: true,
|
|
114164
|
+
allowWindowsEscape: true,
|
|
113997
114165
|
};
|
|
113998
114166
|
|
|
113999
114167
|
/**
|
|
@@ -114359,7 +114527,7 @@ function requireCjs () {
|
|
|
114359
114527
|
const relativeFilePath = path.relative(basePath, filePath);
|
|
114360
114528
|
|
|
114361
114529
|
// match both strings and functions
|
|
114362
|
-
|
|
114530
|
+
function match(pattern) {
|
|
114363
114531
|
if (isString(pattern)) {
|
|
114364
114532
|
return doMatch(relativeFilePath, pattern);
|
|
114365
114533
|
}
|
|
@@ -114369,7 +114537,7 @@ function requireCjs () {
|
|
|
114369
114537
|
}
|
|
114370
114538
|
|
|
114371
114539
|
throw new TypeError(`Unexpected matcher type ${pattern}.`);
|
|
114372
|
-
}
|
|
114540
|
+
}
|
|
114373
114541
|
|
|
114374
114542
|
// check for all matches to config.files
|
|
114375
114543
|
let filePathMatchesPattern = config.files.some(pattern => {
|
|
@@ -114690,6 +114858,8 @@ function requireCjs () {
|
|
|
114690
114858
|
return this;
|
|
114691
114859
|
}
|
|
114692
114860
|
|
|
114861
|
+
/* eslint-disable class-methods-use-this -- Desired as instance methods */
|
|
114862
|
+
|
|
114693
114863
|
/**
|
|
114694
114864
|
* Finalizes the state of a config before being cached and returned by
|
|
114695
114865
|
* `getConfig()`. Does nothing by default but is provided to be
|
|
@@ -114713,53 +114883,7 @@ function requireCjs () {
|
|
|
114713
114883
|
return config;
|
|
114714
114884
|
}
|
|
114715
114885
|
|
|
114716
|
-
|
|
114717
|
-
* Determines if a given file path explicitly matches a `files` entry
|
|
114718
|
-
* and also doesn't match an `ignores` entry. Configs that don't have
|
|
114719
|
-
* a `files` property are not considered an explicit match.
|
|
114720
|
-
* @param {string} filePath The complete path of a file to check.
|
|
114721
|
-
* @returns {boolean} True if the file path matches a `files` entry
|
|
114722
|
-
* or false if not.
|
|
114723
|
-
*/
|
|
114724
|
-
isExplicitMatch(filePath) {
|
|
114725
|
-
assertNormalized(this);
|
|
114726
|
-
|
|
114727
|
-
const cache = dataCache.get(this);
|
|
114728
|
-
|
|
114729
|
-
// first check the cache to avoid duplicate work
|
|
114730
|
-
let result = cache.explicitMatches.get(filePath);
|
|
114731
|
-
|
|
114732
|
-
if (typeof result == "boolean") {
|
|
114733
|
-
return result;
|
|
114734
|
-
}
|
|
114735
|
-
|
|
114736
|
-
// TODO: Maybe move elsewhere? Maybe combine with getConfig() logic?
|
|
114737
|
-
const relativeFilePath = path.relative(this.basePath, filePath);
|
|
114738
|
-
|
|
114739
|
-
if (shouldIgnorePath(this.ignores, filePath, relativeFilePath)) {
|
|
114740
|
-
debug(`Ignoring ${filePath}`);
|
|
114741
|
-
|
|
114742
|
-
// cache and return result
|
|
114743
|
-
cache.explicitMatches.set(filePath, false);
|
|
114744
|
-
return false;
|
|
114745
|
-
}
|
|
114746
|
-
|
|
114747
|
-
// filePath isn't automatically ignored, so try to find a match
|
|
114748
|
-
|
|
114749
|
-
for (const config of this) {
|
|
114750
|
-
if (!config.files) {
|
|
114751
|
-
continue;
|
|
114752
|
-
}
|
|
114753
|
-
|
|
114754
|
-
if (pathMatches(filePath, this.basePath, config)) {
|
|
114755
|
-
debug(`Matching config found for ${filePath}`);
|
|
114756
|
-
cache.explicitMatches.set(filePath, true);
|
|
114757
|
-
return true;
|
|
114758
|
-
}
|
|
114759
|
-
}
|
|
114760
|
-
|
|
114761
|
-
return false;
|
|
114762
|
-
}
|
|
114886
|
+
/* eslint-enable class-methods-use-this -- Desired as instance methods */
|
|
114763
114887
|
|
|
114764
114888
|
/**
|
|
114765
114889
|
* Returns the config object for a given file path and a status that can be used to determine why a file has no config.
|
|
@@ -114814,7 +114938,7 @@ function requireCjs () {
|
|
|
114814
114938
|
|
|
114815
114939
|
const matchingConfigIndices = [];
|
|
114816
114940
|
let matchFound = false;
|
|
114817
|
-
const universalPattern =
|
|
114941
|
+
const universalPattern = /^\*$|\/\*{1,2}$/u;
|
|
114818
114942
|
|
|
114819
114943
|
this.forEach((config, index) => {
|
|
114820
114944
|
if (!config.files) {
|
|
@@ -114839,8 +114963,8 @@ function requireCjs () {
|
|
|
114839
114963
|
}
|
|
114840
114964
|
|
|
114841
114965
|
/*
|
|
114842
|
-
* If a config has a files pattern ending in /** or /*,
|
|
114843
|
-
* filePath only matches those patterns, then the config is only
|
|
114966
|
+
* If a config has a files pattern * or patterns ending in /** or /*,
|
|
114967
|
+
* and the filePath only matches those patterns, then the config is only
|
|
114844
114968
|
* applied if there is another config where the filePath matches
|
|
114845
114969
|
* a file with a specific extensions such as *.js.
|
|
114846
114970
|
*/
|
|
@@ -114893,7 +115017,6 @@ function requireCjs () {
|
|
|
114893
115017
|
debug(`Matching config found for ${filePath}`);
|
|
114894
115018
|
matchingConfigIndices.push(index);
|
|
114895
115019
|
matchFound = true;
|
|
114896
|
-
return;
|
|
114897
115020
|
}
|
|
114898
115021
|
});
|
|
114899
115022
|
|
|
@@ -114919,6 +115042,7 @@ function requireCjs () {
|
|
|
114919
115042
|
|
|
114920
115043
|
// otherwise construct the config
|
|
114921
115044
|
|
|
115045
|
+
// eslint-disable-next-line array-callback-return, consistent-return -- rethrowConfigError always throws an error
|
|
114922
115046
|
let finalConfig = matchingConfigIndices.reduce((result, index) => {
|
|
114923
115047
|
try {
|
|
114924
115048
|
return this[ConfigArraySymbol.schema].merge(
|
|
@@ -114999,7 +115123,7 @@ function requireCjs () {
|
|
|
114999
115123
|
|
|
115000
115124
|
const relativeDirectoryPath = path
|
|
115001
115125
|
.relative(this.basePath, directoryPath)
|
|
115002
|
-
.replace(/\\/
|
|
115126
|
+
.replace(/\\/gu, "/");
|
|
115003
115127
|
|
|
115004
115128
|
if (relativeDirectoryPath.startsWith("..")) {
|
|
115005
115129
|
return true;
|
|
@@ -115014,7 +115138,7 @@ function requireCjs () {
|
|
|
115014
115138
|
|
|
115015
115139
|
const directoryParts = relativeDirectoryPath.split("/");
|
|
115016
115140
|
let relativeDirectoryToCheck = "";
|
|
115017
|
-
let result
|
|
115141
|
+
let result;
|
|
115018
115142
|
|
|
115019
115143
|
/*
|
|
115020
115144
|
* In order to get the correct gitignore-style ignores, where an
|
|
@@ -115026,7 +115150,7 @@ function requireCjs () {
|
|
|
115026
115150
|
* have to recalculate everything for every call.
|
|
115027
115151
|
*/
|
|
115028
115152
|
do {
|
|
115029
|
-
relativeDirectoryToCheck += directoryParts.shift()
|
|
115153
|
+
relativeDirectoryToCheck += `${directoryParts.shift()}/`;
|
|
115030
115154
|
|
|
115031
115155
|
result = shouldIgnorePath(
|
|
115032
115156
|
this.ignores,
|
|
@@ -115146,12 +115270,6 @@ function requireFlatConfigSchema () {
|
|
|
115146
115270
|
[2, 2], ["error", 2]
|
|
115147
115271
|
]);
|
|
115148
115272
|
|
|
115149
|
-
const globalVariablesValues = new Set([
|
|
115150
|
-
true, "true", "writable", "writeable",
|
|
115151
|
-
false, "false", "readonly", "readable", null,
|
|
115152
|
-
"off"
|
|
115153
|
-
]);
|
|
115154
|
-
|
|
115155
115273
|
/**
|
|
115156
115274
|
* Check if a value is a non-null object.
|
|
115157
115275
|
* @param {any} value The value to check.
|
|
@@ -115256,6 +115374,23 @@ function requireFlatConfigSchema () {
|
|
|
115256
115374
|
return structuredClone(finalOptions);
|
|
115257
115375
|
}
|
|
115258
115376
|
|
|
115377
|
+
/**
|
|
115378
|
+
* Determines if an object has any methods.
|
|
115379
|
+
* @param {Object} object The object to check.
|
|
115380
|
+
* @returns {boolean} `true` if the object has any methods.
|
|
115381
|
+
*/
|
|
115382
|
+
function hasMethod(object) {
|
|
115383
|
+
|
|
115384
|
+
for (const key of Object.keys(object)) {
|
|
115385
|
+
|
|
115386
|
+
if (typeof object[key] === "function") {
|
|
115387
|
+
return true;
|
|
115388
|
+
}
|
|
115389
|
+
}
|
|
115390
|
+
|
|
115391
|
+
return false;
|
|
115392
|
+
}
|
|
115393
|
+
|
|
115259
115394
|
//-----------------------------------------------------------------------------
|
|
115260
115395
|
// Assertions
|
|
115261
115396
|
//-----------------------------------------------------------------------------
|
|
@@ -115414,47 +115549,48 @@ function requireFlatConfigSchema () {
|
|
|
115414
115549
|
validate: "object"
|
|
115415
115550
|
};
|
|
115416
115551
|
|
|
115552
|
+
|
|
115417
115553
|
//-----------------------------------------------------------------------------
|
|
115418
115554
|
// High-Level Schemas
|
|
115419
115555
|
//-----------------------------------------------------------------------------
|
|
115420
115556
|
|
|
115421
115557
|
/** @type {ObjectPropertySchema} */
|
|
115422
|
-
const
|
|
115423
|
-
merge
|
|
115424
|
-
validate(value) {
|
|
115558
|
+
const languageOptionsSchema = {
|
|
115559
|
+
merge(first = {}, second = {}) {
|
|
115425
115560
|
|
|
115426
|
-
|
|
115561
|
+
const result = deepMerge(first, second);
|
|
115427
115562
|
|
|
115428
|
-
for (const key of Object.
|
|
115563
|
+
for (const [key, value] of Object.entries(result)) {
|
|
115429
115564
|
|
|
115430
|
-
|
|
115431
|
-
|
|
115432
|
-
|
|
115433
|
-
|
|
115565
|
+
/*
|
|
115566
|
+
* Special case: Because the `parser` property is an object, it should
|
|
115567
|
+
* not be deep merged. Instead, it should be replaced if it exists in
|
|
115568
|
+
* the second object. To make this more generic, we just check for
|
|
115569
|
+
* objects with methods and replace them if they exist in the second
|
|
115570
|
+
* object.
|
|
115571
|
+
*/
|
|
115572
|
+
if (isNonArrayObject(value)) {
|
|
115573
|
+
if (hasMethod(value)) {
|
|
115574
|
+
result[key] = second[key] ?? first[key];
|
|
115575
|
+
continue;
|
|
115576
|
+
}
|
|
115434
115577
|
|
|
115435
|
-
|
|
115436
|
-
|
|
115578
|
+
// for other objects, make sure we aren't reusing the same object
|
|
115579
|
+
result[key] = { ...result[key] };
|
|
115580
|
+
continue;
|
|
115437
115581
|
}
|
|
115438
115582
|
|
|
115439
|
-
if (!globalVariablesValues.has(value[key])) {
|
|
115440
|
-
throw new TypeError(`Key "${key}": Expected "readonly", "writable", or "off".`);
|
|
115441
|
-
}
|
|
115442
115583
|
}
|
|
115443
|
-
|
|
115584
|
+
|
|
115585
|
+
return result;
|
|
115586
|
+
},
|
|
115587
|
+
validate: "object"
|
|
115444
115588
|
};
|
|
115445
115589
|
|
|
115446
115590
|
/** @type {ObjectPropertySchema} */
|
|
115447
|
-
const
|
|
115591
|
+
const languageSchema = {
|
|
115448
115592
|
merge: "replace",
|
|
115449
|
-
validate
|
|
115450
|
-
|
|
115451
|
-
if (!value || typeof value !== "object" ||
|
|
115452
|
-
(typeof value.parse !== "function" && typeof value.parseForESLint !== "function")
|
|
115453
|
-
) {
|
|
115454
|
-
throw new TypeError("Expected object with parse() or parseForESLint() method.");
|
|
115455
|
-
}
|
|
115456
|
-
|
|
115457
|
-
}
|
|
115593
|
+
validate: assertIsPluginMemberName
|
|
115458
115594
|
};
|
|
115459
115595
|
|
|
115460
115596
|
/** @type {ObjectPropertySchema} */
|
|
@@ -115614,28 +115750,6 @@ function requireFlatConfigSchema () {
|
|
|
115614
115750
|
}
|
|
115615
115751
|
};
|
|
115616
115752
|
|
|
115617
|
-
/** @type {ObjectPropertySchema} */
|
|
115618
|
-
const ecmaVersionSchema = {
|
|
115619
|
-
merge: "replace",
|
|
115620
|
-
validate(value) {
|
|
115621
|
-
if (typeof value === "number" || value === "latest") {
|
|
115622
|
-
return;
|
|
115623
|
-
}
|
|
115624
|
-
|
|
115625
|
-
throw new TypeError("Expected a number or \"latest\".");
|
|
115626
|
-
}
|
|
115627
|
-
};
|
|
115628
|
-
|
|
115629
|
-
/** @type {ObjectPropertySchema} */
|
|
115630
|
-
const sourceTypeSchema = {
|
|
115631
|
-
merge: "replace",
|
|
115632
|
-
validate(value) {
|
|
115633
|
-
if (typeof value !== "string" || !/^(?:script|module|commonjs)$/u.test(value)) {
|
|
115634
|
-
throw new TypeError("Expected \"script\", \"module\", or \"commonjs\".");
|
|
115635
|
-
}
|
|
115636
|
-
}
|
|
115637
|
-
};
|
|
115638
|
-
|
|
115639
115753
|
/**
|
|
115640
115754
|
* Creates a schema that always throws an error. Useful for warning
|
|
115641
115755
|
* about eslintrc-style keys.
|
|
@@ -115681,15 +115795,8 @@ function requireFlatConfigSchema () {
|
|
|
115681
115795
|
reportUnusedDisableDirectives: disableDirectiveSeveritySchema
|
|
115682
115796
|
}
|
|
115683
115797
|
},
|
|
115684
|
-
|
|
115685
|
-
|
|
115686
|
-
ecmaVersion: ecmaVersionSchema,
|
|
115687
|
-
sourceType: sourceTypeSchema,
|
|
115688
|
-
globals: globalsSchema,
|
|
115689
|
-
parser: parserSchema,
|
|
115690
|
-
parserOptions: deepObjectAssignSchema
|
|
115691
|
-
}
|
|
115692
|
-
},
|
|
115798
|
+
language: languageSchema,
|
|
115799
|
+
languageOptions: languageOptionsSchema,
|
|
115693
115800
|
processor: processorSchema,
|
|
115694
115801
|
plugins: pluginsSchema,
|
|
115695
115802
|
rules: rulesSchema
|
|
@@ -115701,6 +115808,7 @@ function requireFlatConfigSchema () {
|
|
|
115701
115808
|
|
|
115702
115809
|
flatConfigSchema_1 = {
|
|
115703
115810
|
flatConfigSchema,
|
|
115811
|
+
hasMethod,
|
|
115704
115812
|
assertIsRuleSeverity
|
|
115705
115813
|
};
|
|
115706
115814
|
return flatConfigSchema_1;
|
|
@@ -116011,7 +116119,7 @@ function requireRuleValidator () {
|
|
|
116011
116119
|
getRuleFromConfig,
|
|
116012
116120
|
getRuleOptionsSchema
|
|
116013
116121
|
} = requireFlatConfigHelpers();
|
|
116014
|
-
const ruleReplacements = require$$
|
|
116122
|
+
const ruleReplacements = require$$18;
|
|
116015
116123
|
|
|
116016
116124
|
//-----------------------------------------------------------------------------
|
|
116017
116125
|
// Helpers
|
|
@@ -116192,6 +116300,450 @@ function requireRuleValidator () {
|
|
|
116192
116300
|
|
|
116193
116301
|
var defaultConfig = {};
|
|
116194
116302
|
|
|
116303
|
+
/**
|
|
116304
|
+
* @fileoverview The schema to validate language options
|
|
116305
|
+
* @author Nicholas C. Zakas
|
|
116306
|
+
*/
|
|
116307
|
+
|
|
116308
|
+
var validateLanguageOptions_1;
|
|
116309
|
+
var hasRequiredValidateLanguageOptions;
|
|
116310
|
+
|
|
116311
|
+
function requireValidateLanguageOptions () {
|
|
116312
|
+
if (hasRequiredValidateLanguageOptions) return validateLanguageOptions_1;
|
|
116313
|
+
hasRequiredValidateLanguageOptions = 1;
|
|
116314
|
+
|
|
116315
|
+
//-----------------------------------------------------------------------------
|
|
116316
|
+
// Data
|
|
116317
|
+
//-----------------------------------------------------------------------------
|
|
116318
|
+
|
|
116319
|
+
const globalVariablesValues = new Set([
|
|
116320
|
+
true, "true", "writable", "writeable",
|
|
116321
|
+
false, "false", "readonly", "readable", null,
|
|
116322
|
+
"off"
|
|
116323
|
+
]);
|
|
116324
|
+
|
|
116325
|
+
//------------------------------------------------------------------------------
|
|
116326
|
+
// Helpers
|
|
116327
|
+
//------------------------------------------------------------------------------
|
|
116328
|
+
|
|
116329
|
+
/**
|
|
116330
|
+
* Check if a value is a non-null object.
|
|
116331
|
+
* @param {any} value The value to check.
|
|
116332
|
+
* @returns {boolean} `true` if the value is a non-null object.
|
|
116333
|
+
*/
|
|
116334
|
+
function isNonNullObject(value) {
|
|
116335
|
+
return typeof value === "object" && value !== null;
|
|
116336
|
+
}
|
|
116337
|
+
|
|
116338
|
+
/**
|
|
116339
|
+
* Check if a value is a non-null non-array object.
|
|
116340
|
+
* @param {any} value The value to check.
|
|
116341
|
+
* @returns {boolean} `true` if the value is a non-null non-array object.
|
|
116342
|
+
*/
|
|
116343
|
+
function isNonArrayObject(value) {
|
|
116344
|
+
return isNonNullObject(value) && !Array.isArray(value);
|
|
116345
|
+
}
|
|
116346
|
+
|
|
116347
|
+
/**
|
|
116348
|
+
* Check if a value is undefined.
|
|
116349
|
+
* @param {any} value The value to check.
|
|
116350
|
+
* @returns {boolean} `true` if the value is undefined.
|
|
116351
|
+
*/
|
|
116352
|
+
function isUndefined(value) {
|
|
116353
|
+
return typeof value === "undefined";
|
|
116354
|
+
}
|
|
116355
|
+
|
|
116356
|
+
//-----------------------------------------------------------------------------
|
|
116357
|
+
// Schemas
|
|
116358
|
+
//-----------------------------------------------------------------------------
|
|
116359
|
+
|
|
116360
|
+
/**
|
|
116361
|
+
* Validates the ecmaVersion property.
|
|
116362
|
+
* @param {string|number} ecmaVersion The value to check.
|
|
116363
|
+
* @returns {void}
|
|
116364
|
+
* @throws {TypeError} If the value is invalid.
|
|
116365
|
+
*/
|
|
116366
|
+
function validateEcmaVersion(ecmaVersion) {
|
|
116367
|
+
|
|
116368
|
+
if (isUndefined(ecmaVersion)) {
|
|
116369
|
+
throw new TypeError("Key \"ecmaVersion\": Expected an \"ecmaVersion\" property.");
|
|
116370
|
+
}
|
|
116371
|
+
|
|
116372
|
+
if (typeof ecmaVersion !== "number" && ecmaVersion !== "latest") {
|
|
116373
|
+
throw new TypeError("Key \"ecmaVersion\": Expected a number or \"latest\".");
|
|
116374
|
+
}
|
|
116375
|
+
|
|
116376
|
+
}
|
|
116377
|
+
|
|
116378
|
+
/**
|
|
116379
|
+
* Validates the sourceType property.
|
|
116380
|
+
* @param {string} sourceType The value to check.
|
|
116381
|
+
* @returns {void}
|
|
116382
|
+
* @throws {TypeError} If the value is invalid.
|
|
116383
|
+
*/
|
|
116384
|
+
function validateSourceType(sourceType) {
|
|
116385
|
+
|
|
116386
|
+
if (typeof sourceType !== "string" || !/^(?:script|module|commonjs)$/u.test(sourceType)) {
|
|
116387
|
+
throw new TypeError("Key \"sourceType\": Expected \"script\", \"module\", or \"commonjs\".");
|
|
116388
|
+
}
|
|
116389
|
+
|
|
116390
|
+
}
|
|
116391
|
+
|
|
116392
|
+
/**
|
|
116393
|
+
* Validates the globals property.
|
|
116394
|
+
* @param {Object} globals The value to check.
|
|
116395
|
+
* @returns {void}
|
|
116396
|
+
* @throws {TypeError} If the value is invalid.
|
|
116397
|
+
*/
|
|
116398
|
+
function validateGlobals(globals) {
|
|
116399
|
+
|
|
116400
|
+
if (!isNonArrayObject(globals)) {
|
|
116401
|
+
throw new TypeError("Key \"globals\": Expected an object.");
|
|
116402
|
+
}
|
|
116403
|
+
|
|
116404
|
+
for (const key of Object.keys(globals)) {
|
|
116405
|
+
|
|
116406
|
+
// avoid hairy edge case
|
|
116407
|
+
if (key === "__proto__") {
|
|
116408
|
+
continue;
|
|
116409
|
+
}
|
|
116410
|
+
|
|
116411
|
+
if (key !== key.trim()) {
|
|
116412
|
+
throw new TypeError(`Key "globals": Global "${key}" has leading or trailing whitespace.`);
|
|
116413
|
+
}
|
|
116414
|
+
|
|
116415
|
+
if (!globalVariablesValues.has(globals[key])) {
|
|
116416
|
+
throw new TypeError(`Key "globals": Key "${key}": Expected "readonly", "writable", or "off".`);
|
|
116417
|
+
}
|
|
116418
|
+
}
|
|
116419
|
+
}
|
|
116420
|
+
|
|
116421
|
+
/**
|
|
116422
|
+
* Validates the parser property.
|
|
116423
|
+
* @param {Object} parser The value to check.
|
|
116424
|
+
* @returns {void}
|
|
116425
|
+
* @throws {TypeError} If the value is invalid.
|
|
116426
|
+
*/
|
|
116427
|
+
function validateParser(parser) {
|
|
116428
|
+
|
|
116429
|
+
if (!parser || typeof parser !== "object" ||
|
|
116430
|
+
(typeof parser.parse !== "function" && typeof parser.parseForESLint !== "function")
|
|
116431
|
+
) {
|
|
116432
|
+
throw new TypeError("Key \"parser\": Expected object with parse() or parseForESLint() method.");
|
|
116433
|
+
}
|
|
116434
|
+
|
|
116435
|
+
}
|
|
116436
|
+
|
|
116437
|
+
/**
|
|
116438
|
+
* Validates the language options.
|
|
116439
|
+
* @param {Object} languageOptions The language options to validate.
|
|
116440
|
+
* @returns {void}
|
|
116441
|
+
* @throws {TypeError} If the language options are invalid.
|
|
116442
|
+
*/
|
|
116443
|
+
function validateLanguageOptions(languageOptions) {
|
|
116444
|
+
|
|
116445
|
+
if (!isNonArrayObject(languageOptions)) {
|
|
116446
|
+
throw new TypeError("Expected an object.");
|
|
116447
|
+
}
|
|
116448
|
+
|
|
116449
|
+
const {
|
|
116450
|
+
ecmaVersion,
|
|
116451
|
+
sourceType,
|
|
116452
|
+
globals,
|
|
116453
|
+
parser,
|
|
116454
|
+
parserOptions,
|
|
116455
|
+
...otherOptions
|
|
116456
|
+
} = languageOptions;
|
|
116457
|
+
|
|
116458
|
+
if ("ecmaVersion" in languageOptions) {
|
|
116459
|
+
validateEcmaVersion(ecmaVersion);
|
|
116460
|
+
}
|
|
116461
|
+
|
|
116462
|
+
if ("sourceType" in languageOptions) {
|
|
116463
|
+
validateSourceType(sourceType);
|
|
116464
|
+
}
|
|
116465
|
+
|
|
116466
|
+
if ("globals" in languageOptions) {
|
|
116467
|
+
validateGlobals(globals);
|
|
116468
|
+
}
|
|
116469
|
+
|
|
116470
|
+
if ("parser" in languageOptions) {
|
|
116471
|
+
validateParser(parser);
|
|
116472
|
+
}
|
|
116473
|
+
|
|
116474
|
+
if ("parserOptions" in languageOptions) {
|
|
116475
|
+
if (!isNonArrayObject(parserOptions)) {
|
|
116476
|
+
throw new TypeError("Key \"parserOptions\": Expected an object.");
|
|
116477
|
+
}
|
|
116478
|
+
}
|
|
116479
|
+
|
|
116480
|
+
const otherOptionKeys = Object.keys(otherOptions);
|
|
116481
|
+
|
|
116482
|
+
if (otherOptionKeys.length > 0) {
|
|
116483
|
+
throw new TypeError(`Unexpected key "${otherOptionKeys[0]}" found.`);
|
|
116484
|
+
}
|
|
116485
|
+
|
|
116486
|
+
}
|
|
116487
|
+
|
|
116488
|
+
validateLanguageOptions_1 = { validateLanguageOptions };
|
|
116489
|
+
return validateLanguageOptions_1;
|
|
116490
|
+
}
|
|
116491
|
+
|
|
116492
|
+
/**
|
|
116493
|
+
* @fileoverview JavaScript Language Object
|
|
116494
|
+
* @author Nicholas C. Zakas
|
|
116495
|
+
*/
|
|
116496
|
+
|
|
116497
|
+
var js;
|
|
116498
|
+
var hasRequiredJs;
|
|
116499
|
+
|
|
116500
|
+
function requireJs () {
|
|
116501
|
+
if (hasRequiredJs) return js;
|
|
116502
|
+
hasRequiredJs = 1;
|
|
116503
|
+
|
|
116504
|
+
//-----------------------------------------------------------------------------
|
|
116505
|
+
// Requirements
|
|
116506
|
+
//-----------------------------------------------------------------------------
|
|
116507
|
+
|
|
116508
|
+
const { SourceCode } = requireSourceCode();
|
|
116509
|
+
const createDebug = requireSrc();
|
|
116510
|
+
const astUtils = requireAstUtils$1();
|
|
116511
|
+
const eslintScope = requireEslintScope();
|
|
116512
|
+
const evk = requireEslintVisitorKeys$2();
|
|
116513
|
+
const { validateLanguageOptions } = requireValidateLanguageOptions();
|
|
116514
|
+
|
|
116515
|
+
//-----------------------------------------------------------------------------
|
|
116516
|
+
// Type Definitions
|
|
116517
|
+
//-----------------------------------------------------------------------------
|
|
116518
|
+
|
|
116519
|
+
/** @typedef {import("../../linter/vfile").VFile} VFile */
|
|
116520
|
+
|
|
116521
|
+
//-----------------------------------------------------------------------------
|
|
116522
|
+
// Helpers
|
|
116523
|
+
//-----------------------------------------------------------------------------
|
|
116524
|
+
|
|
116525
|
+
const debug = createDebug("eslint:languages:js");
|
|
116526
|
+
const DEFAULT_ECMA_VERSION = 5;
|
|
116527
|
+
|
|
116528
|
+
/**
|
|
116529
|
+
* Analyze scope of the given AST.
|
|
116530
|
+
* @param {ASTNode} ast The `Program` node to analyze.
|
|
116531
|
+
* @param {LanguageOptions} languageOptions The parser options.
|
|
116532
|
+
* @param {Record<string, string[]>} visitorKeys The visitor keys.
|
|
116533
|
+
* @returns {ScopeManager} The analysis result.
|
|
116534
|
+
*/
|
|
116535
|
+
function analyzeScope(ast, languageOptions, visitorKeys) {
|
|
116536
|
+
const parserOptions = languageOptions.parserOptions;
|
|
116537
|
+
const ecmaFeatures = parserOptions.ecmaFeatures || {};
|
|
116538
|
+
const ecmaVersion = languageOptions.ecmaVersion || DEFAULT_ECMA_VERSION;
|
|
116539
|
+
|
|
116540
|
+
return eslintScope.analyze(ast, {
|
|
116541
|
+
ignoreEval: true,
|
|
116542
|
+
nodejsScope: ecmaFeatures.globalReturn,
|
|
116543
|
+
impliedStrict: ecmaFeatures.impliedStrict,
|
|
116544
|
+
ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6,
|
|
116545
|
+
sourceType: languageOptions.sourceType || "script",
|
|
116546
|
+
childVisitorKeys: visitorKeys || evk.KEYS,
|
|
116547
|
+
fallback: evk.getKeys
|
|
116548
|
+
});
|
|
116549
|
+
}
|
|
116550
|
+
|
|
116551
|
+
//-----------------------------------------------------------------------------
|
|
116552
|
+
// Exports
|
|
116553
|
+
//-----------------------------------------------------------------------------
|
|
116554
|
+
|
|
116555
|
+
js = {
|
|
116556
|
+
|
|
116557
|
+
fileType: "text",
|
|
116558
|
+
lineStart: 1,
|
|
116559
|
+
columnStart: 0,
|
|
116560
|
+
nodeTypeKey: "type",
|
|
116561
|
+
visitorKeys: evk.KEYS,
|
|
116562
|
+
|
|
116563
|
+
validateLanguageOptions,
|
|
116564
|
+
|
|
116565
|
+
/**
|
|
116566
|
+
* Determines if a given node matches a given selector class.
|
|
116567
|
+
* @param {string} className The class name to check.
|
|
116568
|
+
* @param {ASTNode} node The node to check.
|
|
116569
|
+
* @param {Array<ASTNode>} ancestry The ancestry of the node.
|
|
116570
|
+
* @returns {boolean} True if there's a match, false if not.
|
|
116571
|
+
* @throws {Error} When an unknown class name is passed.
|
|
116572
|
+
*/
|
|
116573
|
+
matchesSelectorClass(className, node, ancestry) {
|
|
116574
|
+
|
|
116575
|
+
/*
|
|
116576
|
+
* Copyright (c) 2013, Joel Feenstra
|
|
116577
|
+
* All rights reserved.
|
|
116578
|
+
*
|
|
116579
|
+
* Redistribution and use in source and binary forms, with or without
|
|
116580
|
+
* modification, are permitted provided that the following conditions are met:
|
|
116581
|
+
* * Redistributions of source code must retain the above copyright
|
|
116582
|
+
* notice, this list of conditions and the following disclaimer.
|
|
116583
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
116584
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
116585
|
+
* documentation and/or other materials provided with the distribution.
|
|
116586
|
+
* * Neither the name of the ESQuery nor the names of its contributors may
|
|
116587
|
+
* be used to endorse or promote products derived from this software without
|
|
116588
|
+
* specific prior written permission.
|
|
116589
|
+
*
|
|
116590
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
116591
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
116592
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
116593
|
+
* DISCLAIMED. IN NO EVENT SHALL JOEL FEENSTRA BE LIABLE FOR ANY
|
|
116594
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
116595
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
116596
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
116597
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
116598
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
116599
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
116600
|
+
*/
|
|
116601
|
+
|
|
116602
|
+
switch (className.toLowerCase()) {
|
|
116603
|
+
|
|
116604
|
+
case "statement":
|
|
116605
|
+
if (node.type.slice(-9) === "Statement") {
|
|
116606
|
+
return true;
|
|
116607
|
+
}
|
|
116608
|
+
|
|
116609
|
+
// fallthrough: interface Declaration <: Statement { }
|
|
116610
|
+
|
|
116611
|
+
case "declaration":
|
|
116612
|
+
return node.type.slice(-11) === "Declaration";
|
|
116613
|
+
|
|
116614
|
+
case "pattern":
|
|
116615
|
+
if (node.type.slice(-7) === "Pattern") {
|
|
116616
|
+
return true;
|
|
116617
|
+
}
|
|
116618
|
+
|
|
116619
|
+
// fallthrough: interface Expression <: Node, Pattern { }
|
|
116620
|
+
|
|
116621
|
+
case "expression":
|
|
116622
|
+
return node.type.slice(-10) === "Expression" ||
|
|
116623
|
+
node.type.slice(-7) === "Literal" ||
|
|
116624
|
+
(
|
|
116625
|
+
node.type === "Identifier" &&
|
|
116626
|
+
(ancestry.length === 0 || ancestry[0].type !== "MetaProperty")
|
|
116627
|
+
) ||
|
|
116628
|
+
node.type === "MetaProperty";
|
|
116629
|
+
|
|
116630
|
+
case "function":
|
|
116631
|
+
return node.type === "FunctionDeclaration" ||
|
|
116632
|
+
node.type === "FunctionExpression" ||
|
|
116633
|
+
node.type === "ArrowFunctionExpression";
|
|
116634
|
+
|
|
116635
|
+
default:
|
|
116636
|
+
throw new Error(`Unknown class name: ${className}`);
|
|
116637
|
+
}
|
|
116638
|
+
},
|
|
116639
|
+
|
|
116640
|
+
/**
|
|
116641
|
+
* Parses the given file into an AST.
|
|
116642
|
+
* @param {VFile} file The virtual file to parse.
|
|
116643
|
+
* @param {Object} options Additional options passed from ESLint.
|
|
116644
|
+
* @param {LanguageOptions} options.languageOptions The language options.
|
|
116645
|
+
* @returns {Object} The result of parsing.
|
|
116646
|
+
*/
|
|
116647
|
+
parse(file, { languageOptions }) {
|
|
116648
|
+
|
|
116649
|
+
// Note: BOM already removed
|
|
116650
|
+
const { body: text, path: filePath } = file;
|
|
116651
|
+
const textToParse = text.replace(astUtils.shebangPattern, (match, captured) => `//${captured}`);
|
|
116652
|
+
const { ecmaVersion, sourceType, parser } = languageOptions;
|
|
116653
|
+
const parserOptions = Object.assign(
|
|
116654
|
+
{ ecmaVersion, sourceType },
|
|
116655
|
+
languageOptions.parserOptions,
|
|
116656
|
+
{
|
|
116657
|
+
loc: true,
|
|
116658
|
+
range: true,
|
|
116659
|
+
raw: true,
|
|
116660
|
+
tokens: true,
|
|
116661
|
+
comment: true,
|
|
116662
|
+
eslintVisitorKeys: true,
|
|
116663
|
+
eslintScopeManager: true,
|
|
116664
|
+
filePath
|
|
116665
|
+
}
|
|
116666
|
+
);
|
|
116667
|
+
|
|
116668
|
+
/*
|
|
116669
|
+
* Check for parsing errors first. If there's a parsing error, nothing
|
|
116670
|
+
* else can happen. However, a parsing error does not throw an error
|
|
116671
|
+
* from this method - it's just considered a fatal error message, a
|
|
116672
|
+
* problem that ESLint identified just like any other.
|
|
116673
|
+
*/
|
|
116674
|
+
try {
|
|
116675
|
+
debug("Parsing:", filePath);
|
|
116676
|
+
const parseResult = (typeof parser.parseForESLint === "function")
|
|
116677
|
+
? parser.parseForESLint(textToParse, parserOptions)
|
|
116678
|
+
: { ast: parser.parse(textToParse, parserOptions) };
|
|
116679
|
+
|
|
116680
|
+
debug("Parsing successful:", filePath);
|
|
116681
|
+
|
|
116682
|
+
const {
|
|
116683
|
+
ast,
|
|
116684
|
+
services: parserServices = {},
|
|
116685
|
+
visitorKeys = evk.KEYS,
|
|
116686
|
+
scopeManager
|
|
116687
|
+
} = parseResult;
|
|
116688
|
+
|
|
116689
|
+
return {
|
|
116690
|
+
ok: true,
|
|
116691
|
+
ast,
|
|
116692
|
+
parserServices,
|
|
116693
|
+
visitorKeys,
|
|
116694
|
+
scopeManager
|
|
116695
|
+
};
|
|
116696
|
+
} catch (ex) {
|
|
116697
|
+
|
|
116698
|
+
// If the message includes a leading line number, strip it:
|
|
116699
|
+
const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`;
|
|
116700
|
+
|
|
116701
|
+
debug("%s\n%s", message, ex.stack);
|
|
116702
|
+
|
|
116703
|
+
return {
|
|
116704
|
+
ok: false,
|
|
116705
|
+
errors: [{
|
|
116706
|
+
message,
|
|
116707
|
+
line: ex.lineNumber,
|
|
116708
|
+
column: ex.column
|
|
116709
|
+
}]
|
|
116710
|
+
};
|
|
116711
|
+
}
|
|
116712
|
+
|
|
116713
|
+
},
|
|
116714
|
+
|
|
116715
|
+
/**
|
|
116716
|
+
* Creates a new `SourceCode` object from the given information.
|
|
116717
|
+
* @param {VFile} file The virtual file to create a `SourceCode` object from.
|
|
116718
|
+
* @param {Object} parseResult The result returned from `parse()`.
|
|
116719
|
+
* @param {Object} options Additional options passed from ESLint.
|
|
116720
|
+
* @param {LanguageOptions} options.languageOptions The language options.
|
|
116721
|
+
* @returns {SourceCode} The new `SourceCode` object.
|
|
116722
|
+
*/
|
|
116723
|
+
createSourceCode(file, parseResult, { languageOptions }) {
|
|
116724
|
+
|
|
116725
|
+
const { body: text, path: filePath, bom: hasBOM } = file;
|
|
116726
|
+
const { ast, parserServices, visitorKeys } = parseResult;
|
|
116727
|
+
|
|
116728
|
+
debug("Scope analysis:", filePath);
|
|
116729
|
+
const scopeManager = parseResult.scopeManager || analyzeScope(ast, languageOptions, visitorKeys);
|
|
116730
|
+
|
|
116731
|
+
debug("Scope analysis successful:", filePath);
|
|
116732
|
+
|
|
116733
|
+
return new SourceCode({
|
|
116734
|
+
text,
|
|
116735
|
+
ast,
|
|
116736
|
+
hasBOM,
|
|
116737
|
+
parserServices,
|
|
116738
|
+
scopeManager,
|
|
116739
|
+
visitorKeys
|
|
116740
|
+
});
|
|
116741
|
+
}
|
|
116742
|
+
|
|
116743
|
+
};
|
|
116744
|
+
return js;
|
|
116745
|
+
}
|
|
116746
|
+
|
|
116195
116747
|
/**
|
|
116196
116748
|
* @fileoverview Default configuration
|
|
116197
116749
|
* @author Nicholas C. Zakas
|
|
@@ -116218,6 +116770,10 @@ function requireDefaultConfig () {
|
|
|
116218
116770
|
plugins: {
|
|
116219
116771
|
"@": {
|
|
116220
116772
|
|
|
116773
|
+
languages: {
|
|
116774
|
+
js: requireJs()
|
|
116775
|
+
},
|
|
116776
|
+
|
|
116221
116777
|
/*
|
|
116222
116778
|
* Because we try to delay loading rules until absolutely
|
|
116223
116779
|
* necessary, a proxy allows us to hook into the lazy-loading
|
|
@@ -116235,6 +116791,7 @@ function requireDefaultConfig () {
|
|
|
116235
116791
|
})
|
|
116236
116792
|
}
|
|
116237
116793
|
},
|
|
116794
|
+
language: "@/js",
|
|
116238
116795
|
languageOptions: {
|
|
116239
116796
|
sourceType: "module",
|
|
116240
116797
|
ecmaVersion: "latest",
|
|
@@ -116285,7 +116842,7 @@ function requireFlatConfigArray () {
|
|
|
116285
116842
|
//-----------------------------------------------------------------------------
|
|
116286
116843
|
|
|
116287
116844
|
const { ConfigArray, ConfigArraySymbol } = requireCjs();
|
|
116288
|
-
const { flatConfigSchema } = requireFlatConfigSchema();
|
|
116845
|
+
const { flatConfigSchema, hasMethod } = requireFlatConfigSchema();
|
|
116289
116846
|
const { RuleValidator } = requireRuleValidator();
|
|
116290
116847
|
const { defaultConfig } = requireDefaultConfig();
|
|
116291
116848
|
|
|
@@ -116398,6 +116955,43 @@ function requireFlatConfigArray () {
|
|
|
116398
116955
|
);
|
|
116399
116956
|
}
|
|
116400
116957
|
|
|
116958
|
+
/**
|
|
116959
|
+
* Converts a languageOptions object to a JSON representation.
|
|
116960
|
+
* @param {Record<string, any>} languageOptions The options to create a JSON
|
|
116961
|
+
* representation of.
|
|
116962
|
+
* @param {string} objectKey The key of the object being converted.
|
|
116963
|
+
* @returns {Record<string, any>} The JSON representation of the languageOptions.
|
|
116964
|
+
* @throws {TypeError} If a function is found in the languageOptions.
|
|
116965
|
+
*/
|
|
116966
|
+
function languageOptionsToJSON(languageOptions, objectKey = "languageOptions") {
|
|
116967
|
+
|
|
116968
|
+
const result = {};
|
|
116969
|
+
|
|
116970
|
+
for (const [key, value] of Object.entries(languageOptions)) {
|
|
116971
|
+
if (value) {
|
|
116972
|
+
if (typeof value === "object") {
|
|
116973
|
+
const name = getObjectId(value);
|
|
116974
|
+
|
|
116975
|
+
if (name && hasMethod(value)) {
|
|
116976
|
+
result[key] = name;
|
|
116977
|
+
} else {
|
|
116978
|
+
result[key] = languageOptionsToJSON(value, key);
|
|
116979
|
+
}
|
|
116980
|
+
continue;
|
|
116981
|
+
}
|
|
116982
|
+
|
|
116983
|
+
if (typeof value === "function") {
|
|
116984
|
+
throw new TypeError(`Cannot serialize key "${key}" in ${objectKey}: Function values are not supported.`);
|
|
116985
|
+
}
|
|
116986
|
+
|
|
116987
|
+
}
|
|
116988
|
+
|
|
116989
|
+
result[key] = value;
|
|
116990
|
+
}
|
|
116991
|
+
|
|
116992
|
+
return result;
|
|
116993
|
+
}
|
|
116994
|
+
|
|
116401
116995
|
const originalBaseConfig = Symbol("originalBaseConfig");
|
|
116402
116996
|
const originalLength = Symbol("originalLength");
|
|
116403
116997
|
const baseLength = Symbol("baseLength");
|
|
@@ -116544,10 +117138,11 @@ function requireFlatConfigArray () {
|
|
|
116544
117138
|
*/
|
|
116545
117139
|
[ConfigArraySymbol.finalizeConfig](config) {
|
|
116546
117140
|
|
|
116547
|
-
const { plugins, languageOptions, processor } = config;
|
|
116548
|
-
let parserName, processorName;
|
|
117141
|
+
const { plugins, language, languageOptions, processor } = config;
|
|
117142
|
+
let parserName, processorName, languageName;
|
|
116549
117143
|
let invalidParser = false,
|
|
116550
|
-
invalidProcessor = false
|
|
117144
|
+
invalidProcessor = false,
|
|
117145
|
+
invalidLanguage = false;
|
|
116551
117146
|
|
|
116552
117147
|
// Check parser value
|
|
116553
117148
|
if (languageOptions && languageOptions.parser) {
|
|
@@ -116565,6 +117160,29 @@ function requireFlatConfigArray () {
|
|
|
116565
117160
|
}
|
|
116566
117161
|
}
|
|
116567
117162
|
|
|
117163
|
+
// Check language value
|
|
117164
|
+
if (language) {
|
|
117165
|
+
if (typeof language === "string") {
|
|
117166
|
+
const { pluginName, objectName: localLanguageName } = splitPluginIdentifier(language);
|
|
117167
|
+
|
|
117168
|
+
languageName = language;
|
|
117169
|
+
|
|
117170
|
+
if (!plugins || !plugins[pluginName] || !plugins[pluginName].languages || !plugins[pluginName].languages[localLanguageName]) {
|
|
117171
|
+
throw new TypeError(`Key "language": Could not find "${localLanguageName}" in plugin "${pluginName}".`);
|
|
117172
|
+
}
|
|
117173
|
+
|
|
117174
|
+
config.language = plugins[pluginName].languages[localLanguageName];
|
|
117175
|
+
} else {
|
|
117176
|
+
invalidLanguage = true;
|
|
117177
|
+
}
|
|
117178
|
+
|
|
117179
|
+
try {
|
|
117180
|
+
config.language.validateLanguageOptions(config.languageOptions);
|
|
117181
|
+
} catch (error) {
|
|
117182
|
+
throw new TypeError(`Key "languageOptions": ${error.message}`, { cause: error });
|
|
117183
|
+
}
|
|
117184
|
+
}
|
|
117185
|
+
|
|
116568
117186
|
// Check processor value
|
|
116569
117187
|
if (processor) {
|
|
116570
117188
|
if (typeof processor === "string") {
|
|
@@ -116604,6 +117222,10 @@ function requireFlatConfigArray () {
|
|
|
116604
117222
|
throw new Error("Could not serialize processor object (missing 'meta' object).");
|
|
116605
117223
|
}
|
|
116606
117224
|
|
|
117225
|
+
if (invalidLanguage) {
|
|
117226
|
+
throw new Error("Caching is not supported when language is an object.");
|
|
117227
|
+
}
|
|
117228
|
+
|
|
116607
117229
|
return {
|
|
116608
117230
|
...this,
|
|
116609
117231
|
plugins: Object.entries(plugins).map(([namespace, plugin]) => {
|
|
@@ -116616,10 +117238,8 @@ function requireFlatConfigArray () {
|
|
|
116616
117238
|
|
|
116617
117239
|
return `${namespace}:${pluginId}`;
|
|
116618
117240
|
}),
|
|
116619
|
-
|
|
116620
|
-
|
|
116621
|
-
parser: parserName
|
|
116622
|
-
},
|
|
117241
|
+
language: languageName,
|
|
117242
|
+
languageOptions: languageOptionsToJSON(languageOptions),
|
|
116623
117243
|
processor: processorName
|
|
116624
117244
|
};
|
|
116625
117245
|
}
|
|
@@ -116636,6 +117256,152 @@ function requireFlatConfigArray () {
|
|
|
116636
117256
|
return flatConfigArray;
|
|
116637
117257
|
}
|
|
116638
117258
|
|
|
117259
|
+
/**
|
|
117260
|
+
* @fileoverview Shared flags for ESLint.
|
|
117261
|
+
*/
|
|
117262
|
+
|
|
117263
|
+
var flags;
|
|
117264
|
+
var hasRequiredFlags;
|
|
117265
|
+
|
|
117266
|
+
function requireFlags () {
|
|
117267
|
+
if (hasRequiredFlags) return flags;
|
|
117268
|
+
hasRequiredFlags = 1;
|
|
117269
|
+
|
|
117270
|
+
/**
|
|
117271
|
+
* The set of flags that change ESLint behavior with a description.
|
|
117272
|
+
* @type {Map<string, string>}
|
|
117273
|
+
*/
|
|
117274
|
+
const activeFlags = new Map([
|
|
117275
|
+
["test_only", "This flag is only used for testing."]
|
|
117276
|
+
]);
|
|
117277
|
+
|
|
117278
|
+
/**
|
|
117279
|
+
* The set of flags that used to be active but no longer have an effect.
|
|
117280
|
+
* @type {Map<string, string>}
|
|
117281
|
+
*/
|
|
117282
|
+
const inactiveFlags = new Map([
|
|
117283
|
+
["test_only_old", "This flag is no longer used for testing."]
|
|
117284
|
+
]);
|
|
117285
|
+
|
|
117286
|
+
flags = {
|
|
117287
|
+
activeFlags,
|
|
117288
|
+
inactiveFlags
|
|
117289
|
+
};
|
|
117290
|
+
return flags;
|
|
117291
|
+
}
|
|
117292
|
+
|
|
117293
|
+
/**
|
|
117294
|
+
* @fileoverview Virtual file
|
|
117295
|
+
* @author Nicholas C. Zakas
|
|
117296
|
+
*/
|
|
117297
|
+
|
|
117298
|
+
var vfile;
|
|
117299
|
+
var hasRequiredVfile;
|
|
117300
|
+
|
|
117301
|
+
function requireVfile () {
|
|
117302
|
+
if (hasRequiredVfile) return vfile;
|
|
117303
|
+
hasRequiredVfile = 1;
|
|
117304
|
+
|
|
117305
|
+
//------------------------------------------------------------------------------
|
|
117306
|
+
// Helpers
|
|
117307
|
+
//------------------------------------------------------------------------------
|
|
117308
|
+
|
|
117309
|
+
/**
|
|
117310
|
+
* Determines if a given value has a byte order mark (BOM).
|
|
117311
|
+
* @param {string|Uint8Array} value The value to check.
|
|
117312
|
+
* @returns {boolean} `true` if the value has a BOM, `false` otherwise.
|
|
117313
|
+
*/
|
|
117314
|
+
function hasUnicodeBOM(value) {
|
|
117315
|
+
return typeof value === "string"
|
|
117316
|
+
? value.charCodeAt(0) === 0xFEFF
|
|
117317
|
+
: value[0] === 0xEF && value[1] === 0xBB && value[2] === 0xBF;
|
|
117318
|
+
}
|
|
117319
|
+
|
|
117320
|
+
/**
|
|
117321
|
+
* Strips Unicode BOM from the given value.
|
|
117322
|
+
* @param {string|Uint8Array} value The value to remove the BOM from.
|
|
117323
|
+
* @returns {string|Uint8Array} The stripped value.
|
|
117324
|
+
*/
|
|
117325
|
+
function stripUnicodeBOM(value) {
|
|
117326
|
+
|
|
117327
|
+
if (!hasUnicodeBOM(value)) {
|
|
117328
|
+
return value;
|
|
117329
|
+
}
|
|
117330
|
+
|
|
117331
|
+
if (typeof value === "string") {
|
|
117332
|
+
|
|
117333
|
+
/*
|
|
117334
|
+
* Check Unicode BOM.
|
|
117335
|
+
* In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF.
|
|
117336
|
+
* http://www.ecma-international.org/ecma-262/6.0/#sec-unicode-format-control-characters
|
|
117337
|
+
*/
|
|
117338
|
+
return value.slice(1);
|
|
117339
|
+
}
|
|
117340
|
+
|
|
117341
|
+
/*
|
|
117342
|
+
* In a Uint8Array, the BOM is represented by three bytes: 0xEF, 0xBB, and 0xBF,
|
|
117343
|
+
* so we can just remove the first three bytes.
|
|
117344
|
+
*/
|
|
117345
|
+
return value.slice(3);
|
|
117346
|
+
}
|
|
117347
|
+
|
|
117348
|
+
//------------------------------------------------------------------------------
|
|
117349
|
+
// Exports
|
|
117350
|
+
//------------------------------------------------------------------------------
|
|
117351
|
+
|
|
117352
|
+
/**
|
|
117353
|
+
* Represents a virtual file inside of ESLint.
|
|
117354
|
+
*/
|
|
117355
|
+
class VFile {
|
|
117356
|
+
|
|
117357
|
+
/**
|
|
117358
|
+
* The file path including any processor-created virtual path.
|
|
117359
|
+
* @type {string}
|
|
117360
|
+
* @readonly
|
|
117361
|
+
*/
|
|
117362
|
+
path;
|
|
117363
|
+
|
|
117364
|
+
/**
|
|
117365
|
+
* The file path on disk.
|
|
117366
|
+
* @type {string}
|
|
117367
|
+
* @readonly
|
|
117368
|
+
*/
|
|
117369
|
+
physicalPath;
|
|
117370
|
+
|
|
117371
|
+
/**
|
|
117372
|
+
* The file contents.
|
|
117373
|
+
* @type {string|Uint8Array}
|
|
117374
|
+
* @readonly
|
|
117375
|
+
*/
|
|
117376
|
+
body;
|
|
117377
|
+
|
|
117378
|
+
/**
|
|
117379
|
+
* Indicates whether the file has a byte order mark (BOM).
|
|
117380
|
+
* @type {boolean}
|
|
117381
|
+
* @readonly
|
|
117382
|
+
*/
|
|
117383
|
+
bom;
|
|
117384
|
+
|
|
117385
|
+
/**
|
|
117386
|
+
* Creates a new instance.
|
|
117387
|
+
* @param {string} path The file path.
|
|
117388
|
+
* @param {string|Uint8Array} body The file contents.
|
|
117389
|
+
* @param {Object} [options] Additional options.
|
|
117390
|
+
* @param {string} [options.physicalPath] The file path on disk.
|
|
117391
|
+
*/
|
|
117392
|
+
constructor(path, body, { physicalPath } = {}) {
|
|
117393
|
+
this.path = path;
|
|
117394
|
+
this.physicalPath = physicalPath ?? path;
|
|
117395
|
+
this.bom = hasUnicodeBOM(body);
|
|
117396
|
+
this.body = stripUnicodeBOM(body);
|
|
117397
|
+
}
|
|
117398
|
+
|
|
117399
|
+
}
|
|
117400
|
+
|
|
117401
|
+
vfile = { VFile };
|
|
117402
|
+
return vfile;
|
|
117403
|
+
}
|
|
117404
|
+
|
|
116639
117405
|
var linter;
|
|
116640
117406
|
var hasRequiredLinter;
|
|
116641
117407
|
|
|
@@ -116654,7 +117420,6 @@ function requireLinter () {
|
|
|
116654
117420
|
espree = requireEspree(),
|
|
116655
117421
|
merge = requireLodash_merge(),
|
|
116656
117422
|
pkg = require$$5,
|
|
116657
|
-
astUtils = requireAstUtils$1(),
|
|
116658
117423
|
{
|
|
116659
117424
|
directivesPattern
|
|
116660
117425
|
} = requireDirectives(),
|
|
@@ -116675,13 +117440,15 @@ function requireLinter () {
|
|
|
116675
117440
|
createEmitter = requireSafeEmitter(),
|
|
116676
117441
|
SourceCodeFixer = requireSourceCodeFixer(),
|
|
116677
117442
|
timing = requireTiming(),
|
|
116678
|
-
ruleReplacements = require$$
|
|
117443
|
+
ruleReplacements = require$$18;
|
|
116679
117444
|
const { getRuleFromConfig } = requireFlatConfigHelpers();
|
|
116680
117445
|
const { FlatConfigArray } = requireFlatConfigArray();
|
|
116681
117446
|
const { startTime, endTime } = requireStats();
|
|
116682
117447
|
const { RuleValidator } = requireRuleValidator();
|
|
116683
117448
|
const { assertIsRuleSeverity } = requireFlatConfigSchema();
|
|
116684
117449
|
const { normalizeSeverityToString } = requireSeverity();
|
|
117450
|
+
const jslang = requireJs();
|
|
117451
|
+
const { activeFlags } = requireFlags();
|
|
116685
117452
|
const debug = requireSrc()("eslint:linter");
|
|
116686
117453
|
const MAX_AUTOFIX_PASSES = 10;
|
|
116687
117454
|
const DEFAULT_PARSER_NAME = "espree";
|
|
@@ -116690,6 +117457,7 @@ function requireLinter () {
|
|
|
116690
117457
|
const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } };
|
|
116691
117458
|
const parserSymbol = Symbol.for("eslint.RuleTester.parser");
|
|
116692
117459
|
const { LATEST_ECMA_VERSION } = requireEcmaVersion();
|
|
117460
|
+
const { VFile } = requireVfile();
|
|
116693
117461
|
const STEP_KIND_VISIT = 1;
|
|
116694
117462
|
const STEP_KIND_CALL = 2;
|
|
116695
117463
|
|
|
@@ -116876,6 +117644,35 @@ function requireLinter () {
|
|
|
116876
117644
|
: `Definition for rule '${ruleId}' was not found.`;
|
|
116877
117645
|
}
|
|
116878
117646
|
|
|
117647
|
+
/**
|
|
117648
|
+
* Updates a given location based on the language offsets. This allows us to
|
|
117649
|
+
* change 0-based locations to 1-based locations. We always want ESLint
|
|
117650
|
+
* reporting lines and columns starting from 1.
|
|
117651
|
+
* @param {Object} location The location to update.
|
|
117652
|
+
* @param {number} location.line The starting line number.
|
|
117653
|
+
* @param {number} location.column The starting column number.
|
|
117654
|
+
* @param {number} [location.endLine] The ending line number.
|
|
117655
|
+
* @param {number} [location.endColumn] The ending column number.
|
|
117656
|
+
* @param {Language} language The language to use to adjust the location information.
|
|
117657
|
+
* @returns {Object} The updated location.
|
|
117658
|
+
*/
|
|
117659
|
+
function updateLocationInformation({ line, column, endLine, endColumn }, language) {
|
|
117660
|
+
|
|
117661
|
+
const columnOffset = language.columnStart === 1 ? 0 : 1;
|
|
117662
|
+
const lineOffset = language.lineStart === 1 ? 0 : 1;
|
|
117663
|
+
|
|
117664
|
+
// calculate separately to account for undefined
|
|
117665
|
+
const finalEndLine = endLine === void 0 ? endLine : endLine + lineOffset;
|
|
117666
|
+
const finalEndColumn = endColumn === void 0 ? endColumn : endColumn + columnOffset;
|
|
117667
|
+
|
|
117668
|
+
return {
|
|
117669
|
+
line: line + lineOffset,
|
|
117670
|
+
column: column + columnOffset,
|
|
117671
|
+
endLine: finalEndLine,
|
|
117672
|
+
endColumn: finalEndColumn
|
|
117673
|
+
};
|
|
117674
|
+
}
|
|
117675
|
+
|
|
116879
117676
|
/**
|
|
116880
117677
|
* creates a linting problem
|
|
116881
117678
|
* @param {Object} options to create linting error
|
|
@@ -116883,6 +117680,7 @@ function requireLinter () {
|
|
|
116883
117680
|
* @param {Object} [options.loc] the loc to report
|
|
116884
117681
|
* @param {string} [options.message] the error message to report
|
|
116885
117682
|
* @param {string} [options.severity] the error message to report
|
|
117683
|
+
* @param {Language} [options.language] the language to use to adjust the location information
|
|
116886
117684
|
* @returns {LintMessage} created problem, returns a missing-rule problem if only provided ruleId.
|
|
116887
117685
|
* @private
|
|
116888
117686
|
*/
|
|
@@ -116891,16 +117689,24 @@ function requireLinter () {
|
|
|
116891
117689
|
ruleId = null,
|
|
116892
117690
|
loc = DEFAULT_ERROR_LOC,
|
|
116893
117691
|
message = createMissingRuleMessage(options.ruleId),
|
|
116894
|
-
severity = 2
|
|
117692
|
+
severity = 2,
|
|
117693
|
+
|
|
117694
|
+
// fallback for eslintrc mode
|
|
117695
|
+
language = {
|
|
117696
|
+
columnStart: 0,
|
|
117697
|
+
lineStart: 1
|
|
117698
|
+
}
|
|
116895
117699
|
} = options;
|
|
116896
117700
|
|
|
116897
117701
|
return {
|
|
116898
117702
|
ruleId,
|
|
116899
117703
|
message,
|
|
116900
|
-
|
|
116901
|
-
|
|
116902
|
-
|
|
116903
|
-
|
|
117704
|
+
...updateLocationInformation({
|
|
117705
|
+
line: loc.start.line,
|
|
117706
|
+
column: loc.start.column,
|
|
117707
|
+
endLine: loc.end.line,
|
|
117708
|
+
endColumn: loc.end.column
|
|
117709
|
+
}, language),
|
|
116904
117710
|
severity,
|
|
116905
117711
|
nodeType: null
|
|
116906
117712
|
};
|
|
@@ -116915,9 +117721,10 @@ function requireLinter () {
|
|
|
116915
117721
|
* @param {string} options.justification The justification of the directive
|
|
116916
117722
|
* @param {ASTNode|token} options.node The Comment node/token.
|
|
116917
117723
|
* @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
|
|
117724
|
+
* @param {Language} language The language to use to adjust the location information.
|
|
116918
117725
|
* @returns {Object} Directives and problems from the comment
|
|
116919
117726
|
*/
|
|
116920
|
-
function createDisableDirectives({ type, value, justification, node }, ruleMapper) {
|
|
117727
|
+
function createDisableDirectives({ type, value, justification, node }, ruleMapper, language) {
|
|
116921
117728
|
const ruleIds = Object.keys(commentParser.parseListConfig(value));
|
|
116922
117729
|
const directiveRules = ruleIds.length ? ruleIds : [null];
|
|
116923
117730
|
const result = {
|
|
@@ -116931,26 +117738,36 @@ function requireLinter () {
|
|
|
116931
117738
|
// push to directives, if the rule is defined(including null, e.g. /*eslint enable*/)
|
|
116932
117739
|
if (ruleId === null || !!ruleMapper(ruleId)) {
|
|
116933
117740
|
if (type === "disable-next-line") {
|
|
117741
|
+
const { line, column } = updateLocationInformation(
|
|
117742
|
+
node.loc.end,
|
|
117743
|
+
language
|
|
117744
|
+
);
|
|
117745
|
+
|
|
116934
117746
|
result.directives.push({
|
|
116935
117747
|
parentDirective,
|
|
116936
117748
|
type,
|
|
116937
|
-
line
|
|
116938
|
-
column
|
|
117749
|
+
line,
|
|
117750
|
+
column,
|
|
116939
117751
|
ruleId,
|
|
116940
117752
|
justification
|
|
116941
117753
|
});
|
|
116942
117754
|
} else {
|
|
117755
|
+
const { line, column } = updateLocationInformation(
|
|
117756
|
+
node.loc.start,
|
|
117757
|
+
language
|
|
117758
|
+
);
|
|
117759
|
+
|
|
116943
117760
|
result.directives.push({
|
|
116944
117761
|
parentDirective,
|
|
116945
117762
|
type,
|
|
116946
|
-
line
|
|
116947
|
-
column
|
|
117763
|
+
line,
|
|
117764
|
+
column,
|
|
116948
117765
|
ruleId,
|
|
116949
117766
|
justification
|
|
116950
117767
|
});
|
|
116951
117768
|
}
|
|
116952
117769
|
} else {
|
|
116953
|
-
result.directiveProblems.push(createLintingProblem({ ruleId, loc: node.loc }));
|
|
117770
|
+
result.directiveProblems.push(createLintingProblem({ ruleId, loc: node.loc, language }));
|
|
116954
117771
|
}
|
|
116955
117772
|
}
|
|
116956
117773
|
return result;
|
|
@@ -117028,7 +117845,7 @@ function requireLinter () {
|
|
|
117028
117845
|
value: directiveValue,
|
|
117029
117846
|
justification: justificationPart,
|
|
117030
117847
|
node: comment
|
|
117031
|
-
}, ruleMapper);
|
|
117848
|
+
}, ruleMapper, jslang);
|
|
117032
117849
|
|
|
117033
117850
|
disableDirectives.push(...directives);
|
|
117034
117851
|
problems.push(...directiveProblems);
|
|
@@ -117068,7 +117885,7 @@ function requireLinter () {
|
|
|
117068
117885
|
break;
|
|
117069
117886
|
|
|
117070
117887
|
case "eslint": {
|
|
117071
|
-
const parseResult = commentParser.parseJsonConfig(directiveValue
|
|
117888
|
+
const parseResult = commentParser.parseJsonConfig(directiveValue);
|
|
117072
117889
|
|
|
117073
117890
|
if (parseResult.success) {
|
|
117074
117891
|
Object.keys(parseResult.config).forEach(name => {
|
|
@@ -117155,7 +117972,14 @@ function requireLinter () {
|
|
|
117155
117972
|
configuredRules[name] = ruleOptions;
|
|
117156
117973
|
});
|
|
117157
117974
|
} else {
|
|
117158
|
-
|
|
117975
|
+
const problem = createLintingProblem({
|
|
117976
|
+
ruleId: null,
|
|
117977
|
+
loc: comment.loc,
|
|
117978
|
+
message: parseResult.error.message
|
|
117979
|
+
});
|
|
117980
|
+
|
|
117981
|
+
problem.fatal = true;
|
|
117982
|
+
problems.push(problem);
|
|
117159
117983
|
}
|
|
117160
117984
|
|
|
117161
117985
|
break;
|
|
@@ -117178,26 +118002,32 @@ function requireLinter () {
|
|
|
117178
118002
|
* Parses comments in file to extract disable directives.
|
|
117179
118003
|
* @param {SourceCode} sourceCode The SourceCode object to get comments from.
|
|
117180
118004
|
* @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
|
|
118005
|
+
* @param {Language} language The language to use to adjust the location information
|
|
117181
118006
|
* @returns {{problems: LintMessage[], disableDirectives: DisableDirective[]}}
|
|
117182
118007
|
* A collection of the directive comments that were found, along with any problems that occurred when parsing
|
|
117183
118008
|
*/
|
|
117184
|
-
function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper) {
|
|
118009
|
+
function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper, language) {
|
|
117185
118010
|
const disableDirectives = [];
|
|
117186
118011
|
const problems = [];
|
|
117187
118012
|
|
|
117188
|
-
|
|
117189
|
-
|
|
117190
|
-
|
|
117191
|
-
|
|
118013
|
+
if (sourceCode.getDisableDirectives) {
|
|
118014
|
+
const {
|
|
118015
|
+
directives: directivesSources,
|
|
118016
|
+
problems: directivesProblems
|
|
118017
|
+
} = sourceCode.getDisableDirectives();
|
|
117192
118018
|
|
|
117193
|
-
|
|
118019
|
+
problems.push(...directivesProblems.map(directiveProblem => createLintingProblem({
|
|
118020
|
+
...directiveProblem,
|
|
118021
|
+
language
|
|
118022
|
+
})));
|
|
117194
118023
|
|
|
117195
|
-
|
|
117196
|
-
|
|
118024
|
+
directivesSources.forEach(directive => {
|
|
118025
|
+
const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper, language);
|
|
117197
118026
|
|
|
117198
|
-
|
|
117199
|
-
|
|
117200
|
-
|
|
118027
|
+
disableDirectives.push(...directives);
|
|
118028
|
+
problems.push(...directiveProblems);
|
|
118029
|
+
});
|
|
118030
|
+
}
|
|
117201
118031
|
|
|
117202
118032
|
return {
|
|
117203
118033
|
problems,
|
|
@@ -117418,24 +118248,6 @@ function requireLinter () {
|
|
|
117418
118248
|
);
|
|
117419
118249
|
}
|
|
117420
118250
|
|
|
117421
|
-
/**
|
|
117422
|
-
* Strips Unicode BOM from a given text.
|
|
117423
|
-
* @param {string} text A text to strip.
|
|
117424
|
-
* @returns {string} The stripped text.
|
|
117425
|
-
*/
|
|
117426
|
-
function stripUnicodeBOM(text) {
|
|
117427
|
-
|
|
117428
|
-
/*
|
|
117429
|
-
* Check Unicode BOM.
|
|
117430
|
-
* In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF.
|
|
117431
|
-
* http://www.ecma-international.org/ecma-262/6.0/#sec-unicode-format-control-characters
|
|
117432
|
-
*/
|
|
117433
|
-
if (text.charCodeAt(0) === 0xFEFF) {
|
|
117434
|
-
return text.slice(1);
|
|
117435
|
-
}
|
|
117436
|
-
return text;
|
|
117437
|
-
}
|
|
117438
|
-
|
|
117439
118251
|
/**
|
|
117440
118252
|
* Store time measurements in map
|
|
117441
118253
|
* @param {number} time Time measurement
|
|
@@ -117497,99 +118309,46 @@ function requireLinter () {
|
|
|
117497
118309
|
impliedStrict: ecmaFeatures.impliedStrict,
|
|
117498
118310
|
ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6,
|
|
117499
118311
|
sourceType: languageOptions.sourceType || "script",
|
|
117500
|
-
childVisitorKeys:
|
|
118312
|
+
childVisitorKeys: evk.KEYS,
|
|
117501
118313
|
fallback: Traverser.getKeys
|
|
117502
118314
|
});
|
|
117503
118315
|
}
|
|
117504
118316
|
|
|
117505
118317
|
/**
|
|
117506
|
-
* Parses
|
|
118318
|
+
* Parses file into an AST. Moved out here because the try-catch prevents
|
|
117507
118319
|
* optimization of functions, so it's best to keep the try-catch as isolated
|
|
117508
118320
|
* as possible
|
|
117509
|
-
* @param {
|
|
118321
|
+
* @param {VFile} file The file to parse.
|
|
118322
|
+
* @param {Language} language The language to use.
|
|
117510
118323
|
* @param {LanguageOptions} languageOptions Options to pass to the parser
|
|
117511
|
-
* @param {string} filePath The path to the file being parsed.
|
|
117512
118324
|
* @returns {{success: false, error: LintMessage}|{success: true, sourceCode: SourceCode}}
|
|
117513
118325
|
* An object containing the AST and parser services if parsing was successful, or the error if parsing failed
|
|
117514
118326
|
* @private
|
|
117515
118327
|
*/
|
|
117516
|
-
function parse(
|
|
117517
|
-
const textToParse = stripUnicodeBOM(text).replace(astUtils.shebangPattern, (match, captured) => `//${captured}`);
|
|
117518
|
-
const { ecmaVersion, sourceType, parser } = languageOptions;
|
|
117519
|
-
const parserOptions = Object.assign(
|
|
117520
|
-
{ ecmaVersion, sourceType },
|
|
117521
|
-
languageOptions.parserOptions,
|
|
117522
|
-
{
|
|
117523
|
-
loc: true,
|
|
117524
|
-
range: true,
|
|
117525
|
-
raw: true,
|
|
117526
|
-
tokens: true,
|
|
117527
|
-
comment: true,
|
|
117528
|
-
eslintVisitorKeys: true,
|
|
117529
|
-
eslintScopeManager: true,
|
|
117530
|
-
filePath
|
|
117531
|
-
}
|
|
117532
|
-
);
|
|
117533
|
-
|
|
117534
|
-
/*
|
|
117535
|
-
* Check for parsing errors first. If there's a parsing error, nothing
|
|
117536
|
-
* else can happen. However, a parsing error does not throw an error
|
|
117537
|
-
* from this method - it's just considered a fatal error message, a
|
|
117538
|
-
* problem that ESLint identified just like any other.
|
|
117539
|
-
*/
|
|
117540
|
-
try {
|
|
117541
|
-
debug("Parsing:", filePath);
|
|
117542
|
-
const parseResult = (typeof parser.parseForESLint === "function")
|
|
117543
|
-
? parser.parseForESLint(textToParse, parserOptions)
|
|
117544
|
-
: { ast: parser.parse(textToParse, parserOptions) };
|
|
118328
|
+
function parse(file, language, languageOptions) {
|
|
117545
118329
|
|
|
117546
|
-
|
|
117547
|
-
const ast = parseResult.ast;
|
|
117548
|
-
const parserServices = parseResult.services || {};
|
|
117549
|
-
const visitorKeys = parseResult.visitorKeys || evk.KEYS;
|
|
117550
|
-
|
|
117551
|
-
debug("Scope analysis:", filePath);
|
|
117552
|
-
const scopeManager = parseResult.scopeManager || analyzeScope(ast, languageOptions, visitorKeys);
|
|
117553
|
-
|
|
117554
|
-
debug("Scope analysis successful:", filePath);
|
|
118330
|
+
const result = language.parse(file, { languageOptions });
|
|
117555
118331
|
|
|
118332
|
+
if (result.ok) {
|
|
117556
118333
|
return {
|
|
117557
118334
|
success: true,
|
|
117558
|
-
|
|
117559
|
-
/*
|
|
117560
|
-
* Save all values that `parseForESLint()` returned.
|
|
117561
|
-
* If a `SourceCode` object is given as the first parameter instead of source code text,
|
|
117562
|
-
* linter skips the parsing process and reuses the source code object.
|
|
117563
|
-
* In that case, linter needs all the values that `parseForESLint()` returned.
|
|
117564
|
-
*/
|
|
117565
|
-
sourceCode: new SourceCode({
|
|
117566
|
-
text,
|
|
117567
|
-
ast,
|
|
117568
|
-
parserServices,
|
|
117569
|
-
scopeManager,
|
|
117570
|
-
visitorKeys
|
|
117571
|
-
})
|
|
117572
|
-
};
|
|
117573
|
-
} catch (ex) {
|
|
117574
|
-
|
|
117575
|
-
// If the message includes a leading line number, strip it:
|
|
117576
|
-
const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`;
|
|
117577
|
-
|
|
117578
|
-
debug("%s\n%s", message, ex.stack);
|
|
117579
|
-
|
|
117580
|
-
return {
|
|
117581
|
-
success: false,
|
|
117582
|
-
error: {
|
|
117583
|
-
ruleId: null,
|
|
117584
|
-
fatal: true,
|
|
117585
|
-
severity: 2,
|
|
117586
|
-
message,
|
|
117587
|
-
line: ex.lineNumber,
|
|
117588
|
-
column: ex.column,
|
|
117589
|
-
nodeType: null
|
|
117590
|
-
}
|
|
118335
|
+
sourceCode: language.createSourceCode(file, result, { languageOptions })
|
|
117591
118336
|
};
|
|
117592
118337
|
}
|
|
118338
|
+
|
|
118339
|
+
// if we made it to here there was an error
|
|
118340
|
+
return {
|
|
118341
|
+
success: false,
|
|
118342
|
+
errors: result.errors.map(error => ({
|
|
118343
|
+
ruleId: null,
|
|
118344
|
+
nodeType: null,
|
|
118345
|
+
fatal: true,
|
|
118346
|
+
severity: 2,
|
|
118347
|
+
message: error.message,
|
|
118348
|
+
line: error.line,
|
|
118349
|
+
column: error.column
|
|
118350
|
+
}))
|
|
118351
|
+
};
|
|
117593
118352
|
}
|
|
117594
118353
|
|
|
117595
118354
|
/**
|
|
@@ -117620,6 +118379,7 @@ function requireLinter () {
|
|
|
117620
118379
|
* @param {Object} configuredRules The rules configuration
|
|
117621
118380
|
* @param {function(string): Rule} ruleMapper A mapper function from rule names to rules
|
|
117622
118381
|
* @param {string | undefined} parserName The name of the parser in the config
|
|
118382
|
+
* @param {Language} language The language object used for parsing.
|
|
117623
118383
|
* @param {LanguageOptions} languageOptions The options for parsing the code.
|
|
117624
118384
|
* @param {Object} settings The settings that were enabled in the config
|
|
117625
118385
|
* @param {string} filename The reported filename of the code
|
|
@@ -117632,8 +118392,11 @@ function requireLinter () {
|
|
|
117632
118392
|
* @returns {LintMessage[]} An array of reported problems
|
|
117633
118393
|
* @throws {Error} If traversal into a node fails.
|
|
117634
118394
|
*/
|
|
117635
|
-
function runRules(
|
|
117636
|
-
|
|
118395
|
+
function runRules(
|
|
118396
|
+
sourceCode, configuredRules, ruleMapper, parserName, language, languageOptions,
|
|
118397
|
+
settings, filename, disableFixes, cwd, physicalFilename, ruleFilter,
|
|
118398
|
+
stats, slots
|
|
118399
|
+
) {
|
|
117637
118400
|
const emitter = createEmitter();
|
|
117638
118401
|
|
|
117639
118402
|
// must happen first to assign all node.parent properties
|
|
@@ -117680,7 +118443,7 @@ function requireLinter () {
|
|
|
117680
118443
|
const rule = ruleMapper(ruleId);
|
|
117681
118444
|
|
|
117682
118445
|
if (!rule) {
|
|
117683
|
-
lintingProblems.push(createLintingProblem({ ruleId }));
|
|
118446
|
+
lintingProblems.push(createLintingProblem({ ruleId, language }));
|
|
117684
118447
|
return;
|
|
117685
118448
|
}
|
|
117686
118449
|
|
|
@@ -117710,7 +118473,8 @@ function requireLinter () {
|
|
|
117710
118473
|
severity,
|
|
117711
118474
|
sourceCode,
|
|
117712
118475
|
messageIds,
|
|
117713
|
-
disableFixes
|
|
118476
|
+
disableFixes,
|
|
118477
|
+
language
|
|
117714
118478
|
});
|
|
117715
118479
|
}
|
|
117716
118480
|
const problem = reportTranslator(...args);
|
|
@@ -117781,7 +118545,12 @@ function requireLinter () {
|
|
|
117781
118545
|
});
|
|
117782
118546
|
});
|
|
117783
118547
|
|
|
117784
|
-
const eventGenerator = new NodeEventGenerator(emitter, {
|
|
118548
|
+
const eventGenerator = new NodeEventGenerator(emitter, {
|
|
118549
|
+
visitorKeys: sourceCode.visitorKeys ?? language.visitorKeys,
|
|
118550
|
+
fallback: Traverser.getKeys,
|
|
118551
|
+
matchClass: language.matchesSelectorClass ?? (() => false),
|
|
118552
|
+
nodeTypeKey: language.nodeTypeKey
|
|
118553
|
+
});
|
|
117785
118554
|
|
|
117786
118555
|
for (const step of eventQueue) {
|
|
117787
118556
|
switch (step.kind) {
|
|
@@ -117908,11 +118677,13 @@ function requireLinter () {
|
|
|
117908
118677
|
* Initialize the Linter.
|
|
117909
118678
|
* @param {Object} [config] the config object
|
|
117910
118679
|
* @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined.
|
|
118680
|
+
* @param {Array<string>} [config.flags] the feature flags to enable.
|
|
117911
118681
|
* @param {"flat"|"eslintrc"} [config.configType="flat"] the type of config used.
|
|
117912
118682
|
*/
|
|
117913
|
-
constructor({ cwd, configType = "flat" } = {}) {
|
|
118683
|
+
constructor({ cwd, configType = "flat", flags = [] } = {}) {
|
|
117914
118684
|
internalSlotsMap.set(this, {
|
|
117915
118685
|
cwd: normalizeCwd(cwd),
|
|
118686
|
+
flags: flags.filter(flag => activeFlags.has(flag)),
|
|
117916
118687
|
lastConfigArray: null,
|
|
117917
118688
|
lastSourceCode: null,
|
|
117918
118689
|
lastSuppressedMessages: [],
|
|
@@ -117933,6 +118704,15 @@ function requireLinter () {
|
|
|
117933
118704
|
return pkg.version;
|
|
117934
118705
|
}
|
|
117935
118706
|
|
|
118707
|
+
/**
|
|
118708
|
+
* Indicates if the given feature flag is enabled for this instance.
|
|
118709
|
+
* @param {string} flag The feature flag to check.
|
|
118710
|
+
* @returns {boolean} `true` if the feature flag is enabled, `false` if not.
|
|
118711
|
+
*/
|
|
118712
|
+
hasFlag(flag) {
|
|
118713
|
+
return internalSlotsMap.get(this).flags.includes(flag);
|
|
118714
|
+
}
|
|
118715
|
+
|
|
117936
118716
|
/**
|
|
117937
118717
|
* Same as linter.verify, except without support for processors.
|
|
117938
118718
|
* @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object.
|
|
@@ -117997,6 +118777,9 @@ function requireLinter () {
|
|
|
117997
118777
|
parser,
|
|
117998
118778
|
parserOptions
|
|
117999
118779
|
});
|
|
118780
|
+
const file = new VFile(options.filename, text, {
|
|
118781
|
+
physicalPath: providedOptions.physicalFilename
|
|
118782
|
+
});
|
|
118000
118783
|
|
|
118001
118784
|
if (!slots.lastSourceCode) {
|
|
118002
118785
|
let t;
|
|
@@ -118006,9 +118789,9 @@ function requireLinter () {
|
|
|
118006
118789
|
}
|
|
118007
118790
|
|
|
118008
118791
|
const parseResult = parse(
|
|
118009
|
-
|
|
118010
|
-
|
|
118011
|
-
|
|
118792
|
+
file,
|
|
118793
|
+
jslang,
|
|
118794
|
+
languageOptions
|
|
118012
118795
|
);
|
|
118013
118796
|
|
|
118014
118797
|
if (options.stats) {
|
|
@@ -118019,7 +118802,7 @@ function requireLinter () {
|
|
|
118019
118802
|
}
|
|
118020
118803
|
|
|
118021
118804
|
if (!parseResult.success) {
|
|
118022
|
-
return
|
|
118805
|
+
return parseResult.errors;
|
|
118023
118806
|
}
|
|
118024
118807
|
|
|
118025
118808
|
slots.lastSourceCode = parseResult.sourceCode;
|
|
@@ -118033,6 +118816,7 @@ function requireLinter () {
|
|
|
118033
118816
|
slots.lastSourceCode = new SourceCode({
|
|
118034
118817
|
text: slots.lastSourceCode.text,
|
|
118035
118818
|
ast: slots.lastSourceCode.ast,
|
|
118819
|
+
hasBOM: slots.lastSourceCode.hasBOM,
|
|
118036
118820
|
parserServices: slots.lastSourceCode.parserServices,
|
|
118037
118821
|
visitorKeys: slots.lastSourceCode.visitorKeys,
|
|
118038
118822
|
scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions)
|
|
@@ -118045,7 +118829,6 @@ function requireLinter () {
|
|
|
118045
118829
|
? getDirectiveComments(sourceCode, ruleId => getRule(slots, ruleId), options.warnInlineConfig, config)
|
|
118046
118830
|
: { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] };
|
|
118047
118831
|
|
|
118048
|
-
// augment global scope with declared global variables
|
|
118049
118832
|
addDeclaredGlobals(
|
|
118050
118833
|
sourceCode.scopeManager.scopes[0],
|
|
118051
118834
|
configuredGlobals,
|
|
@@ -118062,6 +118845,7 @@ function requireLinter () {
|
|
|
118062
118845
|
configuredRules,
|
|
118063
118846
|
ruleId => getRule(slots, ruleId),
|
|
118064
118847
|
parserName,
|
|
118848
|
+
jslang,
|
|
118065
118849
|
languageOptions,
|
|
118066
118850
|
settings,
|
|
118067
118851
|
options.filename,
|
|
@@ -118094,6 +118878,7 @@ function requireLinter () {
|
|
|
118094
118878
|
}
|
|
118095
118879
|
|
|
118096
118880
|
return applyDisableDirectives({
|
|
118881
|
+
language: jslang,
|
|
118097
118882
|
directives: commentDirectives.disableDirectives,
|
|
118098
118883
|
disableFixes: options.disableFixes,
|
|
118099
118884
|
problems: lintingProblems
|
|
@@ -118296,6 +119081,9 @@ function requireLinter () {
|
|
|
118296
119081
|
}
|
|
118297
119082
|
|
|
118298
119083
|
const settings = config.settings || {};
|
|
119084
|
+
const file = new VFile(options.filename, text, {
|
|
119085
|
+
physicalPath: providedOptions.physicalFilename
|
|
119086
|
+
});
|
|
118299
119087
|
|
|
118300
119088
|
if (!slots.lastSourceCode) {
|
|
118301
119089
|
let t;
|
|
@@ -118305,9 +119093,9 @@ function requireLinter () {
|
|
|
118305
119093
|
}
|
|
118306
119094
|
|
|
118307
119095
|
const parseResult = parse(
|
|
118308
|
-
|
|
118309
|
-
|
|
118310
|
-
|
|
119096
|
+
file,
|
|
119097
|
+
config.language,
|
|
119098
|
+
languageOptions
|
|
118311
119099
|
);
|
|
118312
119100
|
|
|
118313
119101
|
if (options.stats) {
|
|
@@ -118317,7 +119105,7 @@ function requireLinter () {
|
|
|
118317
119105
|
}
|
|
118318
119106
|
|
|
118319
119107
|
if (!parseResult.success) {
|
|
118320
|
-
return
|
|
119108
|
+
return parseResult.errors;
|
|
118321
119109
|
}
|
|
118322
119110
|
|
|
118323
119111
|
slots.lastSourceCode = parseResult.sourceCode;
|
|
@@ -118326,11 +119114,17 @@ function requireLinter () {
|
|
|
118326
119114
|
/*
|
|
118327
119115
|
* If the given source code object as the first argument does not have scopeManager, analyze the scope.
|
|
118328
119116
|
* This is for backward compatibility (SourceCode is frozen so it cannot rebind).
|
|
119117
|
+
*
|
|
119118
|
+
* We check explicitly for `null` to ensure that this is a JS-flavored language.
|
|
119119
|
+
* For non-JS languages we don't want to do this.
|
|
119120
|
+
*
|
|
119121
|
+
* TODO: Remove this check when we stop exporting the `SourceCode` object.
|
|
118329
119122
|
*/
|
|
118330
|
-
if (
|
|
119123
|
+
if (slots.lastSourceCode.scopeManager === null) {
|
|
118331
119124
|
slots.lastSourceCode = new SourceCode({
|
|
118332
119125
|
text: slots.lastSourceCode.text,
|
|
118333
119126
|
ast: slots.lastSourceCode.ast,
|
|
119127
|
+
hasBOM: slots.lastSourceCode.hasBOM,
|
|
118334
119128
|
parserServices: slots.lastSourceCode.parserServices,
|
|
118335
119129
|
visitorKeys: slots.lastSourceCode.visitorKeys,
|
|
118336
119130
|
scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions)
|
|
@@ -118345,7 +119139,7 @@ function requireLinter () {
|
|
|
118345
119139
|
* this is primarily about adding variables into the global scope
|
|
118346
119140
|
* to account for ecmaVersion and configured globals.
|
|
118347
119141
|
*/
|
|
118348
|
-
sourceCode.applyLanguageOptions(languageOptions);
|
|
119142
|
+
sourceCode.applyLanguageOptions?.(languageOptions);
|
|
118349
119143
|
|
|
118350
119144
|
const mergedInlineConfig = {
|
|
118351
119145
|
rules: {}
|
|
@@ -118362,140 +119156,151 @@ function requireLinter () {
|
|
|
118362
119156
|
|
|
118363
119157
|
// if inline config should warn then add the warnings
|
|
118364
119158
|
if (options.warnInlineConfig) {
|
|
118365
|
-
sourceCode.getInlineConfigNodes
|
|
118366
|
-
|
|
118367
|
-
|
|
118368
|
-
|
|
118369
|
-
|
|
118370
|
-
|
|
118371
|
-
|
|
119159
|
+
if (sourceCode.getInlineConfigNodes) {
|
|
119160
|
+
sourceCode.getInlineConfigNodes().forEach(node => {
|
|
119161
|
+
inlineConfigProblems.push(createLintingProblem({
|
|
119162
|
+
ruleId: null,
|
|
119163
|
+
message: `'${sourceCode.text.slice(node.range[0], node.range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`,
|
|
119164
|
+
loc: node.loc,
|
|
119165
|
+
severity: 1,
|
|
119166
|
+
language: config.language
|
|
119167
|
+
}));
|
|
118372
119168
|
|
|
118373
|
-
|
|
119169
|
+
});
|
|
119170
|
+
}
|
|
118374
119171
|
} else {
|
|
118375
|
-
const inlineConfigResult = sourceCode.applyInlineConfig();
|
|
118376
|
-
|
|
118377
|
-
|
|
118378
|
-
|
|
118379
|
-
.
|
|
118380
|
-
|
|
118381
|
-
problem
|
|
118382
|
-
|
|
118383
|
-
|
|
118384
|
-
|
|
119172
|
+
const inlineConfigResult = sourceCode.applyInlineConfig?.();
|
|
119173
|
+
|
|
119174
|
+
if (inlineConfigResult) {
|
|
119175
|
+
inlineConfigProblems.push(
|
|
119176
|
+
...inlineConfigResult.problems
|
|
119177
|
+
.map(problem => createLintingProblem({ ...problem, language: config.language }))
|
|
119178
|
+
.map(problem => {
|
|
119179
|
+
problem.fatal = true;
|
|
119180
|
+
return problem;
|
|
119181
|
+
})
|
|
119182
|
+
);
|
|
118385
119183
|
|
|
118386
|
-
|
|
118387
|
-
|
|
119184
|
+
// next we need to verify information about the specified rules
|
|
119185
|
+
const ruleValidator = new RuleValidator();
|
|
118388
119186
|
|
|
118389
|
-
|
|
119187
|
+
for (const { config: inlineConfig, loc } of inlineConfigResult.configs) {
|
|
118390
119188
|
|
|
118391
|
-
|
|
118392
|
-
|
|
118393
|
-
|
|
119189
|
+
Object.keys(inlineConfig.rules).forEach(ruleId => {
|
|
119190
|
+
const rule = getRuleFromConfig(ruleId, config);
|
|
119191
|
+
const ruleValue = inlineConfig.rules[ruleId];
|
|
118394
119192
|
|
|
118395
|
-
|
|
118396
|
-
|
|
118397
|
-
|
|
118398
|
-
|
|
119193
|
+
if (!rule) {
|
|
119194
|
+
inlineConfigProblems.push(createLintingProblem({
|
|
119195
|
+
ruleId,
|
|
119196
|
+
loc,
|
|
119197
|
+
language: config.language
|
|
119198
|
+
}));
|
|
119199
|
+
return;
|
|
119200
|
+
}
|
|
118399
119201
|
|
|
118400
|
-
|
|
118401
|
-
|
|
118402
|
-
|
|
118403
|
-
|
|
118404
|
-
|
|
118405
|
-
|
|
118406
|
-
|
|
119202
|
+
if (Object.hasOwn(mergedInlineConfig.rules, ruleId)) {
|
|
119203
|
+
inlineConfigProblems.push(createLintingProblem({
|
|
119204
|
+
message: `Rule "${ruleId}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`,
|
|
119205
|
+
loc,
|
|
119206
|
+
language: config.language
|
|
119207
|
+
}));
|
|
119208
|
+
return;
|
|
119209
|
+
}
|
|
118407
119210
|
|
|
118408
|
-
|
|
119211
|
+
try {
|
|
118409
119212
|
|
|
118410
|
-
|
|
119213
|
+
let ruleOptions = Array.isArray(ruleValue) ? ruleValue : [ruleValue];
|
|
118411
119214
|
|
|
118412
|
-
|
|
119215
|
+
assertIsRuleSeverity(ruleId, ruleOptions[0]);
|
|
118413
119216
|
|
|
118414
|
-
|
|
118415
|
-
|
|
118416
|
-
|
|
118417
|
-
|
|
118418
|
-
|
|
118419
|
-
|
|
118420
|
-
|
|
118421
|
-
|
|
118422
|
-
|
|
118423
|
-
|
|
118424
|
-
|
|
118425
|
-
|
|
118426
|
-
|
|
118427
|
-
|
|
118428
|
-
|
|
118429
|
-
|
|
118430
|
-
|
|
118431
|
-
|
|
119217
|
+
/*
|
|
119218
|
+
* If the rule was already configured, inline rule configuration that
|
|
119219
|
+
* only has severity should retain options from the config and just override the severity.
|
|
119220
|
+
*
|
|
119221
|
+
* Example:
|
|
119222
|
+
*
|
|
119223
|
+
* {
|
|
119224
|
+
* rules: {
|
|
119225
|
+
* curly: ["error", "multi"]
|
|
119226
|
+
* }
|
|
119227
|
+
* }
|
|
119228
|
+
*
|
|
119229
|
+
* /* eslint curly: ["warn"] * /
|
|
119230
|
+
*
|
|
119231
|
+
* Results in:
|
|
119232
|
+
*
|
|
119233
|
+
* curly: ["warn", "multi"]
|
|
119234
|
+
*/
|
|
118432
119235
|
|
|
118433
|
-
|
|
119236
|
+
let shouldValidateOptions = true;
|
|
118434
119237
|
|
|
118435
|
-
|
|
119238
|
+
if (
|
|
118436
119239
|
|
|
118437
|
-
|
|
118438
|
-
|
|
118439
|
-
|
|
118440
|
-
|
|
119240
|
+
/*
|
|
119241
|
+
* If inline config for the rule has only severity
|
|
119242
|
+
*/
|
|
119243
|
+
ruleOptions.length === 1 &&
|
|
118441
119244
|
|
|
118442
|
-
|
|
118443
|
-
|
|
118444
|
-
|
|
118445
|
-
|
|
118446
|
-
|
|
119245
|
+
/*
|
|
119246
|
+
* And the rule was already configured
|
|
119247
|
+
*/
|
|
119248
|
+
config.rules && Object.hasOwn(config.rules, ruleId)
|
|
119249
|
+
) {
|
|
118447
119250
|
|
|
118448
|
-
|
|
118449
|
-
|
|
118450
|
-
|
|
118451
|
-
|
|
118452
|
-
|
|
118453
|
-
|
|
118454
|
-
|
|
119251
|
+
/*
|
|
119252
|
+
* Then use severity from the inline config and options from the provided config
|
|
119253
|
+
*/
|
|
119254
|
+
ruleOptions = [
|
|
119255
|
+
ruleOptions[0], // severity from the inline config
|
|
119256
|
+
...config.rules[ruleId].slice(1) // options from the provided config
|
|
119257
|
+
];
|
|
119258
|
+
|
|
119259
|
+
// if the rule was enabled, the options have already been validated
|
|
119260
|
+
if (config.rules[ruleId][0] > 0) {
|
|
119261
|
+
shouldValidateOptions = false;
|
|
119262
|
+
}
|
|
119263
|
+
}
|
|
118455
119264
|
|
|
118456
|
-
|
|
118457
|
-
|
|
118458
|
-
|
|
119265
|
+
if (shouldValidateOptions) {
|
|
119266
|
+
ruleValidator.validate({
|
|
119267
|
+
plugins: config.plugins,
|
|
119268
|
+
rules: {
|
|
119269
|
+
[ruleId]: ruleOptions
|
|
119270
|
+
}
|
|
119271
|
+
});
|
|
118459
119272
|
}
|
|
118460
|
-
}
|
|
118461
119273
|
|
|
118462
|
-
|
|
118463
|
-
|
|
118464
|
-
plugins: config.plugins,
|
|
118465
|
-
rules: {
|
|
118466
|
-
[ruleId]: ruleOptions
|
|
118467
|
-
}
|
|
118468
|
-
});
|
|
118469
|
-
}
|
|
119274
|
+
mergedInlineConfig.rules[ruleId] = ruleOptions;
|
|
119275
|
+
} catch (err) {
|
|
118470
119276
|
|
|
118471
|
-
|
|
118472
|
-
|
|
119277
|
+
/*
|
|
119278
|
+
* If the rule has invalid `meta.schema`, throw the error because
|
|
119279
|
+
* this is not an invalid inline configuration but an invalid rule.
|
|
119280
|
+
*/
|
|
119281
|
+
if (err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA") {
|
|
119282
|
+
throw err;
|
|
119283
|
+
}
|
|
118473
119284
|
|
|
118474
|
-
|
|
118475
|
-
|
|
118476
|
-
|
|
118477
|
-
|
|
118478
|
-
|
|
118479
|
-
throw err;
|
|
118480
|
-
}
|
|
119285
|
+
let baseMessage = err.message.slice(
|
|
119286
|
+
err.message.startsWith("Key \"rules\":")
|
|
119287
|
+
? err.message.indexOf(":", 12) + 1
|
|
119288
|
+
: err.message.indexOf(":") + 1
|
|
119289
|
+
).trim();
|
|
118481
119290
|
|
|
118482
|
-
|
|
118483
|
-
|
|
118484
|
-
|
|
118485
|
-
: err.message.indexOf(":") + 1
|
|
118486
|
-
).trim();
|
|
119291
|
+
if (err.messageTemplate) {
|
|
119292
|
+
baseMessage += ` You passed "${ruleValue}".`;
|
|
119293
|
+
}
|
|
118487
119294
|
|
|
118488
|
-
|
|
118489
|
-
|
|
119295
|
+
inlineConfigProblems.push(createLintingProblem({
|
|
119296
|
+
ruleId,
|
|
119297
|
+
message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`,
|
|
119298
|
+
loc,
|
|
119299
|
+
language: config.language
|
|
119300
|
+
}));
|
|
118490
119301
|
}
|
|
118491
|
-
|
|
118492
|
-
|
|
118493
|
-
ruleId,
|
|
118494
|
-
message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`,
|
|
118495
|
-
loc: node.loc
|
|
118496
|
-
}));
|
|
118497
|
-
}
|
|
118498
|
-
});
|
|
119302
|
+
});
|
|
119303
|
+
}
|
|
118499
119304
|
}
|
|
118500
119305
|
}
|
|
118501
119306
|
}
|
|
@@ -118503,7 +119308,8 @@ function requireLinter () {
|
|
|
118503
119308
|
const commentDirectives = options.allowInlineConfig && !options.warnInlineConfig
|
|
118504
119309
|
? getDirectiveCommentsForFlatConfig(
|
|
118505
119310
|
sourceCode,
|
|
118506
|
-
ruleId => getRuleFromConfig(ruleId, config)
|
|
119311
|
+
ruleId => getRuleFromConfig(ruleId, config),
|
|
119312
|
+
config.language
|
|
118507
119313
|
)
|
|
118508
119314
|
: { problems: [], disableDirectives: [] };
|
|
118509
119315
|
|
|
@@ -118511,7 +119317,7 @@ function requireLinter () {
|
|
|
118511
119317
|
|
|
118512
119318
|
let lintingProblems;
|
|
118513
119319
|
|
|
118514
|
-
sourceCode.finalize();
|
|
119320
|
+
sourceCode.finalize?.();
|
|
118515
119321
|
|
|
118516
119322
|
try {
|
|
118517
119323
|
lintingProblems = runRules(
|
|
@@ -118519,6 +119325,7 @@ function requireLinter () {
|
|
|
118519
119325
|
configuredRules,
|
|
118520
119326
|
ruleId => getRuleFromConfig(ruleId, config),
|
|
118521
119327
|
void 0,
|
|
119328
|
+
config.language,
|
|
118522
119329
|
languageOptions,
|
|
118523
119330
|
settings,
|
|
118524
119331
|
options.filename,
|
|
@@ -118552,6 +119359,7 @@ function requireLinter () {
|
|
|
118552
119359
|
}
|
|
118553
119360
|
|
|
118554
119361
|
return applyDisableDirectives({
|
|
119362
|
+
language: config.language,
|
|
118555
119363
|
directives: commentDirectives.disableDirectives,
|
|
118556
119364
|
disableFixes: options.disableFixes,
|
|
118557
119365
|
problems: lintingProblems
|