eslint-linter-browserify 9.4.0 → 9.5.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 +953 -333
- package/linter.js +953 -333
- package/linter.min.js +2 -2
- package/linter.mjs +953 -333
- package/package.json +6 -6
package/linter.cjs
CHANGED
|
@@ -17382,7 +17382,7 @@ function requireLodash_merge () {
|
|
|
17382
17382
|
}
|
|
17383
17383
|
|
|
17384
17384
|
var name = "eslint";
|
|
17385
|
-
var version = "9.
|
|
17385
|
+
var version = "9.5.0";
|
|
17386
17386
|
var author = "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>";
|
|
17387
17387
|
var description$2 = "An AST-based pattern checker for JavaScript.";
|
|
17388
17388
|
var bin = {
|
|
@@ -17430,15 +17430,15 @@ var files = [
|
|
|
17430
17430
|
"messages"
|
|
17431
17431
|
];
|
|
17432
17432
|
var repository = "eslint/eslint";
|
|
17433
|
-
var funding = "https://
|
|
17433
|
+
var funding = "https://eslint.org/donate";
|
|
17434
17434
|
var homepage = "https://eslint.org";
|
|
17435
17435
|
var bugs = "https://github.com/eslint/eslint/issues/";
|
|
17436
17436
|
var dependencies$2 = {
|
|
17437
17437
|
"@eslint-community/eslint-utils": "^4.2.0",
|
|
17438
17438
|
"@eslint-community/regexpp": "^4.6.1",
|
|
17439
|
-
"@eslint/config-array": "^0.
|
|
17439
|
+
"@eslint/config-array": "^0.16.0",
|
|
17440
17440
|
"@eslint/eslintrc": "^3.1.0",
|
|
17441
|
-
"@eslint/js": "9.
|
|
17441
|
+
"@eslint/js": "9.5.0",
|
|
17442
17442
|
"@humanwhocodes/module-importer": "^1.0.1",
|
|
17443
17443
|
"@humanwhocodes/retry": "^0.3.0",
|
|
17444
17444
|
"@nodelib/fs.walk": "^1.2.8",
|
|
@@ -17450,7 +17450,7 @@ var dependencies$2 = {
|
|
|
17450
17450
|
"eslint-scope": "^8.0.1",
|
|
17451
17451
|
"eslint-visitor-keys": "^4.0.0",
|
|
17452
17452
|
espree: "^10.0.1",
|
|
17453
|
-
esquery: "^1.
|
|
17453
|
+
esquery: "^1.5.0",
|
|
17454
17454
|
esutils: "^2.0.2",
|
|
17455
17455
|
"fast-deep-equal": "^3.1.3",
|
|
17456
17456
|
"file-entry-cache": "^8.0.0",
|
|
@@ -17475,11 +17475,11 @@ var devDependencies = {
|
|
|
17475
17475
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
|
|
17476
17476
|
"@types/estree": "^1.0.5",
|
|
17477
17477
|
"@types/node": "^20.11.5",
|
|
17478
|
-
"@wdio/browser-runner": "^8.
|
|
17479
|
-
"@wdio/cli": "^8.
|
|
17480
|
-
"@wdio/concise-reporter": "^8.
|
|
17481
|
-
"@wdio/globals": "^8.
|
|
17482
|
-
"@wdio/mocha-framework": "^8.
|
|
17478
|
+
"@wdio/browser-runner": "^8.38.3",
|
|
17479
|
+
"@wdio/cli": "^8.38.2",
|
|
17480
|
+
"@wdio/concise-reporter": "^8.38.2",
|
|
17481
|
+
"@wdio/globals": "^8.38.2",
|
|
17482
|
+
"@wdio/mocha-framework": "^8.38.2",
|
|
17483
17483
|
"babel-loader": "^8.0.5",
|
|
17484
17484
|
c8: "^7.12.0",
|
|
17485
17485
|
chai: "^4.0.1",
|
|
@@ -17510,7 +17510,7 @@ var devDependencies = {
|
|
|
17510
17510
|
"markdown-it": "^12.2.0",
|
|
17511
17511
|
"markdown-it-container": "^3.0.0",
|
|
17512
17512
|
markdownlint: "^0.34.0",
|
|
17513
|
-
"markdownlint-cli": "^0.
|
|
17513
|
+
"markdownlint-cli": "^0.41.0",
|
|
17514
17514
|
marked: "^4.0.8",
|
|
17515
17515
|
metascraper: "^5.25.7",
|
|
17516
17516
|
"metascraper-description": "^5.25.7",
|
|
@@ -17583,44 +17583,6 @@ var require$$5 = {
|
|
|
17583
17583
|
engines: engines
|
|
17584
17584
|
};
|
|
17585
17585
|
|
|
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
17586
|
/**
|
|
17625
17587
|
* @fileoverview Common utils for directives.
|
|
17626
17588
|
*
|
|
@@ -33416,6 +33378,44 @@ function requireTokenStore () {
|
|
|
33416
33378
|
return tokenStore;
|
|
33417
33379
|
}
|
|
33418
33380
|
|
|
33381
|
+
/**
|
|
33382
|
+
* @fileoverview Common utils for AST.
|
|
33383
|
+
*
|
|
33384
|
+
* This file contains only shared items for core and rules.
|
|
33385
|
+
* If you make a utility for rules, please see `../rules/utils/ast-utils.js`.
|
|
33386
|
+
*
|
|
33387
|
+
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
33388
|
+
*/
|
|
33389
|
+
|
|
33390
|
+
var astUtils$1;
|
|
33391
|
+
var hasRequiredAstUtils$1;
|
|
33392
|
+
|
|
33393
|
+
function requireAstUtils$1 () {
|
|
33394
|
+
if (hasRequiredAstUtils$1) return astUtils$1;
|
|
33395
|
+
hasRequiredAstUtils$1 = 1;
|
|
33396
|
+
|
|
33397
|
+
const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/u;
|
|
33398
|
+
const lineBreakPattern = /\r\n|[\r\n\u2028\u2029]/u;
|
|
33399
|
+
const shebangPattern = /^#!([^\r\n]+)/u;
|
|
33400
|
+
|
|
33401
|
+
/**
|
|
33402
|
+
* Creates a version of the `lineBreakPattern` regex with the global flag.
|
|
33403
|
+
* Global regexes are mutable, so this needs to be a function instead of a constant.
|
|
33404
|
+
* @returns {RegExp} A global regular expression that matches line terminators
|
|
33405
|
+
*/
|
|
33406
|
+
function createGlobalLinebreakMatcher() {
|
|
33407
|
+
return new RegExp(lineBreakPattern.source, "gu");
|
|
33408
|
+
}
|
|
33409
|
+
|
|
33410
|
+
astUtils$1 = {
|
|
33411
|
+
breakableTypePattern,
|
|
33412
|
+
lineBreakPattern,
|
|
33413
|
+
createGlobalLinebreakMatcher,
|
|
33414
|
+
shebangPattern
|
|
33415
|
+
};
|
|
33416
|
+
return astUtils$1;
|
|
33417
|
+
}
|
|
33418
|
+
|
|
33419
33419
|
/**
|
|
33420
33420
|
* @fileoverview Globals for ecmaVersion/sourceType
|
|
33421
33421
|
* @author Nicholas C. Zakas
|
|
@@ -40558,11 +40558,9 @@ function requireSourceCode$1 () {
|
|
|
40558
40558
|
directivesPattern
|
|
40559
40559
|
} = requireDirectives(),
|
|
40560
40560
|
|
|
40561
|
-
/* eslint-disable n/no-restricted-require -- Should eventually be moved into SourceCode. */
|
|
40562
40561
|
CodePathAnalyzer = requireCodePathAnalyzer(),
|
|
40563
40562
|
createEmitter = requireSafeEmitter(),
|
|
40564
40563
|
ConfigCommentParser = requireConfigCommentParser(),
|
|
40565
|
-
/* eslint-enable n/no-restricted-require -- Should eventually be moved into SourceCode. */
|
|
40566
40564
|
|
|
40567
40565
|
eslintScope = requireEslintScope();
|
|
40568
40566
|
|
|
@@ -40981,24 +40979,28 @@ function requireSourceCode$1 () {
|
|
|
40981
40979
|
#steps;
|
|
40982
40980
|
|
|
40983
40981
|
/**
|
|
40982
|
+
* Creates a new instance.
|
|
40984
40983
|
* @param {string|Object} textOrConfig The source code text or config object.
|
|
40985
40984
|
* @param {string} textOrConfig.text The source code text.
|
|
40986
40985
|
* @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.
|
|
40986
|
+
* @param {boolean} textOrConfig.hasBOM Indicates if the text has a Unicode BOM.
|
|
40987
40987
|
* @param {Object|null} textOrConfig.parserServices The parser services.
|
|
40988
40988
|
* @param {ScopeManager|null} textOrConfig.scopeManager The scope of this source code.
|
|
40989
40989
|
* @param {Object|null} textOrConfig.visitorKeys The visitor keys to traverse AST.
|
|
40990
40990
|
* @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
40991
|
*/
|
|
40992
40992
|
constructor(textOrConfig, astIfNoConfig) {
|
|
40993
|
-
let text, ast, parserServices, scopeManager, visitorKeys;
|
|
40993
|
+
let text, hasBOM, ast, parserServices, scopeManager, visitorKeys;
|
|
40994
40994
|
|
|
40995
|
-
// Process overloading
|
|
40995
|
+
// Process overloading of arguments
|
|
40996
40996
|
if (typeof textOrConfig === "string") {
|
|
40997
40997
|
text = textOrConfig;
|
|
40998
40998
|
ast = astIfNoConfig;
|
|
40999
|
+
hasBOM = false;
|
|
40999
41000
|
} else if (typeof textOrConfig === "object" && textOrConfig !== null) {
|
|
41000
41001
|
text = textOrConfig.text;
|
|
41001
41002
|
ast = textOrConfig.ast;
|
|
41003
|
+
hasBOM = textOrConfig.hasBOM;
|
|
41002
41004
|
parserServices = textOrConfig.parserServices;
|
|
41003
41005
|
scopeManager = textOrConfig.scopeManager;
|
|
41004
41006
|
visitorKeys = textOrConfig.visitorKeys;
|
|
@@ -41016,18 +41018,39 @@ function requireSourceCode$1 () {
|
|
|
41016
41018
|
["configNodes", void 0]
|
|
41017
41019
|
]);
|
|
41018
41020
|
|
|
41021
|
+
/**
|
|
41022
|
+
* Indicates if the AST is ESTree compatible.
|
|
41023
|
+
* @type {boolean}
|
|
41024
|
+
*/
|
|
41025
|
+
this.isESTree = ast.type === "Program";
|
|
41026
|
+
|
|
41027
|
+
/*
|
|
41028
|
+
* Backwards compatibility for BOM handling.
|
|
41029
|
+
*
|
|
41030
|
+
* The `hasBOM` property has been available on the `SourceCode` object
|
|
41031
|
+
* for a long time and is used to indicate if the source contains a BOM.
|
|
41032
|
+
* The linter strips the BOM and just passes the `hasBOM` property to the
|
|
41033
|
+
* `SourceCode` constructor to make it easier for languages to not deal with
|
|
41034
|
+
* the BOM.
|
|
41035
|
+
*
|
|
41036
|
+
* However, the text passed in to the `SourceCode` constructor might still
|
|
41037
|
+
* have a BOM if the constructor is called outside of the linter, so we still
|
|
41038
|
+
* need to check for the BOM in the text.
|
|
41039
|
+
*/
|
|
41040
|
+
const textHasBOM = text.charCodeAt(0) === 0xFEFF;
|
|
41041
|
+
|
|
41019
41042
|
/**
|
|
41020
41043
|
* The flag to indicate that the source code has Unicode BOM.
|
|
41021
41044
|
* @type {boolean}
|
|
41022
41045
|
*/
|
|
41023
|
-
this.hasBOM =
|
|
41046
|
+
this.hasBOM = textHasBOM || !!hasBOM;
|
|
41024
41047
|
|
|
41025
41048
|
/**
|
|
41026
41049
|
* The original text source code.
|
|
41027
41050
|
* BOM was stripped from this text.
|
|
41028
41051
|
* @type {string}
|
|
41029
41052
|
*/
|
|
41030
|
-
this.text = (
|
|
41053
|
+
this.text = (textHasBOM ? text.slice(1) : text);
|
|
41031
41054
|
|
|
41032
41055
|
/**
|
|
41033
41056
|
* The parsed AST for the source code.
|
|
@@ -41704,12 +41727,11 @@ function requireSourceCode$1 () {
|
|
|
41704
41727
|
*/
|
|
41705
41728
|
finalize() {
|
|
41706
41729
|
|
|
41707
|
-
// Step 1: ensure that all of the necessary variables are up to date
|
|
41708
41730
|
const varsCache = this[caches].get("vars");
|
|
41709
|
-
const globalScope = this.scopeManager.scopes[0];
|
|
41710
41731
|
const configGlobals = varsCache.get("configGlobals");
|
|
41711
41732
|
const inlineGlobals = varsCache.get("inlineGlobals");
|
|
41712
41733
|
const exportedVariables = varsCache.get("exportedVariables");
|
|
41734
|
+
const globalScope = this.scopeManager.scopes[0];
|
|
41713
41735
|
|
|
41714
41736
|
addDeclaredGlobals(globalScope, configGlobals, inlineGlobals);
|
|
41715
41737
|
|
|
@@ -41767,9 +41789,7 @@ function requireSourceCode$1 () {
|
|
|
41767
41789
|
* Program node at the top level. This is not a perfect heuristic, but it
|
|
41768
41790
|
* is good enough for now.
|
|
41769
41791
|
*/
|
|
41770
|
-
|
|
41771
|
-
|
|
41772
|
-
if (isESTree) {
|
|
41792
|
+
if (this.isESTree) {
|
|
41773
41793
|
analyzer = new CodePathAnalyzer(analyzer);
|
|
41774
41794
|
|
|
41775
41795
|
CODE_PATH_EVENTS.forEach(eventName => {
|
|
@@ -42222,6 +42242,8 @@ function requireApplyDisableDirectives () {
|
|
|
42222
42242
|
|
|
42223
42243
|
const processed = processUnusedDirectives(unusedDisableDirectivesToReport)
|
|
42224
42244
|
.concat(processUnusedDirectives(unusedEnableDirectivesToReport));
|
|
42245
|
+
const columnOffset = options.language.columnStart === 1 ? 0 : 1;
|
|
42246
|
+
const lineOffset = options.language.lineStart === 1 ? 0 : 1;
|
|
42225
42247
|
|
|
42226
42248
|
const unusedDirectives = processed
|
|
42227
42249
|
.map(({ description, fix, unprocessedDirective }) => {
|
|
@@ -42241,8 +42263,8 @@ function requireApplyDisableDirectives () {
|
|
|
42241
42263
|
return {
|
|
42242
42264
|
ruleId: null,
|
|
42243
42265
|
message,
|
|
42244
|
-
line: type === "disable-next-line" ? parentDirective.node.loc.start.line : line,
|
|
42245
|
-
column: type === "disable-next-line" ? parentDirective.node.loc.start.column +
|
|
42266
|
+
line: type === "disable-next-line" ? parentDirective.node.loc.start.line + lineOffset : line,
|
|
42267
|
+
column: type === "disable-next-line" ? parentDirective.node.loc.start.column + columnOffset : column,
|
|
42246
42268
|
severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
|
|
42247
42269
|
nodeType: null,
|
|
42248
42270
|
...options.disableFixes ? {} : { fix }
|
|
@@ -42256,6 +42278,7 @@ function requireApplyDisableDirectives () {
|
|
|
42256
42278
|
* Given a list of directive comments (i.e. metadata about eslint-disable and eslint-enable comments) and a list
|
|
42257
42279
|
* of reported problems, adds the suppression information to the problems.
|
|
42258
42280
|
* @param {Object} options Information about directives and problems
|
|
42281
|
+
* @param {Language} options.language The language being linted.
|
|
42259
42282
|
* @param {{
|
|
42260
42283
|
* type: ("disable"|"enable"|"disable-line"|"disable-next-line"),
|
|
42261
42284
|
* ruleId: (string|null),
|
|
@@ -42274,7 +42297,7 @@ function requireApplyDisableDirectives () {
|
|
|
42274
42297
|
* @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]}
|
|
42275
42298
|
* An object with a list of reported problems, the suppressed of which contain the suppression information.
|
|
42276
42299
|
*/
|
|
42277
|
-
applyDisableDirectives = ({ directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
|
|
42300
|
+
applyDisableDirectives = ({ language, directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
|
|
42278
42301
|
const blockDirectives = directives
|
|
42279
42302
|
.filter(directive => directive.type === "disable" || directive.type === "enable")
|
|
42280
42303
|
.map(directive => Object.assign({}, directive, { unprocessedDirective: directive }))
|
|
@@ -42323,6 +42346,7 @@ function requireApplyDisableDirectives () {
|
|
|
42323
42346
|
}
|
|
42324
42347
|
|
|
42325
42348
|
const blockDirectivesResult = applyDirectives({
|
|
42349
|
+
language,
|
|
42326
42350
|
problems,
|
|
42327
42351
|
directives: blockDirectives,
|
|
42328
42352
|
disableFixes,
|
|
@@ -42330,6 +42354,7 @@ function requireApplyDisableDirectives () {
|
|
|
42330
42354
|
rulesToIgnore
|
|
42331
42355
|
});
|
|
42332
42356
|
const lineDirectivesResult = applyDirectives({
|
|
42357
|
+
language,
|
|
42333
42358
|
problems: blockDirectivesResult.problems,
|
|
42334
42359
|
directives: lineDirectives,
|
|
42335
42360
|
disableFixes,
|
|
@@ -42347,7 +42372,7 @@ function requireApplyDisableDirectives () {
|
|
|
42347
42372
|
return applyDisableDirectives;
|
|
42348
42373
|
}
|
|
42349
42374
|
|
|
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;
|
|
42375
|
+
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
42376
|
|
|
42352
42377
|
/**
|
|
42353
42378
|
* @fileoverview The event generator for AST nodes.
|
|
@@ -43165,15 +43190,22 @@ function requireReportTranslator () {
|
|
|
43165
43190
|
* @param {{start: SourceLocation, end: (SourceLocation|null)}} options.loc Start and end location
|
|
43166
43191
|
* @param {{text: string, range: (number[]|null)}} options.fix The fix object
|
|
43167
43192
|
* @param {Array<{text: string, range: (number[]|null)}>} options.suggestions The array of suggestions objects
|
|
43193
|
+
* @param {Language} [options.language] The language to use to adjust line and column offsets.
|
|
43168
43194
|
* @returns {LintMessage} Information about the report
|
|
43169
43195
|
*/
|
|
43170
43196
|
function createProblem(options) {
|
|
43197
|
+
const { language } = options;
|
|
43198
|
+
|
|
43199
|
+
// calculate offsets based on the language in use
|
|
43200
|
+
const columnOffset = language.columnStart === 1 ? 0 : 1;
|
|
43201
|
+
const lineOffset = language.lineStart === 1 ? 0 : 1;
|
|
43202
|
+
|
|
43171
43203
|
const problem = {
|
|
43172
43204
|
ruleId: options.ruleId,
|
|
43173
43205
|
severity: options.severity,
|
|
43174
43206
|
message: options.message,
|
|
43175
|
-
line: options.loc.start.line,
|
|
43176
|
-
column: options.loc.start.column +
|
|
43207
|
+
line: options.loc.start.line + lineOffset,
|
|
43208
|
+
column: options.loc.start.column + columnOffset,
|
|
43177
43209
|
nodeType: options.node && options.node.type || null
|
|
43178
43210
|
};
|
|
43179
43211
|
|
|
@@ -43186,8 +43218,8 @@ function requireReportTranslator () {
|
|
|
43186
43218
|
}
|
|
43187
43219
|
|
|
43188
43220
|
if (options.loc.end) {
|
|
43189
|
-
problem.endLine = options.loc.end.line;
|
|
43190
|
-
problem.endColumn = options.loc.end.column +
|
|
43221
|
+
problem.endLine = options.loc.end.line + lineOffset;
|
|
43222
|
+
problem.endColumn = options.loc.end.column + columnOffset;
|
|
43191
43223
|
}
|
|
43192
43224
|
|
|
43193
43225
|
if (options.fix) {
|
|
@@ -43238,8 +43270,7 @@ function requireReportTranslator () {
|
|
|
43238
43270
|
/**
|
|
43239
43271
|
* Returns a function that converts the arguments of a `context.report` call from a rule into a reported
|
|
43240
43272
|
* 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
|
|
43273
|
+
* @param {{ruleId: string, severity: number, sourceCode: SourceCode, messageIds: Object, disableFixes: boolean, language:Language}} metadata Metadata for the reported problem
|
|
43243
43274
|
* @returns {function(...args): LintMessage} Function that returns information about the report
|
|
43244
43275
|
*/
|
|
43245
43276
|
|
|
@@ -43288,7 +43319,8 @@ function requireReportTranslator () {
|
|
|
43288
43319
|
messageId: descriptor.messageId,
|
|
43289
43320
|
loc: normalizeReportLoc(descriptor),
|
|
43290
43321
|
fix: metadata.disableFixes ? null : normalizeFixes(descriptor, metadata.sourceCode),
|
|
43291
|
-
suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, metadata.sourceCode, messages)
|
|
43322
|
+
suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, metadata.sourceCode, messages),
|
|
43323
|
+
language: metadata.language
|
|
43292
43324
|
});
|
|
43293
43325
|
};
|
|
43294
43326
|
};
|
|
@@ -89011,6 +89043,8 @@ function requireNoSparseArrays () {
|
|
|
89011
89043
|
if (hasRequiredNoSparseArrays) return noSparseArrays;
|
|
89012
89044
|
hasRequiredNoSparseArrays = 1;
|
|
89013
89045
|
|
|
89046
|
+
const astUtils = requireAstUtils();
|
|
89047
|
+
|
|
89014
89048
|
//------------------------------------------------------------------------------
|
|
89015
89049
|
// Rule Definition
|
|
89016
89050
|
//------------------------------------------------------------------------------
|
|
@@ -89043,11 +89077,32 @@ function requireNoSparseArrays () {
|
|
|
89043
89077
|
return {
|
|
89044
89078
|
|
|
89045
89079
|
ArrayExpression(node) {
|
|
89080
|
+
if (!node.elements.includes(null)) {
|
|
89081
|
+
return;
|
|
89082
|
+
}
|
|
89046
89083
|
|
|
89047
|
-
const
|
|
89084
|
+
const { sourceCode } = context;
|
|
89085
|
+
let commaToken;
|
|
89048
89086
|
|
|
89049
|
-
|
|
89050
|
-
|
|
89087
|
+
for (const [index, element] of node.elements.entries()) {
|
|
89088
|
+
if (index === node.elements.length - 1 && element) {
|
|
89089
|
+
return;
|
|
89090
|
+
}
|
|
89091
|
+
|
|
89092
|
+
commaToken = sourceCode.getTokenAfter(
|
|
89093
|
+
element ?? commaToken ?? sourceCode.getFirstToken(node),
|
|
89094
|
+
astUtils.isCommaToken
|
|
89095
|
+
);
|
|
89096
|
+
|
|
89097
|
+
if (element) {
|
|
89098
|
+
continue;
|
|
89099
|
+
}
|
|
89100
|
+
|
|
89101
|
+
context.report({
|
|
89102
|
+
node,
|
|
89103
|
+
loc: commaToken.loc,
|
|
89104
|
+
messageId: "unexpectedSparseArray"
|
|
89105
|
+
});
|
|
89051
89106
|
}
|
|
89052
89107
|
}
|
|
89053
89108
|
|
|
@@ -111920,7 +111975,7 @@ var rules = {
|
|
|
111920
111975
|
"spaced-comment"
|
|
111921
111976
|
]
|
|
111922
111977
|
};
|
|
111923
|
-
var require$$
|
|
111978
|
+
var require$$18 = {
|
|
111924
111979
|
rules: rules
|
|
111925
111980
|
};
|
|
111926
111981
|
|
|
@@ -113327,10 +113382,9 @@ function requireCjs$1 () {
|
|
|
113327
113382
|
hasRequiredCjs$1 = 1;
|
|
113328
113383
|
|
|
113329
113384
|
/**
|
|
113330
|
-
* @
|
|
113385
|
+
* @fileoverview Merge Strategy
|
|
113331
113386
|
*/
|
|
113332
113387
|
|
|
113333
|
-
|
|
113334
113388
|
//-----------------------------------------------------------------------------
|
|
113335
113389
|
// Class
|
|
113336
113390
|
//-----------------------------------------------------------------------------
|
|
@@ -113377,10 +113431,9 @@ function requireCjs$1 () {
|
|
|
113377
113431
|
}
|
|
113378
113432
|
|
|
113379
113433
|
/**
|
|
113380
|
-
* @
|
|
113434
|
+
* @fileoverview Validation Strategy
|
|
113381
113435
|
*/
|
|
113382
113436
|
|
|
113383
|
-
|
|
113384
113437
|
//-----------------------------------------------------------------------------
|
|
113385
113438
|
// Class
|
|
113386
113439
|
//-----------------------------------------------------------------------------
|
|
@@ -113475,7 +113528,7 @@ function requireCjs$1 () {
|
|
|
113475
113528
|
}
|
|
113476
113529
|
|
|
113477
113530
|
/**
|
|
113478
|
-
* @
|
|
113531
|
+
* @fileoverview Object Schema
|
|
113479
113532
|
*/
|
|
113480
113533
|
|
|
113481
113534
|
|
|
@@ -113591,9 +113644,9 @@ function requireCjs$1 () {
|
|
|
113591
113644
|
super(`Key "${key}": ${source.message}`, { cause: source });
|
|
113592
113645
|
|
|
113593
113646
|
// copy over custom properties that aren't represented
|
|
113594
|
-
for (const
|
|
113595
|
-
if (!(
|
|
113596
|
-
this[
|
|
113647
|
+
for (const sourceKey of Object.keys(source)) {
|
|
113648
|
+
if (!(sourceKey in this)) {
|
|
113649
|
+
this[sourceKey] = source[sourceKey];
|
|
113597
113650
|
}
|
|
113598
113651
|
}
|
|
113599
113652
|
}
|
|
@@ -113700,7 +113753,9 @@ function requireCjs$1 () {
|
|
|
113700
113753
|
}
|
|
113701
113754
|
|
|
113702
113755
|
if (
|
|
113703
|
-
objects.some(
|
|
113756
|
+
objects.some(
|
|
113757
|
+
object => object === null || typeof object !== "object",
|
|
113758
|
+
)
|
|
113704
113759
|
) {
|
|
113705
113760
|
throw new TypeError("All arguments must be objects.");
|
|
113706
113761
|
}
|
|
@@ -114359,7 +114414,7 @@ function requireCjs () {
|
|
|
114359
114414
|
const relativeFilePath = path.relative(basePath, filePath);
|
|
114360
114415
|
|
|
114361
114416
|
// match both strings and functions
|
|
114362
|
-
|
|
114417
|
+
function match(pattern) {
|
|
114363
114418
|
if (isString(pattern)) {
|
|
114364
114419
|
return doMatch(relativeFilePath, pattern);
|
|
114365
114420
|
}
|
|
@@ -114369,7 +114424,7 @@ function requireCjs () {
|
|
|
114369
114424
|
}
|
|
114370
114425
|
|
|
114371
114426
|
throw new TypeError(`Unexpected matcher type ${pattern}.`);
|
|
114372
|
-
}
|
|
114427
|
+
}
|
|
114373
114428
|
|
|
114374
114429
|
// check for all matches to config.files
|
|
114375
114430
|
let filePathMatchesPattern = config.files.some(pattern => {
|
|
@@ -114690,6 +114745,8 @@ function requireCjs () {
|
|
|
114690
114745
|
return this;
|
|
114691
114746
|
}
|
|
114692
114747
|
|
|
114748
|
+
/* eslint-disable class-methods-use-this -- Desired as instance methods */
|
|
114749
|
+
|
|
114693
114750
|
/**
|
|
114694
114751
|
* Finalizes the state of a config before being cached and returned by
|
|
114695
114752
|
* `getConfig()`. Does nothing by default but is provided to be
|
|
@@ -114713,53 +114770,7 @@ function requireCjs () {
|
|
|
114713
114770
|
return config;
|
|
114714
114771
|
}
|
|
114715
114772
|
|
|
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
|
-
}
|
|
114773
|
+
/* eslint-enable class-methods-use-this -- Desired as instance methods */
|
|
114763
114774
|
|
|
114764
114775
|
/**
|
|
114765
114776
|
* 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 +114825,7 @@ function requireCjs () {
|
|
|
114814
114825
|
|
|
114815
114826
|
const matchingConfigIndices = [];
|
|
114816
114827
|
let matchFound = false;
|
|
114817
|
-
const universalPattern =
|
|
114828
|
+
const universalPattern = /^\*$|\/\*{1,2}$/u;
|
|
114818
114829
|
|
|
114819
114830
|
this.forEach((config, index) => {
|
|
114820
114831
|
if (!config.files) {
|
|
@@ -114839,8 +114850,8 @@ function requireCjs () {
|
|
|
114839
114850
|
}
|
|
114840
114851
|
|
|
114841
114852
|
/*
|
|
114842
|
-
* If a config has a files pattern ending in /** or /*,
|
|
114843
|
-
* filePath only matches those patterns, then the config is only
|
|
114853
|
+
* If a config has a files pattern * or patterns ending in /** or /*,
|
|
114854
|
+
* and the filePath only matches those patterns, then the config is only
|
|
114844
114855
|
* applied if there is another config where the filePath matches
|
|
114845
114856
|
* a file with a specific extensions such as *.js.
|
|
114846
114857
|
*/
|
|
@@ -114893,7 +114904,6 @@ function requireCjs () {
|
|
|
114893
114904
|
debug(`Matching config found for ${filePath}`);
|
|
114894
114905
|
matchingConfigIndices.push(index);
|
|
114895
114906
|
matchFound = true;
|
|
114896
|
-
return;
|
|
114897
114907
|
}
|
|
114898
114908
|
});
|
|
114899
114909
|
|
|
@@ -114919,6 +114929,7 @@ function requireCjs () {
|
|
|
114919
114929
|
|
|
114920
114930
|
// otherwise construct the config
|
|
114921
114931
|
|
|
114932
|
+
// eslint-disable-next-line array-callback-return, consistent-return -- rethrowConfigError always throws an error
|
|
114922
114933
|
let finalConfig = matchingConfigIndices.reduce((result, index) => {
|
|
114923
114934
|
try {
|
|
114924
114935
|
return this[ConfigArraySymbol.schema].merge(
|
|
@@ -114999,7 +115010,7 @@ function requireCjs () {
|
|
|
114999
115010
|
|
|
115000
115011
|
const relativeDirectoryPath = path
|
|
115001
115012
|
.relative(this.basePath, directoryPath)
|
|
115002
|
-
.replace(/\\/
|
|
115013
|
+
.replace(/\\/gu, "/");
|
|
115003
115014
|
|
|
115004
115015
|
if (relativeDirectoryPath.startsWith("..")) {
|
|
115005
115016
|
return true;
|
|
@@ -115014,7 +115025,7 @@ function requireCjs () {
|
|
|
115014
115025
|
|
|
115015
115026
|
const directoryParts = relativeDirectoryPath.split("/");
|
|
115016
115027
|
let relativeDirectoryToCheck = "";
|
|
115017
|
-
let result
|
|
115028
|
+
let result;
|
|
115018
115029
|
|
|
115019
115030
|
/*
|
|
115020
115031
|
* In order to get the correct gitignore-style ignores, where an
|
|
@@ -115026,7 +115037,7 @@ function requireCjs () {
|
|
|
115026
115037
|
* have to recalculate everything for every call.
|
|
115027
115038
|
*/
|
|
115028
115039
|
do {
|
|
115029
|
-
relativeDirectoryToCheck += directoryParts.shift()
|
|
115040
|
+
relativeDirectoryToCheck += `${directoryParts.shift()}/`;
|
|
115030
115041
|
|
|
115031
115042
|
result = shouldIgnorePath(
|
|
115032
115043
|
this.ignores,
|
|
@@ -115146,12 +115157,6 @@ function requireFlatConfigSchema () {
|
|
|
115146
115157
|
[2, 2], ["error", 2]
|
|
115147
115158
|
]);
|
|
115148
115159
|
|
|
115149
|
-
const globalVariablesValues = new Set([
|
|
115150
|
-
true, "true", "writable", "writeable",
|
|
115151
|
-
false, "false", "readonly", "readable", null,
|
|
115152
|
-
"off"
|
|
115153
|
-
]);
|
|
115154
|
-
|
|
115155
115160
|
/**
|
|
115156
115161
|
* Check if a value is a non-null object.
|
|
115157
115162
|
* @param {any} value The value to check.
|
|
@@ -115256,6 +115261,23 @@ function requireFlatConfigSchema () {
|
|
|
115256
115261
|
return structuredClone(finalOptions);
|
|
115257
115262
|
}
|
|
115258
115263
|
|
|
115264
|
+
/**
|
|
115265
|
+
* Determines if an object has any methods.
|
|
115266
|
+
* @param {Object} object The object to check.
|
|
115267
|
+
* @returns {boolean} `true` if the object has any methods.
|
|
115268
|
+
*/
|
|
115269
|
+
function hasMethod(object) {
|
|
115270
|
+
|
|
115271
|
+
for (const key of Object.keys(object)) {
|
|
115272
|
+
|
|
115273
|
+
if (typeof object[key] === "function") {
|
|
115274
|
+
return true;
|
|
115275
|
+
}
|
|
115276
|
+
}
|
|
115277
|
+
|
|
115278
|
+
return false;
|
|
115279
|
+
}
|
|
115280
|
+
|
|
115259
115281
|
//-----------------------------------------------------------------------------
|
|
115260
115282
|
// Assertions
|
|
115261
115283
|
//-----------------------------------------------------------------------------
|
|
@@ -115414,47 +115436,48 @@ function requireFlatConfigSchema () {
|
|
|
115414
115436
|
validate: "object"
|
|
115415
115437
|
};
|
|
115416
115438
|
|
|
115439
|
+
|
|
115417
115440
|
//-----------------------------------------------------------------------------
|
|
115418
115441
|
// High-Level Schemas
|
|
115419
115442
|
//-----------------------------------------------------------------------------
|
|
115420
115443
|
|
|
115421
115444
|
/** @type {ObjectPropertySchema} */
|
|
115422
|
-
const
|
|
115423
|
-
merge
|
|
115424
|
-
validate(value) {
|
|
115445
|
+
const languageOptionsSchema = {
|
|
115446
|
+
merge(first = {}, second = {}) {
|
|
115425
115447
|
|
|
115426
|
-
|
|
115448
|
+
const result = deepMerge(first, second);
|
|
115427
115449
|
|
|
115428
|
-
for (const key of Object.
|
|
115450
|
+
for (const [key, value] of Object.entries(result)) {
|
|
115429
115451
|
|
|
115430
|
-
|
|
115431
|
-
|
|
115432
|
-
|
|
115433
|
-
|
|
115452
|
+
/*
|
|
115453
|
+
* Special case: Because the `parser` property is an object, it should
|
|
115454
|
+
* not be deep merged. Instead, it should be replaced if it exists in
|
|
115455
|
+
* the second object. To make this more generic, we just check for
|
|
115456
|
+
* objects with methods and replace them if they exist in the second
|
|
115457
|
+
* object.
|
|
115458
|
+
*/
|
|
115459
|
+
if (isNonArrayObject(value)) {
|
|
115460
|
+
if (hasMethod(value)) {
|
|
115461
|
+
result[key] = second[key] ?? first[key];
|
|
115462
|
+
continue;
|
|
115463
|
+
}
|
|
115434
115464
|
|
|
115435
|
-
|
|
115436
|
-
|
|
115465
|
+
// for other objects, make sure we aren't reusing the same object
|
|
115466
|
+
result[key] = { ...result[key] };
|
|
115467
|
+
continue;
|
|
115437
115468
|
}
|
|
115438
115469
|
|
|
115439
|
-
if (!globalVariablesValues.has(value[key])) {
|
|
115440
|
-
throw new TypeError(`Key "${key}": Expected "readonly", "writable", or "off".`);
|
|
115441
|
-
}
|
|
115442
115470
|
}
|
|
115443
|
-
|
|
115471
|
+
|
|
115472
|
+
return result;
|
|
115473
|
+
},
|
|
115474
|
+
validate: "object"
|
|
115444
115475
|
};
|
|
115445
115476
|
|
|
115446
115477
|
/** @type {ObjectPropertySchema} */
|
|
115447
|
-
const
|
|
115478
|
+
const languageSchema = {
|
|
115448
115479
|
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
|
-
}
|
|
115480
|
+
validate: assertIsPluginMemberName
|
|
115458
115481
|
};
|
|
115459
115482
|
|
|
115460
115483
|
/** @type {ObjectPropertySchema} */
|
|
@@ -115614,28 +115637,6 @@ function requireFlatConfigSchema () {
|
|
|
115614
115637
|
}
|
|
115615
115638
|
};
|
|
115616
115639
|
|
|
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
115640
|
/**
|
|
115640
115641
|
* Creates a schema that always throws an error. Useful for warning
|
|
115641
115642
|
* about eslintrc-style keys.
|
|
@@ -115681,15 +115682,8 @@ function requireFlatConfigSchema () {
|
|
|
115681
115682
|
reportUnusedDisableDirectives: disableDirectiveSeveritySchema
|
|
115682
115683
|
}
|
|
115683
115684
|
},
|
|
115684
|
-
|
|
115685
|
-
|
|
115686
|
-
ecmaVersion: ecmaVersionSchema,
|
|
115687
|
-
sourceType: sourceTypeSchema,
|
|
115688
|
-
globals: globalsSchema,
|
|
115689
|
-
parser: parserSchema,
|
|
115690
|
-
parserOptions: deepObjectAssignSchema
|
|
115691
|
-
}
|
|
115692
|
-
},
|
|
115685
|
+
language: languageSchema,
|
|
115686
|
+
languageOptions: languageOptionsSchema,
|
|
115693
115687
|
processor: processorSchema,
|
|
115694
115688
|
plugins: pluginsSchema,
|
|
115695
115689
|
rules: rulesSchema
|
|
@@ -115701,6 +115695,7 @@ function requireFlatConfigSchema () {
|
|
|
115701
115695
|
|
|
115702
115696
|
flatConfigSchema_1 = {
|
|
115703
115697
|
flatConfigSchema,
|
|
115698
|
+
hasMethod,
|
|
115704
115699
|
assertIsRuleSeverity
|
|
115705
115700
|
};
|
|
115706
115701
|
return flatConfigSchema_1;
|
|
@@ -116011,7 +116006,7 @@ function requireRuleValidator () {
|
|
|
116011
116006
|
getRuleFromConfig,
|
|
116012
116007
|
getRuleOptionsSchema
|
|
116013
116008
|
} = requireFlatConfigHelpers();
|
|
116014
|
-
const ruleReplacements = require$$
|
|
116009
|
+
const ruleReplacements = require$$18;
|
|
116015
116010
|
|
|
116016
116011
|
//-----------------------------------------------------------------------------
|
|
116017
116012
|
// Helpers
|
|
@@ -116192,6 +116187,450 @@ function requireRuleValidator () {
|
|
|
116192
116187
|
|
|
116193
116188
|
var defaultConfig = {};
|
|
116194
116189
|
|
|
116190
|
+
/**
|
|
116191
|
+
* @fileoverview The schema to validate language options
|
|
116192
|
+
* @author Nicholas C. Zakas
|
|
116193
|
+
*/
|
|
116194
|
+
|
|
116195
|
+
var validateLanguageOptions_1;
|
|
116196
|
+
var hasRequiredValidateLanguageOptions;
|
|
116197
|
+
|
|
116198
|
+
function requireValidateLanguageOptions () {
|
|
116199
|
+
if (hasRequiredValidateLanguageOptions) return validateLanguageOptions_1;
|
|
116200
|
+
hasRequiredValidateLanguageOptions = 1;
|
|
116201
|
+
|
|
116202
|
+
//-----------------------------------------------------------------------------
|
|
116203
|
+
// Data
|
|
116204
|
+
//-----------------------------------------------------------------------------
|
|
116205
|
+
|
|
116206
|
+
const globalVariablesValues = new Set([
|
|
116207
|
+
true, "true", "writable", "writeable",
|
|
116208
|
+
false, "false", "readonly", "readable", null,
|
|
116209
|
+
"off"
|
|
116210
|
+
]);
|
|
116211
|
+
|
|
116212
|
+
//------------------------------------------------------------------------------
|
|
116213
|
+
// Helpers
|
|
116214
|
+
//------------------------------------------------------------------------------
|
|
116215
|
+
|
|
116216
|
+
/**
|
|
116217
|
+
* Check if a value is a non-null object.
|
|
116218
|
+
* @param {any} value The value to check.
|
|
116219
|
+
* @returns {boolean} `true` if the value is a non-null object.
|
|
116220
|
+
*/
|
|
116221
|
+
function isNonNullObject(value) {
|
|
116222
|
+
return typeof value === "object" && value !== null;
|
|
116223
|
+
}
|
|
116224
|
+
|
|
116225
|
+
/**
|
|
116226
|
+
* Check if a value is a non-null non-array object.
|
|
116227
|
+
* @param {any} value The value to check.
|
|
116228
|
+
* @returns {boolean} `true` if the value is a non-null non-array object.
|
|
116229
|
+
*/
|
|
116230
|
+
function isNonArrayObject(value) {
|
|
116231
|
+
return isNonNullObject(value) && !Array.isArray(value);
|
|
116232
|
+
}
|
|
116233
|
+
|
|
116234
|
+
/**
|
|
116235
|
+
* Check if a value is undefined.
|
|
116236
|
+
* @param {any} value The value to check.
|
|
116237
|
+
* @returns {boolean} `true` if the value is undefined.
|
|
116238
|
+
*/
|
|
116239
|
+
function isUndefined(value) {
|
|
116240
|
+
return typeof value === "undefined";
|
|
116241
|
+
}
|
|
116242
|
+
|
|
116243
|
+
//-----------------------------------------------------------------------------
|
|
116244
|
+
// Schemas
|
|
116245
|
+
//-----------------------------------------------------------------------------
|
|
116246
|
+
|
|
116247
|
+
/**
|
|
116248
|
+
* Validates the ecmaVersion property.
|
|
116249
|
+
* @param {string|number} ecmaVersion The value to check.
|
|
116250
|
+
* @returns {void}
|
|
116251
|
+
* @throws {TypeError} If the value is invalid.
|
|
116252
|
+
*/
|
|
116253
|
+
function validateEcmaVersion(ecmaVersion) {
|
|
116254
|
+
|
|
116255
|
+
if (isUndefined(ecmaVersion)) {
|
|
116256
|
+
throw new TypeError("Key \"ecmaVersion\": Expected an \"ecmaVersion\" property.");
|
|
116257
|
+
}
|
|
116258
|
+
|
|
116259
|
+
if (typeof ecmaVersion !== "number" && ecmaVersion !== "latest") {
|
|
116260
|
+
throw new TypeError("Key \"ecmaVersion\": Expected a number or \"latest\".");
|
|
116261
|
+
}
|
|
116262
|
+
|
|
116263
|
+
}
|
|
116264
|
+
|
|
116265
|
+
/**
|
|
116266
|
+
* Validates the sourceType property.
|
|
116267
|
+
* @param {string} sourceType The value to check.
|
|
116268
|
+
* @returns {void}
|
|
116269
|
+
* @throws {TypeError} If the value is invalid.
|
|
116270
|
+
*/
|
|
116271
|
+
function validateSourceType(sourceType) {
|
|
116272
|
+
|
|
116273
|
+
if (typeof sourceType !== "string" || !/^(?:script|module|commonjs)$/u.test(sourceType)) {
|
|
116274
|
+
throw new TypeError("Key \"sourceType\": Expected \"script\", \"module\", or \"commonjs\".");
|
|
116275
|
+
}
|
|
116276
|
+
|
|
116277
|
+
}
|
|
116278
|
+
|
|
116279
|
+
/**
|
|
116280
|
+
* Validates the globals property.
|
|
116281
|
+
* @param {Object} globals The value to check.
|
|
116282
|
+
* @returns {void}
|
|
116283
|
+
* @throws {TypeError} If the value is invalid.
|
|
116284
|
+
*/
|
|
116285
|
+
function validateGlobals(globals) {
|
|
116286
|
+
|
|
116287
|
+
if (!isNonArrayObject(globals)) {
|
|
116288
|
+
throw new TypeError("Key \"globals\": Expected an object.");
|
|
116289
|
+
}
|
|
116290
|
+
|
|
116291
|
+
for (const key of Object.keys(globals)) {
|
|
116292
|
+
|
|
116293
|
+
// avoid hairy edge case
|
|
116294
|
+
if (key === "__proto__") {
|
|
116295
|
+
continue;
|
|
116296
|
+
}
|
|
116297
|
+
|
|
116298
|
+
if (key !== key.trim()) {
|
|
116299
|
+
throw new TypeError(`Key "globals": Global "${key}" has leading or trailing whitespace.`);
|
|
116300
|
+
}
|
|
116301
|
+
|
|
116302
|
+
if (!globalVariablesValues.has(globals[key])) {
|
|
116303
|
+
throw new TypeError(`Key "globals": Key "${key}": Expected "readonly", "writable", or "off".`);
|
|
116304
|
+
}
|
|
116305
|
+
}
|
|
116306
|
+
}
|
|
116307
|
+
|
|
116308
|
+
/**
|
|
116309
|
+
* Validates the parser property.
|
|
116310
|
+
* @param {Object} parser The value to check.
|
|
116311
|
+
* @returns {void}
|
|
116312
|
+
* @throws {TypeError} If the value is invalid.
|
|
116313
|
+
*/
|
|
116314
|
+
function validateParser(parser) {
|
|
116315
|
+
|
|
116316
|
+
if (!parser || typeof parser !== "object" ||
|
|
116317
|
+
(typeof parser.parse !== "function" && typeof parser.parseForESLint !== "function")
|
|
116318
|
+
) {
|
|
116319
|
+
throw new TypeError("Key \"parser\": Expected object with parse() or parseForESLint() method.");
|
|
116320
|
+
}
|
|
116321
|
+
|
|
116322
|
+
}
|
|
116323
|
+
|
|
116324
|
+
/**
|
|
116325
|
+
* Validates the language options.
|
|
116326
|
+
* @param {Object} languageOptions The language options to validate.
|
|
116327
|
+
* @returns {void}
|
|
116328
|
+
* @throws {TypeError} If the language options are invalid.
|
|
116329
|
+
*/
|
|
116330
|
+
function validateLanguageOptions(languageOptions) {
|
|
116331
|
+
|
|
116332
|
+
if (!isNonArrayObject(languageOptions)) {
|
|
116333
|
+
throw new TypeError("Expected an object.");
|
|
116334
|
+
}
|
|
116335
|
+
|
|
116336
|
+
const {
|
|
116337
|
+
ecmaVersion,
|
|
116338
|
+
sourceType,
|
|
116339
|
+
globals,
|
|
116340
|
+
parser,
|
|
116341
|
+
parserOptions,
|
|
116342
|
+
...otherOptions
|
|
116343
|
+
} = languageOptions;
|
|
116344
|
+
|
|
116345
|
+
if ("ecmaVersion" in languageOptions) {
|
|
116346
|
+
validateEcmaVersion(ecmaVersion);
|
|
116347
|
+
}
|
|
116348
|
+
|
|
116349
|
+
if ("sourceType" in languageOptions) {
|
|
116350
|
+
validateSourceType(sourceType);
|
|
116351
|
+
}
|
|
116352
|
+
|
|
116353
|
+
if ("globals" in languageOptions) {
|
|
116354
|
+
validateGlobals(globals);
|
|
116355
|
+
}
|
|
116356
|
+
|
|
116357
|
+
if ("parser" in languageOptions) {
|
|
116358
|
+
validateParser(parser);
|
|
116359
|
+
}
|
|
116360
|
+
|
|
116361
|
+
if ("parserOptions" in languageOptions) {
|
|
116362
|
+
if (!isNonArrayObject(parserOptions)) {
|
|
116363
|
+
throw new TypeError("Key \"parserOptions\": Expected an object.");
|
|
116364
|
+
}
|
|
116365
|
+
}
|
|
116366
|
+
|
|
116367
|
+
const otherOptionKeys = Object.keys(otherOptions);
|
|
116368
|
+
|
|
116369
|
+
if (otherOptionKeys.length > 0) {
|
|
116370
|
+
throw new TypeError(`Unexpected key "${otherOptionKeys[0]}" found.`);
|
|
116371
|
+
}
|
|
116372
|
+
|
|
116373
|
+
}
|
|
116374
|
+
|
|
116375
|
+
validateLanguageOptions_1 = { validateLanguageOptions };
|
|
116376
|
+
return validateLanguageOptions_1;
|
|
116377
|
+
}
|
|
116378
|
+
|
|
116379
|
+
/**
|
|
116380
|
+
* @fileoverview JavaScript Language Object
|
|
116381
|
+
* @author Nicholas C. Zakas
|
|
116382
|
+
*/
|
|
116383
|
+
|
|
116384
|
+
var js;
|
|
116385
|
+
var hasRequiredJs;
|
|
116386
|
+
|
|
116387
|
+
function requireJs () {
|
|
116388
|
+
if (hasRequiredJs) return js;
|
|
116389
|
+
hasRequiredJs = 1;
|
|
116390
|
+
|
|
116391
|
+
//-----------------------------------------------------------------------------
|
|
116392
|
+
// Requirements
|
|
116393
|
+
//-----------------------------------------------------------------------------
|
|
116394
|
+
|
|
116395
|
+
const { SourceCode } = requireSourceCode();
|
|
116396
|
+
const createDebug = requireSrc();
|
|
116397
|
+
const astUtils = requireAstUtils$1();
|
|
116398
|
+
const eslintScope = requireEslintScope();
|
|
116399
|
+
const evk = requireEslintVisitorKeys$2();
|
|
116400
|
+
const { validateLanguageOptions } = requireValidateLanguageOptions();
|
|
116401
|
+
|
|
116402
|
+
//-----------------------------------------------------------------------------
|
|
116403
|
+
// Type Definitions
|
|
116404
|
+
//-----------------------------------------------------------------------------
|
|
116405
|
+
|
|
116406
|
+
/** @typedef {import("../../linter/vfile").VFile} VFile */
|
|
116407
|
+
|
|
116408
|
+
//-----------------------------------------------------------------------------
|
|
116409
|
+
// Helpers
|
|
116410
|
+
//-----------------------------------------------------------------------------
|
|
116411
|
+
|
|
116412
|
+
const debug = createDebug("eslint:languages:js");
|
|
116413
|
+
const DEFAULT_ECMA_VERSION = 5;
|
|
116414
|
+
|
|
116415
|
+
/**
|
|
116416
|
+
* Analyze scope of the given AST.
|
|
116417
|
+
* @param {ASTNode} ast The `Program` node to analyze.
|
|
116418
|
+
* @param {LanguageOptions} languageOptions The parser options.
|
|
116419
|
+
* @param {Record<string, string[]>} visitorKeys The visitor keys.
|
|
116420
|
+
* @returns {ScopeManager} The analysis result.
|
|
116421
|
+
*/
|
|
116422
|
+
function analyzeScope(ast, languageOptions, visitorKeys) {
|
|
116423
|
+
const parserOptions = languageOptions.parserOptions;
|
|
116424
|
+
const ecmaFeatures = parserOptions.ecmaFeatures || {};
|
|
116425
|
+
const ecmaVersion = languageOptions.ecmaVersion || DEFAULT_ECMA_VERSION;
|
|
116426
|
+
|
|
116427
|
+
return eslintScope.analyze(ast, {
|
|
116428
|
+
ignoreEval: true,
|
|
116429
|
+
nodejsScope: ecmaFeatures.globalReturn,
|
|
116430
|
+
impliedStrict: ecmaFeatures.impliedStrict,
|
|
116431
|
+
ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6,
|
|
116432
|
+
sourceType: languageOptions.sourceType || "script",
|
|
116433
|
+
childVisitorKeys: visitorKeys || evk.KEYS,
|
|
116434
|
+
fallback: evk.getKeys
|
|
116435
|
+
});
|
|
116436
|
+
}
|
|
116437
|
+
|
|
116438
|
+
//-----------------------------------------------------------------------------
|
|
116439
|
+
// Exports
|
|
116440
|
+
//-----------------------------------------------------------------------------
|
|
116441
|
+
|
|
116442
|
+
js = {
|
|
116443
|
+
|
|
116444
|
+
fileType: "text",
|
|
116445
|
+
lineStart: 1,
|
|
116446
|
+
columnStart: 0,
|
|
116447
|
+
nodeTypeKey: "type",
|
|
116448
|
+
visitorKeys: evk.KEYS,
|
|
116449
|
+
|
|
116450
|
+
validateLanguageOptions,
|
|
116451
|
+
|
|
116452
|
+
/**
|
|
116453
|
+
* Determines if a given node matches a given selector class.
|
|
116454
|
+
* @param {string} className The class name to check.
|
|
116455
|
+
* @param {ASTNode} node The node to check.
|
|
116456
|
+
* @param {Array<ASTNode>} ancestry The ancestry of the node.
|
|
116457
|
+
* @returns {boolean} True if there's a match, false if not.
|
|
116458
|
+
* @throws {Error} When an unknown class name is passed.
|
|
116459
|
+
*/
|
|
116460
|
+
matchesSelectorClass(className, node, ancestry) {
|
|
116461
|
+
|
|
116462
|
+
/*
|
|
116463
|
+
* Copyright (c) 2013, Joel Feenstra
|
|
116464
|
+
* All rights reserved.
|
|
116465
|
+
*
|
|
116466
|
+
* Redistribution and use in source and binary forms, with or without
|
|
116467
|
+
* modification, are permitted provided that the following conditions are met:
|
|
116468
|
+
* * Redistributions of source code must retain the above copyright
|
|
116469
|
+
* notice, this list of conditions and the following disclaimer.
|
|
116470
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
116471
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
116472
|
+
* documentation and/or other materials provided with the distribution.
|
|
116473
|
+
* * Neither the name of the ESQuery nor the names of its contributors may
|
|
116474
|
+
* be used to endorse or promote products derived from this software without
|
|
116475
|
+
* specific prior written permission.
|
|
116476
|
+
*
|
|
116477
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
116478
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
116479
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
116480
|
+
* DISCLAIMED. IN NO EVENT SHALL JOEL FEENSTRA BE LIABLE FOR ANY
|
|
116481
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
116482
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
116483
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
116484
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
116485
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
116486
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
116487
|
+
*/
|
|
116488
|
+
|
|
116489
|
+
switch (className.toLowerCase()) {
|
|
116490
|
+
|
|
116491
|
+
case "statement":
|
|
116492
|
+
if (node.type.slice(-9) === "Statement") {
|
|
116493
|
+
return true;
|
|
116494
|
+
}
|
|
116495
|
+
|
|
116496
|
+
// fallthrough: interface Declaration <: Statement { }
|
|
116497
|
+
|
|
116498
|
+
case "declaration":
|
|
116499
|
+
return node.type.slice(-11) === "Declaration";
|
|
116500
|
+
|
|
116501
|
+
case "pattern":
|
|
116502
|
+
if (node.type.slice(-7) === "Pattern") {
|
|
116503
|
+
return true;
|
|
116504
|
+
}
|
|
116505
|
+
|
|
116506
|
+
// fallthrough: interface Expression <: Node, Pattern { }
|
|
116507
|
+
|
|
116508
|
+
case "expression":
|
|
116509
|
+
return node.type.slice(-10) === "Expression" ||
|
|
116510
|
+
node.type.slice(-7) === "Literal" ||
|
|
116511
|
+
(
|
|
116512
|
+
node.type === "Identifier" &&
|
|
116513
|
+
(ancestry.length === 0 || ancestry[0].type !== "MetaProperty")
|
|
116514
|
+
) ||
|
|
116515
|
+
node.type === "MetaProperty";
|
|
116516
|
+
|
|
116517
|
+
case "function":
|
|
116518
|
+
return node.type === "FunctionDeclaration" ||
|
|
116519
|
+
node.type === "FunctionExpression" ||
|
|
116520
|
+
node.type === "ArrowFunctionExpression";
|
|
116521
|
+
|
|
116522
|
+
default:
|
|
116523
|
+
throw new Error(`Unknown class name: ${className}`);
|
|
116524
|
+
}
|
|
116525
|
+
},
|
|
116526
|
+
|
|
116527
|
+
/**
|
|
116528
|
+
* Parses the given file into an AST.
|
|
116529
|
+
* @param {VFile} file The virtual file to parse.
|
|
116530
|
+
* @param {Object} options Additional options passed from ESLint.
|
|
116531
|
+
* @param {LanguageOptions} options.languageOptions The language options.
|
|
116532
|
+
* @returns {Object} The result of parsing.
|
|
116533
|
+
*/
|
|
116534
|
+
parse(file, { languageOptions }) {
|
|
116535
|
+
|
|
116536
|
+
// Note: BOM already removed
|
|
116537
|
+
const { body: text, path: filePath } = file;
|
|
116538
|
+
const textToParse = text.replace(astUtils.shebangPattern, (match, captured) => `//${captured}`);
|
|
116539
|
+
const { ecmaVersion, sourceType, parser } = languageOptions;
|
|
116540
|
+
const parserOptions = Object.assign(
|
|
116541
|
+
{ ecmaVersion, sourceType },
|
|
116542
|
+
languageOptions.parserOptions,
|
|
116543
|
+
{
|
|
116544
|
+
loc: true,
|
|
116545
|
+
range: true,
|
|
116546
|
+
raw: true,
|
|
116547
|
+
tokens: true,
|
|
116548
|
+
comment: true,
|
|
116549
|
+
eslintVisitorKeys: true,
|
|
116550
|
+
eslintScopeManager: true,
|
|
116551
|
+
filePath
|
|
116552
|
+
}
|
|
116553
|
+
);
|
|
116554
|
+
|
|
116555
|
+
/*
|
|
116556
|
+
* Check for parsing errors first. If there's a parsing error, nothing
|
|
116557
|
+
* else can happen. However, a parsing error does not throw an error
|
|
116558
|
+
* from this method - it's just considered a fatal error message, a
|
|
116559
|
+
* problem that ESLint identified just like any other.
|
|
116560
|
+
*/
|
|
116561
|
+
try {
|
|
116562
|
+
debug("Parsing:", filePath);
|
|
116563
|
+
const parseResult = (typeof parser.parseForESLint === "function")
|
|
116564
|
+
? parser.parseForESLint(textToParse, parserOptions)
|
|
116565
|
+
: { ast: parser.parse(textToParse, parserOptions) };
|
|
116566
|
+
|
|
116567
|
+
debug("Parsing successful:", filePath);
|
|
116568
|
+
|
|
116569
|
+
const {
|
|
116570
|
+
ast,
|
|
116571
|
+
services: parserServices = {},
|
|
116572
|
+
visitorKeys = evk.KEYS,
|
|
116573
|
+
scopeManager
|
|
116574
|
+
} = parseResult;
|
|
116575
|
+
|
|
116576
|
+
return {
|
|
116577
|
+
ok: true,
|
|
116578
|
+
ast,
|
|
116579
|
+
parserServices,
|
|
116580
|
+
visitorKeys,
|
|
116581
|
+
scopeManager
|
|
116582
|
+
};
|
|
116583
|
+
} catch (ex) {
|
|
116584
|
+
|
|
116585
|
+
// If the message includes a leading line number, strip it:
|
|
116586
|
+
const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`;
|
|
116587
|
+
|
|
116588
|
+
debug("%s\n%s", message, ex.stack);
|
|
116589
|
+
|
|
116590
|
+
return {
|
|
116591
|
+
ok: false,
|
|
116592
|
+
errors: [{
|
|
116593
|
+
message,
|
|
116594
|
+
line: ex.lineNumber,
|
|
116595
|
+
column: ex.column
|
|
116596
|
+
}]
|
|
116597
|
+
};
|
|
116598
|
+
}
|
|
116599
|
+
|
|
116600
|
+
},
|
|
116601
|
+
|
|
116602
|
+
/**
|
|
116603
|
+
* Creates a new `SourceCode` object from the given information.
|
|
116604
|
+
* @param {VFile} file The virtual file to create a `SourceCode` object from.
|
|
116605
|
+
* @param {Object} parseResult The result returned from `parse()`.
|
|
116606
|
+
* @param {Object} options Additional options passed from ESLint.
|
|
116607
|
+
* @param {LanguageOptions} options.languageOptions The language options.
|
|
116608
|
+
* @returns {SourceCode} The new `SourceCode` object.
|
|
116609
|
+
*/
|
|
116610
|
+
createSourceCode(file, parseResult, { languageOptions }) {
|
|
116611
|
+
|
|
116612
|
+
const { body: text, path: filePath, bom: hasBOM } = file;
|
|
116613
|
+
const { ast, parserServices, visitorKeys } = parseResult;
|
|
116614
|
+
|
|
116615
|
+
debug("Scope analysis:", filePath);
|
|
116616
|
+
const scopeManager = parseResult.scopeManager || analyzeScope(ast, languageOptions, visitorKeys);
|
|
116617
|
+
|
|
116618
|
+
debug("Scope analysis successful:", filePath);
|
|
116619
|
+
|
|
116620
|
+
return new SourceCode({
|
|
116621
|
+
text,
|
|
116622
|
+
ast,
|
|
116623
|
+
hasBOM,
|
|
116624
|
+
parserServices,
|
|
116625
|
+
scopeManager,
|
|
116626
|
+
visitorKeys
|
|
116627
|
+
});
|
|
116628
|
+
}
|
|
116629
|
+
|
|
116630
|
+
};
|
|
116631
|
+
return js;
|
|
116632
|
+
}
|
|
116633
|
+
|
|
116195
116634
|
/**
|
|
116196
116635
|
* @fileoverview Default configuration
|
|
116197
116636
|
* @author Nicholas C. Zakas
|
|
@@ -116218,6 +116657,10 @@ function requireDefaultConfig () {
|
|
|
116218
116657
|
plugins: {
|
|
116219
116658
|
"@": {
|
|
116220
116659
|
|
|
116660
|
+
languages: {
|
|
116661
|
+
js: requireJs()
|
|
116662
|
+
},
|
|
116663
|
+
|
|
116221
116664
|
/*
|
|
116222
116665
|
* Because we try to delay loading rules until absolutely
|
|
116223
116666
|
* necessary, a proxy allows us to hook into the lazy-loading
|
|
@@ -116235,6 +116678,7 @@ function requireDefaultConfig () {
|
|
|
116235
116678
|
})
|
|
116236
116679
|
}
|
|
116237
116680
|
},
|
|
116681
|
+
language: "@/js",
|
|
116238
116682
|
languageOptions: {
|
|
116239
116683
|
sourceType: "module",
|
|
116240
116684
|
ecmaVersion: "latest",
|
|
@@ -116285,7 +116729,7 @@ function requireFlatConfigArray () {
|
|
|
116285
116729
|
//-----------------------------------------------------------------------------
|
|
116286
116730
|
|
|
116287
116731
|
const { ConfigArray, ConfigArraySymbol } = requireCjs();
|
|
116288
|
-
const { flatConfigSchema } = requireFlatConfigSchema();
|
|
116732
|
+
const { flatConfigSchema, hasMethod } = requireFlatConfigSchema();
|
|
116289
116733
|
const { RuleValidator } = requireRuleValidator();
|
|
116290
116734
|
const { defaultConfig } = requireDefaultConfig();
|
|
116291
116735
|
|
|
@@ -116398,6 +116842,43 @@ function requireFlatConfigArray () {
|
|
|
116398
116842
|
);
|
|
116399
116843
|
}
|
|
116400
116844
|
|
|
116845
|
+
/**
|
|
116846
|
+
* Converts a languageOptions object to a JSON representation.
|
|
116847
|
+
* @param {Record<string, any>} languageOptions The options to create a JSON
|
|
116848
|
+
* representation of.
|
|
116849
|
+
* @param {string} objectKey The key of the object being converted.
|
|
116850
|
+
* @returns {Record<string, any>} The JSON representation of the languageOptions.
|
|
116851
|
+
* @throws {TypeError} If a function is found in the languageOptions.
|
|
116852
|
+
*/
|
|
116853
|
+
function languageOptionsToJSON(languageOptions, objectKey = "languageOptions") {
|
|
116854
|
+
|
|
116855
|
+
const result = {};
|
|
116856
|
+
|
|
116857
|
+
for (const [key, value] of Object.entries(languageOptions)) {
|
|
116858
|
+
if (value) {
|
|
116859
|
+
if (typeof value === "object") {
|
|
116860
|
+
const name = getObjectId(value);
|
|
116861
|
+
|
|
116862
|
+
if (name && hasMethod(value)) {
|
|
116863
|
+
result[key] = name;
|
|
116864
|
+
} else {
|
|
116865
|
+
result[key] = languageOptionsToJSON(value, key);
|
|
116866
|
+
}
|
|
116867
|
+
continue;
|
|
116868
|
+
}
|
|
116869
|
+
|
|
116870
|
+
if (typeof value === "function") {
|
|
116871
|
+
throw new TypeError(`Cannot serialize key "${key}" in ${objectKey}: Function values are not supported.`);
|
|
116872
|
+
}
|
|
116873
|
+
|
|
116874
|
+
}
|
|
116875
|
+
|
|
116876
|
+
result[key] = value;
|
|
116877
|
+
}
|
|
116878
|
+
|
|
116879
|
+
return result;
|
|
116880
|
+
}
|
|
116881
|
+
|
|
116401
116882
|
const originalBaseConfig = Symbol("originalBaseConfig");
|
|
116402
116883
|
const originalLength = Symbol("originalLength");
|
|
116403
116884
|
const baseLength = Symbol("baseLength");
|
|
@@ -116544,10 +117025,11 @@ function requireFlatConfigArray () {
|
|
|
116544
117025
|
*/
|
|
116545
117026
|
[ConfigArraySymbol.finalizeConfig](config) {
|
|
116546
117027
|
|
|
116547
|
-
const { plugins, languageOptions, processor } = config;
|
|
116548
|
-
let parserName, processorName;
|
|
117028
|
+
const { plugins, language, languageOptions, processor } = config;
|
|
117029
|
+
let parserName, processorName, languageName;
|
|
116549
117030
|
let invalidParser = false,
|
|
116550
|
-
invalidProcessor = false
|
|
117031
|
+
invalidProcessor = false,
|
|
117032
|
+
invalidLanguage = false;
|
|
116551
117033
|
|
|
116552
117034
|
// Check parser value
|
|
116553
117035
|
if (languageOptions && languageOptions.parser) {
|
|
@@ -116565,6 +117047,29 @@ function requireFlatConfigArray () {
|
|
|
116565
117047
|
}
|
|
116566
117048
|
}
|
|
116567
117049
|
|
|
117050
|
+
// Check language value
|
|
117051
|
+
if (language) {
|
|
117052
|
+
if (typeof language === "string") {
|
|
117053
|
+
const { pluginName, objectName: localLanguageName } = splitPluginIdentifier(language);
|
|
117054
|
+
|
|
117055
|
+
languageName = language;
|
|
117056
|
+
|
|
117057
|
+
if (!plugins || !plugins[pluginName] || !plugins[pluginName].languages || !plugins[pluginName].languages[localLanguageName]) {
|
|
117058
|
+
throw new TypeError(`Key "language": Could not find "${localLanguageName}" in plugin "${pluginName}".`);
|
|
117059
|
+
}
|
|
117060
|
+
|
|
117061
|
+
config.language = plugins[pluginName].languages[localLanguageName];
|
|
117062
|
+
} else {
|
|
117063
|
+
invalidLanguage = true;
|
|
117064
|
+
}
|
|
117065
|
+
|
|
117066
|
+
try {
|
|
117067
|
+
config.language.validateLanguageOptions(config.languageOptions);
|
|
117068
|
+
} catch (error) {
|
|
117069
|
+
throw new TypeError(`Key "languageOptions": ${error.message}`, { cause: error });
|
|
117070
|
+
}
|
|
117071
|
+
}
|
|
117072
|
+
|
|
116568
117073
|
// Check processor value
|
|
116569
117074
|
if (processor) {
|
|
116570
117075
|
if (typeof processor === "string") {
|
|
@@ -116604,6 +117109,10 @@ function requireFlatConfigArray () {
|
|
|
116604
117109
|
throw new Error("Could not serialize processor object (missing 'meta' object).");
|
|
116605
117110
|
}
|
|
116606
117111
|
|
|
117112
|
+
if (invalidLanguage) {
|
|
117113
|
+
throw new Error("Caching is not supported when language is an object.");
|
|
117114
|
+
}
|
|
117115
|
+
|
|
116607
117116
|
return {
|
|
116608
117117
|
...this,
|
|
116609
117118
|
plugins: Object.entries(plugins).map(([namespace, plugin]) => {
|
|
@@ -116616,10 +117125,8 @@ function requireFlatConfigArray () {
|
|
|
116616
117125
|
|
|
116617
117126
|
return `${namespace}:${pluginId}`;
|
|
116618
117127
|
}),
|
|
116619
|
-
|
|
116620
|
-
|
|
116621
|
-
parser: parserName
|
|
116622
|
-
},
|
|
117128
|
+
language: languageName,
|
|
117129
|
+
languageOptions: languageOptionsToJSON(languageOptions),
|
|
116623
117130
|
processor: processorName
|
|
116624
117131
|
};
|
|
116625
117132
|
}
|
|
@@ -116636,6 +117143,118 @@ function requireFlatConfigArray () {
|
|
|
116636
117143
|
return flatConfigArray;
|
|
116637
117144
|
}
|
|
116638
117145
|
|
|
117146
|
+
/**
|
|
117147
|
+
* @fileoverview Virtual file
|
|
117148
|
+
* @author Nicholas C. Zakas
|
|
117149
|
+
*/
|
|
117150
|
+
|
|
117151
|
+
var vfile;
|
|
117152
|
+
var hasRequiredVfile;
|
|
117153
|
+
|
|
117154
|
+
function requireVfile () {
|
|
117155
|
+
if (hasRequiredVfile) return vfile;
|
|
117156
|
+
hasRequiredVfile = 1;
|
|
117157
|
+
|
|
117158
|
+
//------------------------------------------------------------------------------
|
|
117159
|
+
// Helpers
|
|
117160
|
+
//------------------------------------------------------------------------------
|
|
117161
|
+
|
|
117162
|
+
/**
|
|
117163
|
+
* Determines if a given value has a byte order mark (BOM).
|
|
117164
|
+
* @param {string|Uint8Array} value The value to check.
|
|
117165
|
+
* @returns {boolean} `true` if the value has a BOM, `false` otherwise.
|
|
117166
|
+
*/
|
|
117167
|
+
function hasUnicodeBOM(value) {
|
|
117168
|
+
return typeof value === "string"
|
|
117169
|
+
? value.charCodeAt(0) === 0xFEFF
|
|
117170
|
+
: value[0] === 0xEF && value[1] === 0xBB && value[2] === 0xBF;
|
|
117171
|
+
}
|
|
117172
|
+
|
|
117173
|
+
/**
|
|
117174
|
+
* Strips Unicode BOM from the given value.
|
|
117175
|
+
* @param {string|Uint8Array} value The value to remove the BOM from.
|
|
117176
|
+
* @returns {string|Uint8Array} The stripped value.
|
|
117177
|
+
*/
|
|
117178
|
+
function stripUnicodeBOM(value) {
|
|
117179
|
+
|
|
117180
|
+
if (!hasUnicodeBOM(value)) {
|
|
117181
|
+
return value;
|
|
117182
|
+
}
|
|
117183
|
+
|
|
117184
|
+
if (typeof value === "string") {
|
|
117185
|
+
|
|
117186
|
+
/*
|
|
117187
|
+
* Check Unicode BOM.
|
|
117188
|
+
* In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF.
|
|
117189
|
+
* http://www.ecma-international.org/ecma-262/6.0/#sec-unicode-format-control-characters
|
|
117190
|
+
*/
|
|
117191
|
+
return value.slice(1);
|
|
117192
|
+
}
|
|
117193
|
+
|
|
117194
|
+
/*
|
|
117195
|
+
* In a Uint8Array, the BOM is represented by three bytes: 0xEF, 0xBB, and 0xBF,
|
|
117196
|
+
* so we can just remove the first three bytes.
|
|
117197
|
+
*/
|
|
117198
|
+
return value.slice(3);
|
|
117199
|
+
}
|
|
117200
|
+
|
|
117201
|
+
//------------------------------------------------------------------------------
|
|
117202
|
+
// Exports
|
|
117203
|
+
//------------------------------------------------------------------------------
|
|
117204
|
+
|
|
117205
|
+
/**
|
|
117206
|
+
* Represents a virtual file inside of ESLint.
|
|
117207
|
+
*/
|
|
117208
|
+
class VFile {
|
|
117209
|
+
|
|
117210
|
+
/**
|
|
117211
|
+
* The file path including any processor-created virtual path.
|
|
117212
|
+
* @type {string}
|
|
117213
|
+
* @readonly
|
|
117214
|
+
*/
|
|
117215
|
+
path;
|
|
117216
|
+
|
|
117217
|
+
/**
|
|
117218
|
+
* The file path on disk.
|
|
117219
|
+
* @type {string}
|
|
117220
|
+
* @readonly
|
|
117221
|
+
*/
|
|
117222
|
+
physicalPath;
|
|
117223
|
+
|
|
117224
|
+
/**
|
|
117225
|
+
* The file contents.
|
|
117226
|
+
* @type {string|Uint8Array}
|
|
117227
|
+
* @readonly
|
|
117228
|
+
*/
|
|
117229
|
+
body;
|
|
117230
|
+
|
|
117231
|
+
/**
|
|
117232
|
+
* Indicates whether the file has a byte order mark (BOM).
|
|
117233
|
+
* @type {boolean}
|
|
117234
|
+
* @readonly
|
|
117235
|
+
*/
|
|
117236
|
+
bom;
|
|
117237
|
+
|
|
117238
|
+
/**
|
|
117239
|
+
* Creates a new instance.
|
|
117240
|
+
* @param {string} path The file path.
|
|
117241
|
+
* @param {string|Uint8Array} body The file contents.
|
|
117242
|
+
* @param {Object} [options] Additional options.
|
|
117243
|
+
* @param {string} [options.physicalPath] The file path on disk.
|
|
117244
|
+
*/
|
|
117245
|
+
constructor(path, body, { physicalPath } = {}) {
|
|
117246
|
+
this.path = path;
|
|
117247
|
+
this.physicalPath = physicalPath ?? path;
|
|
117248
|
+
this.bom = hasUnicodeBOM(body);
|
|
117249
|
+
this.body = stripUnicodeBOM(body);
|
|
117250
|
+
}
|
|
117251
|
+
|
|
117252
|
+
}
|
|
117253
|
+
|
|
117254
|
+
vfile = { VFile };
|
|
117255
|
+
return vfile;
|
|
117256
|
+
}
|
|
117257
|
+
|
|
116639
117258
|
var linter;
|
|
116640
117259
|
var hasRequiredLinter;
|
|
116641
117260
|
|
|
@@ -116654,7 +117273,6 @@ function requireLinter () {
|
|
|
116654
117273
|
espree = requireEspree(),
|
|
116655
117274
|
merge = requireLodash_merge(),
|
|
116656
117275
|
pkg = require$$5,
|
|
116657
|
-
astUtils = requireAstUtils$1(),
|
|
116658
117276
|
{
|
|
116659
117277
|
directivesPattern
|
|
116660
117278
|
} = requireDirectives(),
|
|
@@ -116675,13 +117293,14 @@ function requireLinter () {
|
|
|
116675
117293
|
createEmitter = requireSafeEmitter(),
|
|
116676
117294
|
SourceCodeFixer = requireSourceCodeFixer(),
|
|
116677
117295
|
timing = requireTiming(),
|
|
116678
|
-
ruleReplacements = require$$
|
|
117296
|
+
ruleReplacements = require$$18;
|
|
116679
117297
|
const { getRuleFromConfig } = requireFlatConfigHelpers();
|
|
116680
117298
|
const { FlatConfigArray } = requireFlatConfigArray();
|
|
116681
117299
|
const { startTime, endTime } = requireStats();
|
|
116682
117300
|
const { RuleValidator } = requireRuleValidator();
|
|
116683
117301
|
const { assertIsRuleSeverity } = requireFlatConfigSchema();
|
|
116684
117302
|
const { normalizeSeverityToString } = requireSeverity();
|
|
117303
|
+
const jslang = requireJs();
|
|
116685
117304
|
const debug = requireSrc()("eslint:linter");
|
|
116686
117305
|
const MAX_AUTOFIX_PASSES = 10;
|
|
116687
117306
|
const DEFAULT_PARSER_NAME = "espree";
|
|
@@ -116690,6 +117309,7 @@ function requireLinter () {
|
|
|
116690
117309
|
const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } };
|
|
116691
117310
|
const parserSymbol = Symbol.for("eslint.RuleTester.parser");
|
|
116692
117311
|
const { LATEST_ECMA_VERSION } = requireEcmaVersion();
|
|
117312
|
+
const { VFile } = requireVfile();
|
|
116693
117313
|
const STEP_KIND_VISIT = 1;
|
|
116694
117314
|
const STEP_KIND_CALL = 2;
|
|
116695
117315
|
|
|
@@ -116876,6 +117496,35 @@ function requireLinter () {
|
|
|
116876
117496
|
: `Definition for rule '${ruleId}' was not found.`;
|
|
116877
117497
|
}
|
|
116878
117498
|
|
|
117499
|
+
/**
|
|
117500
|
+
* Updates a given location based on the language offsets. This allows us to
|
|
117501
|
+
* change 0-based locations to 1-based locations. We always want ESLint
|
|
117502
|
+
* reporting lines and columns starting from 1.
|
|
117503
|
+
* @param {Object} location The location to update.
|
|
117504
|
+
* @param {number} location.line The starting line number.
|
|
117505
|
+
* @param {number} location.column The starting column number.
|
|
117506
|
+
* @param {number} [location.endLine] The ending line number.
|
|
117507
|
+
* @param {number} [location.endColumn] The ending column number.
|
|
117508
|
+
* @param {Language} language The language to use to adjust the location information.
|
|
117509
|
+
* @returns {Object} The updated location.
|
|
117510
|
+
*/
|
|
117511
|
+
function updateLocationInformation({ line, column, endLine, endColumn }, language) {
|
|
117512
|
+
|
|
117513
|
+
const columnOffset = language.columnStart === 1 ? 0 : 1;
|
|
117514
|
+
const lineOffset = language.lineStart === 1 ? 0 : 1;
|
|
117515
|
+
|
|
117516
|
+
// calculate separately to account for undefined
|
|
117517
|
+
const finalEndLine = endLine === void 0 ? endLine : endLine + lineOffset;
|
|
117518
|
+
const finalEndColumn = endColumn === void 0 ? endColumn : endColumn + columnOffset;
|
|
117519
|
+
|
|
117520
|
+
return {
|
|
117521
|
+
line: line + lineOffset,
|
|
117522
|
+
column: column + columnOffset,
|
|
117523
|
+
endLine: finalEndLine,
|
|
117524
|
+
endColumn: finalEndColumn
|
|
117525
|
+
};
|
|
117526
|
+
}
|
|
117527
|
+
|
|
116879
117528
|
/**
|
|
116880
117529
|
* creates a linting problem
|
|
116881
117530
|
* @param {Object} options to create linting error
|
|
@@ -116883,6 +117532,7 @@ function requireLinter () {
|
|
|
116883
117532
|
* @param {Object} [options.loc] the loc to report
|
|
116884
117533
|
* @param {string} [options.message] the error message to report
|
|
116885
117534
|
* @param {string} [options.severity] the error message to report
|
|
117535
|
+
* @param {Language} [options.language] the language to use to adjust the location information
|
|
116886
117536
|
* @returns {LintMessage} created problem, returns a missing-rule problem if only provided ruleId.
|
|
116887
117537
|
* @private
|
|
116888
117538
|
*/
|
|
@@ -116891,16 +117541,24 @@ function requireLinter () {
|
|
|
116891
117541
|
ruleId = null,
|
|
116892
117542
|
loc = DEFAULT_ERROR_LOC,
|
|
116893
117543
|
message = createMissingRuleMessage(options.ruleId),
|
|
116894
|
-
severity = 2
|
|
117544
|
+
severity = 2,
|
|
117545
|
+
|
|
117546
|
+
// fallback for eslintrc mode
|
|
117547
|
+
language = {
|
|
117548
|
+
columnStart: 0,
|
|
117549
|
+
lineStart: 1
|
|
117550
|
+
}
|
|
116895
117551
|
} = options;
|
|
116896
117552
|
|
|
116897
117553
|
return {
|
|
116898
117554
|
ruleId,
|
|
116899
117555
|
message,
|
|
116900
|
-
|
|
116901
|
-
|
|
116902
|
-
|
|
116903
|
-
|
|
117556
|
+
...updateLocationInformation({
|
|
117557
|
+
line: loc.start.line,
|
|
117558
|
+
column: loc.start.column,
|
|
117559
|
+
endLine: loc.end.line,
|
|
117560
|
+
endColumn: loc.end.column
|
|
117561
|
+
}, language),
|
|
116904
117562
|
severity,
|
|
116905
117563
|
nodeType: null
|
|
116906
117564
|
};
|
|
@@ -117178,10 +117836,11 @@ function requireLinter () {
|
|
|
117178
117836
|
* Parses comments in file to extract disable directives.
|
|
117179
117837
|
* @param {SourceCode} sourceCode The SourceCode object to get comments from.
|
|
117180
117838
|
* @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
|
|
117839
|
+
* @param {Language} language The language to use to adjust the location information
|
|
117181
117840
|
* @returns {{problems: LintMessage[], disableDirectives: DisableDirective[]}}
|
|
117182
117841
|
* A collection of the directive comments that were found, along with any problems that occurred when parsing
|
|
117183
117842
|
*/
|
|
117184
|
-
function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper) {
|
|
117843
|
+
function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper, language) {
|
|
117185
117844
|
const disableDirectives = [];
|
|
117186
117845
|
const problems = [];
|
|
117187
117846
|
|
|
@@ -117190,7 +117849,10 @@ function requireLinter () {
|
|
|
117190
117849
|
problems: directivesProblems
|
|
117191
117850
|
} = sourceCode.getDisableDirectives();
|
|
117192
117851
|
|
|
117193
|
-
problems.push(...directivesProblems.map(createLintingProblem
|
|
117852
|
+
problems.push(...directivesProblems.map(directiveProblem => createLintingProblem({
|
|
117853
|
+
...directiveProblem,
|
|
117854
|
+
language
|
|
117855
|
+
})));
|
|
117194
117856
|
|
|
117195
117857
|
directivesSources.forEach(directive => {
|
|
117196
117858
|
const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper);
|
|
@@ -117418,24 +118080,6 @@ function requireLinter () {
|
|
|
117418
118080
|
);
|
|
117419
118081
|
}
|
|
117420
118082
|
|
|
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
118083
|
/**
|
|
117440
118084
|
* Store time measurements in map
|
|
117441
118085
|
* @param {number} time Time measurement
|
|
@@ -117497,99 +118141,46 @@ function requireLinter () {
|
|
|
117497
118141
|
impliedStrict: ecmaFeatures.impliedStrict,
|
|
117498
118142
|
ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6,
|
|
117499
118143
|
sourceType: languageOptions.sourceType || "script",
|
|
117500
|
-
childVisitorKeys:
|
|
118144
|
+
childVisitorKeys: evk.KEYS,
|
|
117501
118145
|
fallback: Traverser.getKeys
|
|
117502
118146
|
});
|
|
117503
118147
|
}
|
|
117504
118148
|
|
|
117505
118149
|
/**
|
|
117506
|
-
* Parses
|
|
118150
|
+
* Parses file into an AST. Moved out here because the try-catch prevents
|
|
117507
118151
|
* optimization of functions, so it's best to keep the try-catch as isolated
|
|
117508
118152
|
* as possible
|
|
117509
|
-
* @param {
|
|
118153
|
+
* @param {VFile} file The file to parse.
|
|
118154
|
+
* @param {Language} language The language to use.
|
|
117510
118155
|
* @param {LanguageOptions} languageOptions Options to pass to the parser
|
|
117511
|
-
* @param {string} filePath The path to the file being parsed.
|
|
117512
118156
|
* @returns {{success: false, error: LintMessage}|{success: true, sourceCode: SourceCode}}
|
|
117513
118157
|
* An object containing the AST and parser services if parsing was successful, or the error if parsing failed
|
|
117514
118158
|
* @private
|
|
117515
118159
|
*/
|
|
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) };
|
|
118160
|
+
function parse(file, language, languageOptions) {
|
|
117545
118161
|
|
|
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);
|
|
118162
|
+
const result = language.parse(file, { languageOptions });
|
|
117555
118163
|
|
|
118164
|
+
if (result.ok) {
|
|
117556
118165
|
return {
|
|
117557
118166
|
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
|
-
}
|
|
118167
|
+
sourceCode: language.createSourceCode(file, result, { languageOptions })
|
|
117591
118168
|
};
|
|
117592
118169
|
}
|
|
118170
|
+
|
|
118171
|
+
// if we made it to here there was an error
|
|
118172
|
+
return {
|
|
118173
|
+
success: false,
|
|
118174
|
+
errors: result.errors.map(error => ({
|
|
118175
|
+
ruleId: null,
|
|
118176
|
+
nodeType: null,
|
|
118177
|
+
fatal: true,
|
|
118178
|
+
severity: 2,
|
|
118179
|
+
message: error.message,
|
|
118180
|
+
line: error.line,
|
|
118181
|
+
column: error.column
|
|
118182
|
+
}))
|
|
118183
|
+
};
|
|
117593
118184
|
}
|
|
117594
118185
|
|
|
117595
118186
|
/**
|
|
@@ -117620,6 +118211,7 @@ function requireLinter () {
|
|
|
117620
118211
|
* @param {Object} configuredRules The rules configuration
|
|
117621
118212
|
* @param {function(string): Rule} ruleMapper A mapper function from rule names to rules
|
|
117622
118213
|
* @param {string | undefined} parserName The name of the parser in the config
|
|
118214
|
+
* @param {Language} language The language object used for parsing.
|
|
117623
118215
|
* @param {LanguageOptions} languageOptions The options for parsing the code.
|
|
117624
118216
|
* @param {Object} settings The settings that were enabled in the config
|
|
117625
118217
|
* @param {string} filename The reported filename of the code
|
|
@@ -117632,8 +118224,11 @@ function requireLinter () {
|
|
|
117632
118224
|
* @returns {LintMessage[]} An array of reported problems
|
|
117633
118225
|
* @throws {Error} If traversal into a node fails.
|
|
117634
118226
|
*/
|
|
117635
|
-
function runRules(
|
|
117636
|
-
|
|
118227
|
+
function runRules(
|
|
118228
|
+
sourceCode, configuredRules, ruleMapper, parserName, language, languageOptions,
|
|
118229
|
+
settings, filename, disableFixes, cwd, physicalFilename, ruleFilter,
|
|
118230
|
+
stats, slots
|
|
118231
|
+
) {
|
|
117637
118232
|
const emitter = createEmitter();
|
|
117638
118233
|
|
|
117639
118234
|
// must happen first to assign all node.parent properties
|
|
@@ -117680,7 +118275,7 @@ function requireLinter () {
|
|
|
117680
118275
|
const rule = ruleMapper(ruleId);
|
|
117681
118276
|
|
|
117682
118277
|
if (!rule) {
|
|
117683
|
-
lintingProblems.push(createLintingProblem({ ruleId }));
|
|
118278
|
+
lintingProblems.push(createLintingProblem({ ruleId, language }));
|
|
117684
118279
|
return;
|
|
117685
118280
|
}
|
|
117686
118281
|
|
|
@@ -117710,7 +118305,8 @@ function requireLinter () {
|
|
|
117710
118305
|
severity,
|
|
117711
118306
|
sourceCode,
|
|
117712
118307
|
messageIds,
|
|
117713
|
-
disableFixes
|
|
118308
|
+
disableFixes,
|
|
118309
|
+
language
|
|
117714
118310
|
});
|
|
117715
118311
|
}
|
|
117716
118312
|
const problem = reportTranslator(...args);
|
|
@@ -117781,7 +118377,12 @@ function requireLinter () {
|
|
|
117781
118377
|
});
|
|
117782
118378
|
});
|
|
117783
118379
|
|
|
117784
|
-
const eventGenerator = new NodeEventGenerator(emitter, {
|
|
118380
|
+
const eventGenerator = new NodeEventGenerator(emitter, {
|
|
118381
|
+
visitorKeys: sourceCode.visitorKeys,
|
|
118382
|
+
fallback: Traverser.getKeys,
|
|
118383
|
+
matchClass: language.matchesSelectorClass,
|
|
118384
|
+
nodeTypeKey: language.nodeTypeKey
|
|
118385
|
+
});
|
|
117785
118386
|
|
|
117786
118387
|
for (const step of eventQueue) {
|
|
117787
118388
|
switch (step.kind) {
|
|
@@ -117997,6 +118598,9 @@ function requireLinter () {
|
|
|
117997
118598
|
parser,
|
|
117998
118599
|
parserOptions
|
|
117999
118600
|
});
|
|
118601
|
+
const file = new VFile(options.filename, text, {
|
|
118602
|
+
physicalPath: providedOptions.physicalFilename
|
|
118603
|
+
});
|
|
118000
118604
|
|
|
118001
118605
|
if (!slots.lastSourceCode) {
|
|
118002
118606
|
let t;
|
|
@@ -118006,9 +118610,9 @@ function requireLinter () {
|
|
|
118006
118610
|
}
|
|
118007
118611
|
|
|
118008
118612
|
const parseResult = parse(
|
|
118009
|
-
|
|
118010
|
-
|
|
118011
|
-
|
|
118613
|
+
file,
|
|
118614
|
+
jslang,
|
|
118615
|
+
languageOptions
|
|
118012
118616
|
);
|
|
118013
118617
|
|
|
118014
118618
|
if (options.stats) {
|
|
@@ -118019,7 +118623,7 @@ function requireLinter () {
|
|
|
118019
118623
|
}
|
|
118020
118624
|
|
|
118021
118625
|
if (!parseResult.success) {
|
|
118022
|
-
return
|
|
118626
|
+
return parseResult.errors;
|
|
118023
118627
|
}
|
|
118024
118628
|
|
|
118025
118629
|
slots.lastSourceCode = parseResult.sourceCode;
|
|
@@ -118033,6 +118637,7 @@ function requireLinter () {
|
|
|
118033
118637
|
slots.lastSourceCode = new SourceCode({
|
|
118034
118638
|
text: slots.lastSourceCode.text,
|
|
118035
118639
|
ast: slots.lastSourceCode.ast,
|
|
118640
|
+
hasBOM: slots.lastSourceCode.hasBOM,
|
|
118036
118641
|
parserServices: slots.lastSourceCode.parserServices,
|
|
118037
118642
|
visitorKeys: slots.lastSourceCode.visitorKeys,
|
|
118038
118643
|
scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions)
|
|
@@ -118045,7 +118650,6 @@ function requireLinter () {
|
|
|
118045
118650
|
? getDirectiveComments(sourceCode, ruleId => getRule(slots, ruleId), options.warnInlineConfig, config)
|
|
118046
118651
|
: { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] };
|
|
118047
118652
|
|
|
118048
|
-
// augment global scope with declared global variables
|
|
118049
118653
|
addDeclaredGlobals(
|
|
118050
118654
|
sourceCode.scopeManager.scopes[0],
|
|
118051
118655
|
configuredGlobals,
|
|
@@ -118062,6 +118666,7 @@ function requireLinter () {
|
|
|
118062
118666
|
configuredRules,
|
|
118063
118667
|
ruleId => getRule(slots, ruleId),
|
|
118064
118668
|
parserName,
|
|
118669
|
+
jslang,
|
|
118065
118670
|
languageOptions,
|
|
118066
118671
|
settings,
|
|
118067
118672
|
options.filename,
|
|
@@ -118094,6 +118699,7 @@ function requireLinter () {
|
|
|
118094
118699
|
}
|
|
118095
118700
|
|
|
118096
118701
|
return applyDisableDirectives({
|
|
118702
|
+
language: jslang,
|
|
118097
118703
|
directives: commentDirectives.disableDirectives,
|
|
118098
118704
|
disableFixes: options.disableFixes,
|
|
118099
118705
|
problems: lintingProblems
|
|
@@ -118296,6 +118902,9 @@ function requireLinter () {
|
|
|
118296
118902
|
}
|
|
118297
118903
|
|
|
118298
118904
|
const settings = config.settings || {};
|
|
118905
|
+
const file = new VFile(options.filename, text, {
|
|
118906
|
+
physicalPath: providedOptions.physicalFilename
|
|
118907
|
+
});
|
|
118299
118908
|
|
|
118300
118909
|
if (!slots.lastSourceCode) {
|
|
118301
118910
|
let t;
|
|
@@ -118305,9 +118914,9 @@ function requireLinter () {
|
|
|
118305
118914
|
}
|
|
118306
118915
|
|
|
118307
118916
|
const parseResult = parse(
|
|
118308
|
-
|
|
118309
|
-
|
|
118310
|
-
|
|
118917
|
+
file,
|
|
118918
|
+
config.language,
|
|
118919
|
+
languageOptions
|
|
118311
118920
|
);
|
|
118312
118921
|
|
|
118313
118922
|
if (options.stats) {
|
|
@@ -118317,7 +118926,7 @@ function requireLinter () {
|
|
|
118317
118926
|
}
|
|
118318
118927
|
|
|
118319
118928
|
if (!parseResult.success) {
|
|
118320
|
-
return
|
|
118929
|
+
return parseResult.errors;
|
|
118321
118930
|
}
|
|
118322
118931
|
|
|
118323
118932
|
slots.lastSourceCode = parseResult.sourceCode;
|
|
@@ -118331,6 +118940,7 @@ function requireLinter () {
|
|
|
118331
118940
|
slots.lastSourceCode = new SourceCode({
|
|
118332
118941
|
text: slots.lastSourceCode.text,
|
|
118333
118942
|
ast: slots.lastSourceCode.ast,
|
|
118943
|
+
hasBOM: slots.lastSourceCode.hasBOM,
|
|
118334
118944
|
parserServices: slots.lastSourceCode.parserServices,
|
|
118335
118945
|
visitorKeys: slots.lastSourceCode.visitorKeys,
|
|
118336
118946
|
scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions)
|
|
@@ -118367,7 +118977,8 @@ function requireLinter () {
|
|
|
118367
118977
|
ruleId: null,
|
|
118368
118978
|
message: `'${sourceCode.text.slice(node.range[0], node.range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`,
|
|
118369
118979
|
loc: node.loc,
|
|
118370
|
-
severity: 1
|
|
118980
|
+
severity: 1,
|
|
118981
|
+
language: config.language
|
|
118371
118982
|
}));
|
|
118372
118983
|
|
|
118373
118984
|
});
|
|
@@ -118376,7 +118987,7 @@ function requireLinter () {
|
|
|
118376
118987
|
|
|
118377
118988
|
inlineConfigProblems.push(
|
|
118378
118989
|
...inlineConfigResult.problems
|
|
118379
|
-
.map(createLintingProblem)
|
|
118990
|
+
.map(problem => createLintingProblem({ ...problem, language: config.language }))
|
|
118380
118991
|
.map(problem => {
|
|
118381
118992
|
problem.fatal = true;
|
|
118382
118993
|
return problem;
|
|
@@ -118393,14 +119004,19 @@ function requireLinter () {
|
|
|
118393
119004
|
const ruleValue = inlineConfig.rules[ruleId];
|
|
118394
119005
|
|
|
118395
119006
|
if (!rule) {
|
|
118396
|
-
inlineConfigProblems.push(createLintingProblem({
|
|
119007
|
+
inlineConfigProblems.push(createLintingProblem({
|
|
119008
|
+
ruleId,
|
|
119009
|
+
loc: node.loc,
|
|
119010
|
+
language: config.language
|
|
119011
|
+
}));
|
|
118397
119012
|
return;
|
|
118398
119013
|
}
|
|
118399
119014
|
|
|
118400
119015
|
if (Object.hasOwn(mergedInlineConfig.rules, ruleId)) {
|
|
118401
119016
|
inlineConfigProblems.push(createLintingProblem({
|
|
118402
119017
|
message: `Rule "${ruleId}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`,
|
|
118403
|
-
loc: node.loc
|
|
119018
|
+
loc: node.loc,
|
|
119019
|
+
language: config.language
|
|
118404
119020
|
}));
|
|
118405
119021
|
return;
|
|
118406
119022
|
}
|
|
@@ -118492,7 +119108,8 @@ function requireLinter () {
|
|
|
118492
119108
|
inlineConfigProblems.push(createLintingProblem({
|
|
118493
119109
|
ruleId,
|
|
118494
119110
|
message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`,
|
|
118495
|
-
loc: node.loc
|
|
119111
|
+
loc: node.loc,
|
|
119112
|
+
language: config.language
|
|
118496
119113
|
}));
|
|
118497
119114
|
}
|
|
118498
119115
|
});
|
|
@@ -118503,7 +119120,8 @@ function requireLinter () {
|
|
|
118503
119120
|
const commentDirectives = options.allowInlineConfig && !options.warnInlineConfig
|
|
118504
119121
|
? getDirectiveCommentsForFlatConfig(
|
|
118505
119122
|
sourceCode,
|
|
118506
|
-
ruleId => getRuleFromConfig(ruleId, config)
|
|
119123
|
+
ruleId => getRuleFromConfig(ruleId, config),
|
|
119124
|
+
config.language
|
|
118507
119125
|
)
|
|
118508
119126
|
: { problems: [], disableDirectives: [] };
|
|
118509
119127
|
|
|
@@ -118519,6 +119137,7 @@ function requireLinter () {
|
|
|
118519
119137
|
configuredRules,
|
|
118520
119138
|
ruleId => getRuleFromConfig(ruleId, config),
|
|
118521
119139
|
void 0,
|
|
119140
|
+
config.language,
|
|
118522
119141
|
languageOptions,
|
|
118523
119142
|
settings,
|
|
118524
119143
|
options.filename,
|
|
@@ -118552,6 +119171,7 @@ function requireLinter () {
|
|
|
118552
119171
|
}
|
|
118553
119172
|
|
|
118554
119173
|
return applyDisableDirectives({
|
|
119174
|
+
language: config.language,
|
|
118555
119175
|
directives: commentDirectives.disableDirectives,
|
|
118556
119176
|
disableFixes: options.disableFixes,
|
|
118557
119177
|
problems: lintingProblems
|