eslint-linter-browserify 9.7.0 → 9.9.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 CHANGED
@@ -17501,7 +17501,7 @@ function requireLodash_merge () {
17501
17501
  }
17502
17502
 
17503
17503
  var name = "eslint";
17504
- var version = "9.7.0";
17504
+ var version = "9.9.0";
17505
17505
  var author = "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>";
17506
17506
  var description$2 = "An AST-based pattern checker for JavaScript.";
17507
17507
  var bin = {
@@ -17555,9 +17555,9 @@ var bugs = "https://github.com/eslint/eslint/issues/";
17555
17555
  var dependencies$2 = {
17556
17556
  "@eslint-community/eslint-utils": "^4.2.0",
17557
17557
  "@eslint-community/regexpp": "^4.11.0",
17558
- "@eslint/config-array": "^0.17.0",
17558
+ "@eslint/config-array": "^0.17.1",
17559
17559
  "@eslint/eslintrc": "^3.1.0",
17560
- "@eslint/js": "9.7.0",
17560
+ "@eslint/js": "9.9.0",
17561
17561
  "@humanwhocodes/module-importer": "^1.0.1",
17562
17562
  "@humanwhocodes/retry": "^0.3.0",
17563
17563
  "@nodelib/fs.walk": "^1.2.8",
@@ -17591,13 +17591,14 @@ var dependencies$2 = {
17591
17591
  var devDependencies = {
17592
17592
  "@babel/core": "^7.4.3",
17593
17593
  "@babel/preset-env": "^7.4.3",
17594
- "@eslint/core": "^0.1.0",
17594
+ "@eslint/core": "^0.3.0",
17595
+ "@eslint/json": "^0.3.0",
17595
17596
  "@types/estree": "^1.0.5",
17596
17597
  "@types/node": "^20.11.5",
17597
- "@wdio/browser-runner": "^8.38.3",
17598
- "@wdio/cli": "^8.38.2",
17599
- "@wdio/concise-reporter": "^8.38.2",
17600
- "@wdio/mocha-framework": "^8.38.2",
17598
+ "@wdio/browser-runner": "^8.40.1",
17599
+ "@wdio/cli": "^8.40.0",
17600
+ "@wdio/concise-reporter": "^8.39.0",
17601
+ "@wdio/mocha-framework": "^8.40.0",
17601
17602
  "babel-loader": "^8.0.5",
17602
17603
  c8: "^7.12.0",
17603
17604
  chai: "^4.0.1",
@@ -17618,6 +17619,7 @@ var devDependencies = {
17618
17619
  globals: "^15.0.0",
17619
17620
  got: "^11.8.3",
17620
17621
  "gray-matter": "^4.0.3",
17622
+ jiti: "^1.21.6",
17621
17623
  "js-yaml": "^4.1.0",
17622
17624
  knip: "^5.21.0",
17623
17625
  "lint-staged": "^11.0.0",
@@ -17651,6 +17653,14 @@ var devDependencies = {
17651
17653
  "webpack-cli": "^4.5.0",
17652
17654
  yorkie: "^2.0.0"
17653
17655
  };
17656
+ var peerDependencies = {
17657
+ jiti: "*"
17658
+ };
17659
+ var peerDependenciesMeta = {
17660
+ jiti: {
17661
+ optional: true
17662
+ }
17663
+ };
17654
17664
  var keywords$1 = [
17655
17665
  "ast",
17656
17666
  "lint",
@@ -17693,6 +17703,8 @@ var require$$5 = {
17693
17703
  bugs: bugs,
17694
17704
  dependencies: dependencies$2,
17695
17705
  devDependencies: devDependencies,
17706
+ peerDependencies: peerDependencies,
17707
+ peerDependenciesMeta: peerDependenciesMeta,
17696
17708
  keywords: keywords$1,
17697
17709
  license: license,
17698
17710
  engines: engines
@@ -41563,6 +41575,25 @@ function requireSourceCode$1 () {
41563
41575
 
41564
41576
  return ancestorsStartingAtParent.reverse();
41565
41577
  }
41578
+
41579
+ /**
41580
+ * Returns the location of the given node or token.
41581
+ * @param {ASTNode|Token} nodeOrToken The node or token to get the location of.
41582
+ * @returns {SourceLocation} The location of the node or token.
41583
+ */
41584
+ getLoc(nodeOrToken) {
41585
+ return nodeOrToken.loc;
41586
+ }
41587
+
41588
+ /**
41589
+ * Returns the range of the given node or token.
41590
+ * @param {ASTNode|Token} nodeOrToken The node or token to get the range of.
41591
+ * @returns {[number, number]} The range of the node or token.
41592
+ */
41593
+ getRange(nodeOrToken) {
41594
+ return nodeOrToken.range;
41595
+ }
41596
+
41566
41597
  /* eslint-enable class-methods-use-this -- node is owned by SourceCode */
41567
41598
 
41568
41599
  /**
@@ -42051,15 +42082,18 @@ function requireApplyDisableDirectives () {
42051
42082
  * Creates removal details for a set of directives within the same comment.
42052
42083
  * @param {Directive[]} directives Unused directives to be removed.
42053
42084
  * @param {Token} node The backing Comment token.
42085
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
42054
42086
  * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
42055
42087
  */
42056
- function createIndividualDirectivesRemoval(directives, node) {
42088
+ function createIndividualDirectivesRemoval(directives, node, sourceCode) {
42089
+
42090
+ const range = sourceCode.getRange(node);
42057
42091
 
42058
42092
  /*
42059
42093
  * `node.value` starts right after `//` or `/*`.
42060
42094
  * All calculated offsets will be relative to this index.
42061
42095
  */
42062
- const commentValueStart = node.range[0] + "//".length;
42096
+ const commentValueStart = range[0] + "//".length;
42063
42097
 
42064
42098
  // Find where the list of rules starts. `\S+` matches with the directive name (e.g. `eslint-disable-line`)
42065
42099
  const listStartOffset = /^\s*\S+\s+/u.exec(node.value)[0].length;
@@ -42155,10 +42189,11 @@ function requireApplyDisableDirectives () {
42155
42189
  * Creates a description of deleting an entire unused disable directive.
42156
42190
  * @param {Directive[]} directives Unused directives to be removed.
42157
42191
  * @param {Token} node The backing Comment token.
42192
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
42158
42193
  * @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output problem.
42159
42194
  */
42160
- function createDirectiveRemoval(directives, node) {
42161
- const { range } = node;
42195
+ function createDirectiveRemoval(directives, node, sourceCode) {
42196
+ const range = sourceCode.getRange(node);
42162
42197
  const ruleIds = directives.filter(directive => directive.ruleId).map(directive => `'${directive.ruleId}'`);
42163
42198
 
42164
42199
  return {
@@ -42176,9 +42211,10 @@ function requireApplyDisableDirectives () {
42176
42211
  /**
42177
42212
  * Parses details from directives to create output Problems.
42178
42213
  * @param {Iterable<Directive>} allDirectives Unused directives to be removed.
42214
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
42179
42215
  * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
42180
42216
  */
42181
- function processUnusedDirectives(allDirectives) {
42217
+ function processUnusedDirectives(allDirectives, sourceCode) {
42182
42218
  const directiveGroups = groupByParentDirective(allDirectives);
42183
42219
 
42184
42220
  return directiveGroups.flatMap(
@@ -42191,8 +42227,8 @@ function requireApplyDisableDirectives () {
42191
42227
  }
42192
42228
 
42193
42229
  return remainingRuleIds.size
42194
- ? createIndividualDirectivesRemoval(directives, parentDirective.node)
42195
- : [createDirectiveRemoval(directives, parentDirective.node)];
42230
+ ? createIndividualDirectivesRemoval(directives, parentDirective.node, sourceCode)
42231
+ : [createDirectiveRemoval(directives, parentDirective.node, sourceCode)];
42196
42232
  }
42197
42233
  );
42198
42234
  }
@@ -42299,6 +42335,7 @@ function requireApplyDisableDirectives () {
42299
42335
  function applyDirectives(options) {
42300
42336
  const problems = [];
42301
42337
  const usedDisableDirectives = new Set();
42338
+ const { sourceCode } = options;
42302
42339
 
42303
42340
  for (const problem of options.problems) {
42304
42341
  let disableDirectivesForProblem = [];
@@ -42360,8 +42397,8 @@ function requireApplyDisableDirectives () {
42360
42397
  }
42361
42398
  }
42362
42399
 
42363
- const processed = processUnusedDirectives(unusedDisableDirectivesToReport)
42364
- .concat(processUnusedDirectives(unusedEnableDirectivesToReport));
42400
+ const processed = processUnusedDirectives(unusedDisableDirectivesToReport, sourceCode)
42401
+ .concat(processUnusedDirectives(unusedEnableDirectivesToReport, sourceCode));
42365
42402
  const columnOffset = options.language.columnStart === 1 ? 0 : 1;
42366
42403
  const lineOffset = options.language.lineStart === 1 ? 0 : 1;
42367
42404
 
@@ -42380,11 +42417,14 @@ function requireApplyDisableDirectives () {
42380
42417
  ? `Unused eslint-disable directive (no problems were reported from ${description}).`
42381
42418
  : "Unused eslint-disable directive (no problems were reported).";
42382
42419
  }
42420
+
42421
+ const loc = sourceCode.getLoc(parentDirective.node);
42422
+
42383
42423
  return {
42384
42424
  ruleId: null,
42385
42425
  message,
42386
- line: type === "disable-next-line" ? parentDirective.node.loc.start.line + lineOffset : line,
42387
- column: type === "disable-next-line" ? parentDirective.node.loc.start.column + columnOffset : column,
42426
+ line: type === "disable-next-line" ? loc.start.line + lineOffset : line,
42427
+ column: type === "disable-next-line" ? loc.start.column + columnOffset : column,
42388
42428
  severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
42389
42429
  nodeType: null,
42390
42430
  ...options.disableFixes ? {} : { fix }
@@ -42399,6 +42439,7 @@ function requireApplyDisableDirectives () {
42399
42439
  * of reported problems, adds the suppression information to the problems.
42400
42440
  * @param {Object} options Information about directives and problems
42401
42441
  * @param {Language} options.language The language being linted.
42442
+ * @param {SourceCode} options.sourceCode The source code object for the file being linted.
42402
42443
  * @param {{
42403
42444
  * type: ("disable"|"enable"|"disable-line"|"disable-next-line"),
42404
42445
  * ruleId: (string|null),
@@ -42417,7 +42458,7 @@ function requireApplyDisableDirectives () {
42417
42458
  * @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]}
42418
42459
  * An object with a list of reported problems, the suppressed of which contain the suppression information.
42419
42460
  */
42420
- applyDisableDirectives = ({ language, directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
42461
+ applyDisableDirectives = ({ language, sourceCode, directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
42421
42462
  const blockDirectives = directives
42422
42463
  .filter(directive => directive.type === "disable" || directive.type === "enable")
42423
42464
  .map(directive => Object.assign({}, directive, { unprocessedDirective: directive }))
@@ -42467,6 +42508,7 @@ function requireApplyDisableDirectives () {
42467
42508
 
42468
42509
  const blockDirectivesResult = applyDirectives({
42469
42510
  language,
42511
+ sourceCode,
42470
42512
  problems,
42471
42513
  directives: blockDirectives,
42472
42514
  disableFixes,
@@ -42475,6 +42517,7 @@ function requireApplyDisableDirectives () {
42475
42517
  });
42476
42518
  const lineDirectivesResult = applyDirectives({
42477
42519
  language,
42520
+ sourceCode,
42478
42521
  problems: blockDirectivesResult.problems,
42479
42522
  directives: lineDirectives,
42480
42523
  disableFixes,
@@ -42859,13 +42902,15 @@ function requireNodeEventGenerator () {
42859
42902
  * @author Nicholas C. Zakas
42860
42903
  */
42861
42904
 
42862
- var ruleFixer_1;
42905
+ var ruleFixer;
42863
42906
  var hasRequiredRuleFixer;
42864
42907
 
42865
42908
  function requireRuleFixer () {
42866
- if (hasRequiredRuleFixer) return ruleFixer_1;
42909
+ if (hasRequiredRuleFixer) return ruleFixer;
42867
42910
  hasRequiredRuleFixer = 1;
42868
42911
 
42912
+ /* eslint class-methods-use-this: off -- Methods desired on instance */
42913
+
42869
42914
  //------------------------------------------------------------------------------
42870
42915
  // Requirements
42871
42916
  //------------------------------------------------------------------------------
@@ -42897,8 +42942,22 @@ function requireRuleFixer () {
42897
42942
  /**
42898
42943
  * Creates code fixing commands for rules.
42899
42944
  */
42945
+ class RuleFixer {
42900
42946
 
42901
- const ruleFixer = Object.freeze({
42947
+ /**
42948
+ * The source code object representing the text to be fixed.
42949
+ * @type {SourceCode}
42950
+ */
42951
+ #sourceCode;
42952
+
42953
+ /**
42954
+ * Creates a new instance.
42955
+ * @param {Object} options The options for the fixer.
42956
+ * @param {SourceCode} options.sourceCode The source code object representing the text to be fixed.
42957
+ */
42958
+ constructor({ sourceCode }) {
42959
+ this.#sourceCode = sourceCode;
42960
+ }
42902
42961
 
42903
42962
  /**
42904
42963
  * Creates a fix command that inserts text after the given node or token.
@@ -42908,8 +42967,10 @@ function requireRuleFixer () {
42908
42967
  * @returns {Object} The fix command.
42909
42968
  */
42910
42969
  insertTextAfter(nodeOrToken, text) {
42911
- return this.insertTextAfterRange(nodeOrToken.range, text);
42912
- },
42970
+ const range = this.#sourceCode.getRange(nodeOrToken);
42971
+
42972
+ return this.insertTextAfterRange(range, text);
42973
+ }
42913
42974
 
42914
42975
  /**
42915
42976
  * Creates a fix command that inserts text after the specified range in the source text.
@@ -42921,7 +42982,7 @@ function requireRuleFixer () {
42921
42982
  */
42922
42983
  insertTextAfterRange(range, text) {
42923
42984
  return insertTextAt(range[1], text);
42924
- },
42985
+ }
42925
42986
 
42926
42987
  /**
42927
42988
  * Creates a fix command that inserts text before the given node or token.
@@ -42931,8 +42992,10 @@ function requireRuleFixer () {
42931
42992
  * @returns {Object} The fix command.
42932
42993
  */
42933
42994
  insertTextBefore(nodeOrToken, text) {
42934
- return this.insertTextBeforeRange(nodeOrToken.range, text);
42935
- },
42995
+ const range = this.#sourceCode.getRange(nodeOrToken);
42996
+
42997
+ return this.insertTextBeforeRange(range, text);
42998
+ }
42936
42999
 
42937
43000
  /**
42938
43001
  * Creates a fix command that inserts text before the specified range in the source text.
@@ -42944,7 +43007,7 @@ function requireRuleFixer () {
42944
43007
  */
42945
43008
  insertTextBeforeRange(range, text) {
42946
43009
  return insertTextAt(range[0], text);
42947
- },
43010
+ }
42948
43011
 
42949
43012
  /**
42950
43013
  * Creates a fix command that replaces text at the node or token.
@@ -42954,8 +43017,10 @@ function requireRuleFixer () {
42954
43017
  * @returns {Object} The fix command.
42955
43018
  */
42956
43019
  replaceText(nodeOrToken, text) {
42957
- return this.replaceTextRange(nodeOrToken.range, text);
42958
- },
43020
+ const range = this.#sourceCode.getRange(nodeOrToken);
43021
+
43022
+ return this.replaceTextRange(range, text);
43023
+ }
42959
43024
 
42960
43025
  /**
42961
43026
  * Creates a fix command that replaces text at the specified range in the source text.
@@ -42970,7 +43035,7 @@ function requireRuleFixer () {
42970
43035
  range,
42971
43036
  text
42972
43037
  };
42973
- },
43038
+ }
42974
43039
 
42975
43040
  /**
42976
43041
  * Creates a fix command that removes the node or token from the source.
@@ -42979,8 +43044,10 @@ function requireRuleFixer () {
42979
43044
  * @returns {Object} The fix command.
42980
43045
  */
42981
43046
  remove(nodeOrToken) {
42982
- return this.removeRange(nodeOrToken.range);
42983
- },
43047
+ const range = this.#sourceCode.getRange(nodeOrToken);
43048
+
43049
+ return this.removeRange(range);
43050
+ }
42984
43051
 
42985
43052
  /**
42986
43053
  * Creates a fix command that removes the specified range of text from the source.
@@ -42995,12 +43062,11 @@ function requireRuleFixer () {
42995
43062
  text: ""
42996
43063
  };
42997
43064
  }
42998
-
42999
- });
43065
+ }
43000
43066
 
43001
43067
 
43002
- ruleFixer_1 = ruleFixer;
43003
- return ruleFixer_1;
43068
+ ruleFixer = { RuleFixer };
43069
+ return ruleFixer;
43004
43070
  }
43005
43071
 
43006
43072
  /**
@@ -43078,7 +43144,7 @@ function requireReportTranslator () {
43078
43144
  //------------------------------------------------------------------------------
43079
43145
 
43080
43146
  const assert = require$$0$2;
43081
- const ruleFixer = requireRuleFixer();
43147
+ const { RuleFixer } = requireRuleFixer();
43082
43148
  const { interpolate } = requireInterpolate();
43083
43149
 
43084
43150
  //------------------------------------------------------------------------------
@@ -43159,13 +43225,10 @@ function requireReportTranslator () {
43159
43225
  * from the `node` of the original descriptor, or infers the `start` from the `loc` of the original descriptor.
43160
43226
  */
43161
43227
  function normalizeReportLoc(descriptor) {
43162
- if (descriptor.loc) {
43163
- if (descriptor.loc.start) {
43164
- return descriptor.loc;
43165
- }
43166
- return { start: descriptor.loc, end: null };
43228
+ if (descriptor.loc.start) {
43229
+ return descriptor.loc;
43167
43230
  }
43168
- return descriptor.node.loc;
43231
+ return { start: descriptor.loc, end: null };
43169
43232
  }
43170
43233
 
43171
43234
  /**
@@ -43258,6 +43321,8 @@ function requireReportTranslator () {
43258
43321
  return null;
43259
43322
  }
43260
43323
 
43324
+ const ruleFixer = new RuleFixer({ sourceCode });
43325
+
43261
43326
  // @type {null | Fix | Fix[] | IterableIterator<Fix>}
43262
43327
  const fix = descriptor.fix(ruleFixer);
43263
43328
 
@@ -43403,6 +43468,7 @@ function requireReportTranslator () {
43403
43468
  return (...args) => {
43404
43469
  const descriptor = normalizeMultiArgReportCall(...args);
43405
43470
  const messages = metadata.messageIds;
43471
+ const { sourceCode } = metadata;
43406
43472
 
43407
43473
  assertValidNodeInfo(descriptor);
43408
43474
 
@@ -43435,9 +43501,9 @@ function requireReportTranslator () {
43435
43501
  node: descriptor.node,
43436
43502
  message: interpolate(computedMessage, descriptor.data),
43437
43503
  messageId: descriptor.messageId,
43438
- loc: normalizeReportLoc(descriptor),
43439
- fix: metadata.disableFixes ? null : normalizeFixes(descriptor, metadata.sourceCode),
43440
- suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, metadata.sourceCode, messages),
43504
+ loc: descriptor.loc ? normalizeReportLoc(descriptor) : sourceCode.getLoc(descriptor.node),
43505
+ fix: metadata.disableFixes ? null : normalizeFixes(descriptor, sourceCode),
43506
+ suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, sourceCode, messages),
43441
43507
  language: metadata.language
43442
43508
  });
43443
43509
  };
@@ -45160,11 +45226,12 @@ function requireAstUtils () {
45160
45226
 
45161
45227
  /**
45162
45228
  * Determines whether an opening parenthesis `(`, bracket `[` or backtick ``` ` ``` needs to be preceded by a semicolon.
45163
- * This opening parenthesis or bracket should be at the start of an `ExpressionStatement` or at the start of the body of an `ArrowFunctionExpression`.
45229
+ * This opening parenthesis or bracket should be at the start of an `ExpressionStatement`, a `MethodDefinition` or at
45230
+ * the start of the body of an `ArrowFunctionExpression`.
45164
45231
  * @type {(sourceCode: SourceCode, node: ASTNode) => boolean}
45165
45232
  * @param {SourceCode} sourceCode The source code object.
45166
45233
  * @param {ASTNode} node A node at the position where an opening parenthesis or bracket will be inserted.
45167
- * @returns {boolean} Whether a semicolon is required before the opening parenthesis or braket.
45234
+ * @returns {boolean} Whether a semicolon is required before the opening parenthesis or bracket.
45168
45235
  */
45169
45236
  let needsPrecedingSemicolon;
45170
45237
 
@@ -45224,7 +45291,7 @@ function requireAstUtils () {
45224
45291
 
45225
45292
  if (isClosingBraceToken(prevToken)) {
45226
45293
  return (
45227
- prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" ||
45294
+ prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" && prevNode.parent.parent.type !== "MethodDefinition" ||
45228
45295
  prevNode.type === "ClassBody" && prevNode.parent.type === "ClassExpression" ||
45229
45296
  prevNode.type === "ObjectExpression"
45230
45297
  );
@@ -105713,8 +105780,11 @@ function requireRequireAwait () {
105713
105780
  schema: [],
105714
105781
 
105715
105782
  messages: {
105716
- missingAwait: "{{name}} has no 'await' expression."
105717
- }
105783
+ missingAwait: "{{name}} has no 'await' expression.",
105784
+ removeAsync: "Remove 'async'."
105785
+ },
105786
+
105787
+ hasSuggestions: true
105718
105788
  },
105719
105789
 
105720
105790
  create(context) {
@@ -105740,6 +105810,33 @@ function requireRequireAwait () {
105740
105810
  */
105741
105811
  function exitFunction(node) {
105742
105812
  if (!node.generator && node.async && !scopeInfo.hasAwait && !astUtils.isEmptyFunction(node)) {
105813
+
105814
+ /*
105815
+ * If the function belongs to a method definition or
105816
+ * property, then the function's range may not include the
105817
+ * `async` keyword and we should look at the parent instead.
105818
+ */
105819
+ const nodeWithAsyncKeyword =
105820
+ (node.parent.type === "MethodDefinition" && node.parent.value === node) ||
105821
+ (node.parent.type === "Property" && node.parent.method && node.parent.value === node)
105822
+ ? node.parent
105823
+ : node;
105824
+
105825
+ const asyncToken = sourceCode.getFirstToken(nodeWithAsyncKeyword, token => token.value === "async");
105826
+ const asyncRange = [asyncToken.range[0], sourceCode.getTokenAfter(asyncToken, { includeComments: true }).range[0]];
105827
+
105828
+ /*
105829
+ * Removing the `async` keyword can cause parsing errors if the current
105830
+ * statement is relying on automatic semicolon insertion. If ASI is currently
105831
+ * being used, then we should replace the `async` keyword with a semicolon.
105832
+ */
105833
+ const nextToken = sourceCode.getTokenAfter(asyncToken);
105834
+ const addSemiColon =
105835
+ nextToken.type === "Punctuator" &&
105836
+ (nextToken.value === "[" || nextToken.value === "(") &&
105837
+ (nodeWithAsyncKeyword.type === "MethodDefinition" || astUtils.isStartOfExpressionStatement(nodeWithAsyncKeyword)) &&
105838
+ astUtils.needsPrecedingSemicolon(sourceCode, nodeWithAsyncKeyword);
105839
+
105743
105840
  context.report({
105744
105841
  node,
105745
105842
  loc: astUtils.getFunctionHeadLoc(node, sourceCode),
@@ -105748,7 +105845,11 @@ function requireRequireAwait () {
105748
105845
  name: capitalizeFirstLetter(
105749
105846
  astUtils.getFunctionNameWithKind(node)
105750
105847
  )
105751
- }
105848
+ },
105849
+ suggest: [{
105850
+ messageId: "removeAsync",
105851
+ fix: fixer => fixer.replaceTextRange(asyncRange, addSemiColon ? ";" : "")
105852
+ }]
105752
105853
  });
105753
105854
  }
105754
105855
 
@@ -115311,6 +115412,11 @@ function requireCjs () {
115311
115412
  .relative(this.basePath, directoryPath)
115312
115413
  .replace(/\\/gu, "/");
115313
115414
 
115415
+ // basePath directory can never be ignored
115416
+ if (relativeDirectoryPath === "") {
115417
+ return false;
115418
+ }
115419
+
115314
115420
  if (relativeDirectoryPath.startsWith("..")) {
115315
115421
  return true;
115316
115422
  }
@@ -117463,7 +117569,8 @@ function requireFlags () {
117463
117569
  * @type {Map<string, string>}
117464
117570
  */
117465
117571
  const activeFlags = new Map([
117466
- ["test_only", "This flag is only used for testing."]
117572
+ ["test_only", "Used only for testing."],
117573
+ ["unstable_ts_config", "Enable TypeScript configuration files."]
117467
117574
  ]);
117468
117575
 
117469
117576
  /**
@@ -117471,7 +117578,7 @@ function requireFlags () {
117471
117578
  * @type {Map<string, string>}
117472
117579
  */
117473
117580
  const inactiveFlags = new Map([
117474
- ["test_only_old", "This flag is no longer used for testing."]
117581
+ ["test_only_old", "Used only for testing."]
117475
117582
  ]);
117476
117583
 
117477
117584
  flags = {
@@ -117646,7 +117753,7 @@ function requireLinter () {
117646
117753
  const { assertIsRuleSeverity } = requireFlatConfigSchema();
117647
117754
  const { normalizeSeverityToString } = requireSeverity();
117648
117755
  const jslang = requireJs();
117649
- const { activeFlags } = requireFlags();
117756
+ const { activeFlags, inactiveFlags } = requireFlags();
117650
117757
  const debug = requireSrc()("eslint:linter");
117651
117758
  const MAX_AUTOFIX_PASSES = 10;
117652
117759
  const DEFAULT_PARSER_NAME = "espree";
@@ -117924,9 +118031,10 @@ function requireLinter () {
117924
118031
  * @param {ASTNode|token} options.node The Comment node/token.
117925
118032
  * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
117926
118033
  * @param {Language} language The language to use to adjust the location information.
118034
+ * @param {SourceCode} sourceCode The SourceCode object to get comments from.
117927
118035
  * @returns {Object} Directives and problems from the comment
117928
118036
  */
117929
- function createDisableDirectives({ type, value, justification, node }, ruleMapper, language) {
118037
+ function createDisableDirectives({ type, value, justification, node }, ruleMapper, language, sourceCode) {
117930
118038
  const ruleIds = Object.keys(commentParser.parseListConfig(value));
117931
118039
  const directiveRules = ruleIds.length ? ruleIds : [null];
117932
118040
  const result = {
@@ -117937,11 +118045,15 @@ function requireLinter () {
117937
118045
 
117938
118046
  for (const ruleId of directiveRules) {
117939
118047
 
118048
+ const loc = sourceCode.getLoc(node);
118049
+
117940
118050
  // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/)
117941
118051
  if (ruleId === null || !!ruleMapper(ruleId)) {
118052
+
118053
+
117942
118054
  if (type === "disable-next-line") {
117943
118055
  const { line, column } = updateLocationInformation(
117944
- node.loc.end,
118056
+ loc.end,
117945
118057
  language
117946
118058
  );
117947
118059
 
@@ -117955,7 +118067,7 @@ function requireLinter () {
117955
118067
  });
117956
118068
  } else {
117957
118069
  const { line, column } = updateLocationInformation(
117958
- node.loc.start,
118070
+ loc.start,
117959
118071
  language
117960
118072
  );
117961
118073
 
@@ -117969,7 +118081,7 @@ function requireLinter () {
117969
118081
  });
117970
118082
  }
117971
118083
  } else {
117972
- result.directiveProblems.push(createLintingProblem({ ruleId, loc: node.loc, language }));
118084
+ result.directiveProblems.push(createLintingProblem({ ruleId, loc, language }));
117973
118085
  }
117974
118086
  }
117975
118087
  return result;
@@ -118011,25 +118123,27 @@ function requireLinter () {
118011
118123
  return;
118012
118124
  }
118013
118125
 
118126
+ const loc = sourceCode.getLoc(comment);
118127
+
118014
118128
  if (warnInlineConfig) {
118015
118129
  const kind = comment.type === "Block" ? `/*${directiveText}*/` : `//${directiveText}`;
118016
118130
 
118017
118131
  problems.push(createLintingProblem({
118018
118132
  ruleId: null,
118019
118133
  message: `'${kind}' has no effect because you have 'noInlineConfig' setting in ${warnInlineConfig}.`,
118020
- loc: comment.loc,
118134
+ loc,
118021
118135
  severity: 1
118022
118136
  }));
118023
118137
  return;
118024
118138
  }
118025
118139
 
118026
- if (directiveText === "eslint-disable-line" && comment.loc.start.line !== comment.loc.end.line) {
118140
+ if (directiveText === "eslint-disable-line" && loc.start.line !== loc.end.line) {
118027
118141
  const message = `${directiveText} comment should not span multiple lines.`;
118028
118142
 
118029
118143
  problems.push(createLintingProblem({
118030
118144
  ruleId: null,
118031
118145
  message,
118032
- loc: comment.loc
118146
+ loc
118033
118147
  }));
118034
118148
  return;
118035
118149
  }
@@ -118047,7 +118161,7 @@ function requireLinter () {
118047
118161
  value: directiveValue,
118048
118162
  justification: justificationPart,
118049
118163
  node: comment
118050
- }, ruleMapper, jslang);
118164
+ }, ruleMapper, jslang, sourceCode);
118051
118165
 
118052
118166
  disableDirectives.push(...directives);
118053
118167
  problems.push(...directiveProblems);
@@ -118068,7 +118182,7 @@ function requireLinter () {
118068
118182
  } catch (err) {
118069
118183
  problems.push(createLintingProblem({
118070
118184
  ruleId: null,
118071
- loc: comment.loc,
118185
+ loc,
118072
118186
  message: err.message
118073
118187
  }));
118074
118188
  continue;
@@ -118095,14 +118209,14 @@ function requireLinter () {
118095
118209
  const ruleValue = parseResult.config[name];
118096
118210
 
118097
118211
  if (!rule) {
118098
- problems.push(createLintingProblem({ ruleId: name, loc: comment.loc }));
118212
+ problems.push(createLintingProblem({ ruleId: name, loc }));
118099
118213
  return;
118100
118214
  }
118101
118215
 
118102
118216
  if (Object.hasOwn(configuredRules, name)) {
118103
118217
  problems.push(createLintingProblem({
118104
118218
  message: `Rule "${name}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`,
118105
- loc: comment.loc
118219
+ loc
118106
118220
  }));
118107
118221
  return;
118108
118222
  }
@@ -118164,7 +118278,7 @@ function requireLinter () {
118164
118278
  problems.push(createLintingProblem({
118165
118279
  ruleId: name,
118166
118280
  message: err.message,
118167
- loc: comment.loc
118281
+ loc
118168
118282
  }));
118169
118283
 
118170
118284
  // do not apply the config, if found invalid options.
@@ -118176,7 +118290,7 @@ function requireLinter () {
118176
118290
  } else {
118177
118291
  const problem = createLintingProblem({
118178
118292
  ruleId: null,
118179
- loc: comment.loc,
118293
+ loc,
118180
118294
  message: parseResult.error.message
118181
118295
  });
118182
118296
 
@@ -118224,7 +118338,7 @@ function requireLinter () {
118224
118338
  })));
118225
118339
 
118226
118340
  directivesSources.forEach(directive => {
118227
- const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper, language);
118341
+ const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper, language, sourceCode);
118228
118342
 
118229
118343
  disableDirectives.push(...directives);
118230
118344
  problems.push(...directiveProblems);
@@ -118883,9 +118997,20 @@ function requireLinter () {
118883
118997
  * @param {"flat"|"eslintrc"} [config.configType="flat"] the type of config used.
118884
118998
  */
118885
118999
  constructor({ cwd, configType = "flat", flags = [] } = {}) {
119000
+
119001
+ flags.forEach(flag => {
119002
+ if (inactiveFlags.has(flag)) {
119003
+ throw new Error(`The flag '${flag}' is inactive: ${inactiveFlags.get(flag)}`);
119004
+ }
119005
+
119006
+ if (!activeFlags.has(flag)) {
119007
+ throw new Error(`Unknown flag '${flag}'.`);
119008
+ }
119009
+ });
119010
+
118886
119011
  internalSlotsMap.set(this, {
118887
119012
  cwd: normalizeCwd(cwd),
118888
- flags: flags.filter(flag => activeFlags.has(flag)),
119013
+ flags,
118889
119014
  lastConfigArray: null,
118890
119015
  lastSourceCode: null,
118891
119016
  lastSuppressedMessages: [],
@@ -119063,7 +119188,7 @@ function requireLinter () {
119063
119188
  debug("An error occurred while traversing");
119064
119189
  debug("Filename:", options.filename);
119065
119190
  if (err.currentNode) {
119066
- const { line } = err.currentNode.loc.start;
119191
+ const { line } = sourceCode.getLoc(err.currentNode).start;
119067
119192
 
119068
119193
  debug("Line:", line);
119069
119194
  err.message += `:${line}`;
@@ -119081,6 +119206,7 @@ function requireLinter () {
119081
119206
 
119082
119207
  return applyDisableDirectives({
119083
119208
  language: jslang,
119209
+ sourceCode,
119084
119210
  directives: commentDirectives.disableDirectives,
119085
119211
  disableFixes: options.disableFixes,
119086
119212
  problems: lintingProblems
@@ -119360,10 +119486,14 @@ function requireLinter () {
119360
119486
  if (options.warnInlineConfig) {
119361
119487
  if (sourceCode.getInlineConfigNodes) {
119362
119488
  sourceCode.getInlineConfigNodes().forEach(node => {
119489
+
119490
+ const loc = sourceCode.getLoc(node);
119491
+ const range = sourceCode.getRange(node);
119492
+
119363
119493
  inlineConfigProblems.push(createLintingProblem({
119364
119494
  ruleId: null,
119365
- message: `'${sourceCode.text.slice(node.range[0], node.range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`,
119366
- loc: node.loc,
119495
+ message: `'${sourceCode.text.slice(range[0], range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`,
119496
+ loc,
119367
119497
  severity: 1,
119368
119498
  language: config.language
119369
119499
  }));
@@ -119543,7 +119673,7 @@ function requireLinter () {
119543
119673
  debug("An error occurred while traversing");
119544
119674
  debug("Filename:", options.filename);
119545
119675
  if (err.currentNode) {
119546
- const { line } = err.currentNode.loc.start;
119676
+ const { line } = sourceCode.getLoc(err.currentNode).start;
119547
119677
 
119548
119678
  debug("Line:", line);
119549
119679
  err.message += `:${line}`;
@@ -119562,6 +119692,7 @@ function requireLinter () {
119562
119692
 
119563
119693
  return applyDisableDirectives({
119564
119694
  language: config.language,
119695
+ sourceCode,
119565
119696
  directives: commentDirectives.disableDirectives,
119566
119697
  disableFixes: options.disableFixes,
119567
119698
  problems: lintingProblems