eslint-linter-browserify 9.7.0 → 9.8.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.8.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.8.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,7 +17591,8 @@ 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.2.0",
17595
+ "@eslint/json": "^0.2.0",
17595
17596
  "@types/estree": "^1.0.5",
17596
17597
  "@types/node": "^20.11.5",
17597
17598
  "@wdio/browser-runner": "^8.38.3",
@@ -41563,6 +41564,25 @@ function requireSourceCode$1 () {
41563
41564
 
41564
41565
  return ancestorsStartingAtParent.reverse();
41565
41566
  }
41567
+
41568
+ /**
41569
+ * Returns the locatin of the given node or token.
41570
+ * @param {ASTNode|Token} nodeOrToken The node or token to get the location of.
41571
+ * @returns {SourceLocation} The location of the node or token.
41572
+ */
41573
+ getLoc(nodeOrToken) {
41574
+ return nodeOrToken.loc;
41575
+ }
41576
+
41577
+ /**
41578
+ * Returns the range of the given node or token.
41579
+ * @param {ASTNode|Token} nodeOrToken The node or token to get the range of.
41580
+ * @returns {[number, number]} The range of the node or token.
41581
+ */
41582
+ getRange(nodeOrToken) {
41583
+ return nodeOrToken.range;
41584
+ }
41585
+
41566
41586
  /* eslint-enable class-methods-use-this -- node is owned by SourceCode */
41567
41587
 
41568
41588
  /**
@@ -42051,15 +42071,18 @@ function requireApplyDisableDirectives () {
42051
42071
  * Creates removal details for a set of directives within the same comment.
42052
42072
  * @param {Directive[]} directives Unused directives to be removed.
42053
42073
  * @param {Token} node The backing Comment token.
42074
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
42054
42075
  * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
42055
42076
  */
42056
- function createIndividualDirectivesRemoval(directives, node) {
42077
+ function createIndividualDirectivesRemoval(directives, node, sourceCode) {
42078
+
42079
+ const range = sourceCode.getRange(node);
42057
42080
 
42058
42081
  /*
42059
42082
  * `node.value` starts right after `//` or `/*`.
42060
42083
  * All calculated offsets will be relative to this index.
42061
42084
  */
42062
- const commentValueStart = node.range[0] + "//".length;
42085
+ const commentValueStart = range[0] + "//".length;
42063
42086
 
42064
42087
  // Find where the list of rules starts. `\S+` matches with the directive name (e.g. `eslint-disable-line`)
42065
42088
  const listStartOffset = /^\s*\S+\s+/u.exec(node.value)[0].length;
@@ -42155,10 +42178,11 @@ function requireApplyDisableDirectives () {
42155
42178
  * Creates a description of deleting an entire unused disable directive.
42156
42179
  * @param {Directive[]} directives Unused directives to be removed.
42157
42180
  * @param {Token} node The backing Comment token.
42181
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
42158
42182
  * @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output problem.
42159
42183
  */
42160
- function createDirectiveRemoval(directives, node) {
42161
- const { range } = node;
42184
+ function createDirectiveRemoval(directives, node, sourceCode) {
42185
+ const range = sourceCode.getRange(node);
42162
42186
  const ruleIds = directives.filter(directive => directive.ruleId).map(directive => `'${directive.ruleId}'`);
42163
42187
 
42164
42188
  return {
@@ -42176,9 +42200,10 @@ function requireApplyDisableDirectives () {
42176
42200
  /**
42177
42201
  * Parses details from directives to create output Problems.
42178
42202
  * @param {Iterable<Directive>} allDirectives Unused directives to be removed.
42203
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
42179
42204
  * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
42180
42205
  */
42181
- function processUnusedDirectives(allDirectives) {
42206
+ function processUnusedDirectives(allDirectives, sourceCode) {
42182
42207
  const directiveGroups = groupByParentDirective(allDirectives);
42183
42208
 
42184
42209
  return directiveGroups.flatMap(
@@ -42191,8 +42216,8 @@ function requireApplyDisableDirectives () {
42191
42216
  }
42192
42217
 
42193
42218
  return remainingRuleIds.size
42194
- ? createIndividualDirectivesRemoval(directives, parentDirective.node)
42195
- : [createDirectiveRemoval(directives, parentDirective.node)];
42219
+ ? createIndividualDirectivesRemoval(directives, parentDirective.node, sourceCode)
42220
+ : [createDirectiveRemoval(directives, parentDirective.node, sourceCode)];
42196
42221
  }
42197
42222
  );
42198
42223
  }
@@ -42299,6 +42324,7 @@ function requireApplyDisableDirectives () {
42299
42324
  function applyDirectives(options) {
42300
42325
  const problems = [];
42301
42326
  const usedDisableDirectives = new Set();
42327
+ const { sourceCode } = options;
42302
42328
 
42303
42329
  for (const problem of options.problems) {
42304
42330
  let disableDirectivesForProblem = [];
@@ -42360,8 +42386,8 @@ function requireApplyDisableDirectives () {
42360
42386
  }
42361
42387
  }
42362
42388
 
42363
- const processed = processUnusedDirectives(unusedDisableDirectivesToReport)
42364
- .concat(processUnusedDirectives(unusedEnableDirectivesToReport));
42389
+ const processed = processUnusedDirectives(unusedDisableDirectivesToReport, sourceCode)
42390
+ .concat(processUnusedDirectives(unusedEnableDirectivesToReport, sourceCode));
42365
42391
  const columnOffset = options.language.columnStart === 1 ? 0 : 1;
42366
42392
  const lineOffset = options.language.lineStart === 1 ? 0 : 1;
42367
42393
 
@@ -42380,11 +42406,14 @@ function requireApplyDisableDirectives () {
42380
42406
  ? `Unused eslint-disable directive (no problems were reported from ${description}).`
42381
42407
  : "Unused eslint-disable directive (no problems were reported).";
42382
42408
  }
42409
+
42410
+ const loc = sourceCode.getLoc(parentDirective.node);
42411
+
42383
42412
  return {
42384
42413
  ruleId: null,
42385
42414
  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,
42415
+ line: type === "disable-next-line" ? loc.start.line + lineOffset : line,
42416
+ column: type === "disable-next-line" ? loc.start.column + columnOffset : column,
42388
42417
  severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
42389
42418
  nodeType: null,
42390
42419
  ...options.disableFixes ? {} : { fix }
@@ -42399,6 +42428,7 @@ function requireApplyDisableDirectives () {
42399
42428
  * of reported problems, adds the suppression information to the problems.
42400
42429
  * @param {Object} options Information about directives and problems
42401
42430
  * @param {Language} options.language The language being linted.
42431
+ * @param {SourceCode} options.sourceCode The source code object for the file being linted.
42402
42432
  * @param {{
42403
42433
  * type: ("disable"|"enable"|"disable-line"|"disable-next-line"),
42404
42434
  * ruleId: (string|null),
@@ -42417,7 +42447,7 @@ function requireApplyDisableDirectives () {
42417
42447
  * @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]}
42418
42448
  * An object with a list of reported problems, the suppressed of which contain the suppression information.
42419
42449
  */
42420
- applyDisableDirectives = ({ language, directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
42450
+ applyDisableDirectives = ({ language, sourceCode, directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
42421
42451
  const blockDirectives = directives
42422
42452
  .filter(directive => directive.type === "disable" || directive.type === "enable")
42423
42453
  .map(directive => Object.assign({}, directive, { unprocessedDirective: directive }))
@@ -42467,6 +42497,7 @@ function requireApplyDisableDirectives () {
42467
42497
 
42468
42498
  const blockDirectivesResult = applyDirectives({
42469
42499
  language,
42500
+ sourceCode,
42470
42501
  problems,
42471
42502
  directives: blockDirectives,
42472
42503
  disableFixes,
@@ -42475,6 +42506,7 @@ function requireApplyDisableDirectives () {
42475
42506
  });
42476
42507
  const lineDirectivesResult = applyDirectives({
42477
42508
  language,
42509
+ sourceCode,
42478
42510
  problems: blockDirectivesResult.problems,
42479
42511
  directives: lineDirectives,
42480
42512
  disableFixes,
@@ -42859,13 +42891,15 @@ function requireNodeEventGenerator () {
42859
42891
  * @author Nicholas C. Zakas
42860
42892
  */
42861
42893
 
42862
- var ruleFixer_1;
42894
+ var ruleFixer;
42863
42895
  var hasRequiredRuleFixer;
42864
42896
 
42865
42897
  function requireRuleFixer () {
42866
- if (hasRequiredRuleFixer) return ruleFixer_1;
42898
+ if (hasRequiredRuleFixer) return ruleFixer;
42867
42899
  hasRequiredRuleFixer = 1;
42868
42900
 
42901
+ /* eslint class-methods-use-this: off -- Methods desired on instance */
42902
+
42869
42903
  //------------------------------------------------------------------------------
42870
42904
  // Requirements
42871
42905
  //------------------------------------------------------------------------------
@@ -42897,8 +42931,22 @@ function requireRuleFixer () {
42897
42931
  /**
42898
42932
  * Creates code fixing commands for rules.
42899
42933
  */
42934
+ class RuleFixer {
42900
42935
 
42901
- const ruleFixer = Object.freeze({
42936
+ /**
42937
+ * The source code object representing the text to be fixed.
42938
+ * @type {SourceCode}
42939
+ */
42940
+ #sourceCode;
42941
+
42942
+ /**
42943
+ * Creates a new instance.
42944
+ * @param {Object} options The options for the fixer.
42945
+ * @param {SourceCode} options.sourceCode The source code object representing the text to be fixed.
42946
+ */
42947
+ constructor({ sourceCode }) {
42948
+ this.#sourceCode = sourceCode;
42949
+ }
42902
42950
 
42903
42951
  /**
42904
42952
  * Creates a fix command that inserts text after the given node or token.
@@ -42908,8 +42956,10 @@ function requireRuleFixer () {
42908
42956
  * @returns {Object} The fix command.
42909
42957
  */
42910
42958
  insertTextAfter(nodeOrToken, text) {
42911
- return this.insertTextAfterRange(nodeOrToken.range, text);
42912
- },
42959
+ const range = this.#sourceCode.getRange(nodeOrToken);
42960
+
42961
+ return this.insertTextAfterRange(range, text);
42962
+ }
42913
42963
 
42914
42964
  /**
42915
42965
  * Creates a fix command that inserts text after the specified range in the source text.
@@ -42921,7 +42971,7 @@ function requireRuleFixer () {
42921
42971
  */
42922
42972
  insertTextAfterRange(range, text) {
42923
42973
  return insertTextAt(range[1], text);
42924
- },
42974
+ }
42925
42975
 
42926
42976
  /**
42927
42977
  * Creates a fix command that inserts text before the given node or token.
@@ -42931,8 +42981,10 @@ function requireRuleFixer () {
42931
42981
  * @returns {Object} The fix command.
42932
42982
  */
42933
42983
  insertTextBefore(nodeOrToken, text) {
42934
- return this.insertTextBeforeRange(nodeOrToken.range, text);
42935
- },
42984
+ const range = this.#sourceCode.getRange(nodeOrToken);
42985
+
42986
+ return this.insertTextBeforeRange(range, text);
42987
+ }
42936
42988
 
42937
42989
  /**
42938
42990
  * Creates a fix command that inserts text before the specified range in the source text.
@@ -42944,7 +42996,7 @@ function requireRuleFixer () {
42944
42996
  */
42945
42997
  insertTextBeforeRange(range, text) {
42946
42998
  return insertTextAt(range[0], text);
42947
- },
42999
+ }
42948
43000
 
42949
43001
  /**
42950
43002
  * Creates a fix command that replaces text at the node or token.
@@ -42954,8 +43006,10 @@ function requireRuleFixer () {
42954
43006
  * @returns {Object} The fix command.
42955
43007
  */
42956
43008
  replaceText(nodeOrToken, text) {
42957
- return this.replaceTextRange(nodeOrToken.range, text);
42958
- },
43009
+ const range = this.#sourceCode.getRange(nodeOrToken);
43010
+
43011
+ return this.replaceTextRange(range, text);
43012
+ }
42959
43013
 
42960
43014
  /**
42961
43015
  * Creates a fix command that replaces text at the specified range in the source text.
@@ -42970,7 +43024,7 @@ function requireRuleFixer () {
42970
43024
  range,
42971
43025
  text
42972
43026
  };
42973
- },
43027
+ }
42974
43028
 
42975
43029
  /**
42976
43030
  * Creates a fix command that removes the node or token from the source.
@@ -42979,8 +43033,10 @@ function requireRuleFixer () {
42979
43033
  * @returns {Object} The fix command.
42980
43034
  */
42981
43035
  remove(nodeOrToken) {
42982
- return this.removeRange(nodeOrToken.range);
42983
- },
43036
+ const range = this.#sourceCode.getRange(nodeOrToken);
43037
+
43038
+ return this.removeRange(range);
43039
+ }
42984
43040
 
42985
43041
  /**
42986
43042
  * Creates a fix command that removes the specified range of text from the source.
@@ -42995,12 +43051,11 @@ function requireRuleFixer () {
42995
43051
  text: ""
42996
43052
  };
42997
43053
  }
42998
-
42999
- });
43054
+ }
43000
43055
 
43001
43056
 
43002
- ruleFixer_1 = ruleFixer;
43003
- return ruleFixer_1;
43057
+ ruleFixer = { RuleFixer };
43058
+ return ruleFixer;
43004
43059
  }
43005
43060
 
43006
43061
  /**
@@ -43078,7 +43133,7 @@ function requireReportTranslator () {
43078
43133
  //------------------------------------------------------------------------------
43079
43134
 
43080
43135
  const assert = require$$0$2;
43081
- const ruleFixer = requireRuleFixer();
43136
+ const { RuleFixer } = requireRuleFixer();
43082
43137
  const { interpolate } = requireInterpolate();
43083
43138
 
43084
43139
  //------------------------------------------------------------------------------
@@ -43159,13 +43214,10 @@ function requireReportTranslator () {
43159
43214
  * from the `node` of the original descriptor, or infers the `start` from the `loc` of the original descriptor.
43160
43215
  */
43161
43216
  function normalizeReportLoc(descriptor) {
43162
- if (descriptor.loc) {
43163
- if (descriptor.loc.start) {
43164
- return descriptor.loc;
43165
- }
43166
- return { start: descriptor.loc, end: null };
43217
+ if (descriptor.loc.start) {
43218
+ return descriptor.loc;
43167
43219
  }
43168
- return descriptor.node.loc;
43220
+ return { start: descriptor.loc, end: null };
43169
43221
  }
43170
43222
 
43171
43223
  /**
@@ -43258,6 +43310,8 @@ function requireReportTranslator () {
43258
43310
  return null;
43259
43311
  }
43260
43312
 
43313
+ const ruleFixer = new RuleFixer({ sourceCode });
43314
+
43261
43315
  // @type {null | Fix | Fix[] | IterableIterator<Fix>}
43262
43316
  const fix = descriptor.fix(ruleFixer);
43263
43317
 
@@ -43403,6 +43457,7 @@ function requireReportTranslator () {
43403
43457
  return (...args) => {
43404
43458
  const descriptor = normalizeMultiArgReportCall(...args);
43405
43459
  const messages = metadata.messageIds;
43460
+ const { sourceCode } = metadata;
43406
43461
 
43407
43462
  assertValidNodeInfo(descriptor);
43408
43463
 
@@ -43435,9 +43490,9 @@ function requireReportTranslator () {
43435
43490
  node: descriptor.node,
43436
43491
  message: interpolate(computedMessage, descriptor.data),
43437
43492
  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),
43493
+ loc: descriptor.loc ? normalizeReportLoc(descriptor) : sourceCode.getLoc(descriptor.node),
43494
+ fix: metadata.disableFixes ? null : normalizeFixes(descriptor, sourceCode),
43495
+ suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, sourceCode, messages),
43441
43496
  language: metadata.language
43442
43497
  });
43443
43498
  };
@@ -115311,6 +115366,11 @@ function requireCjs () {
115311
115366
  .relative(this.basePath, directoryPath)
115312
115367
  .replace(/\\/gu, "/");
115313
115368
 
115369
+ // basePath directory can never be ignored
115370
+ if (relativeDirectoryPath === "") {
115371
+ return false;
115372
+ }
115373
+
115314
115374
  if (relativeDirectoryPath.startsWith("..")) {
115315
115375
  return true;
115316
115376
  }
@@ -117463,7 +117523,7 @@ function requireFlags () {
117463
117523
  * @type {Map<string, string>}
117464
117524
  */
117465
117525
  const activeFlags = new Map([
117466
- ["test_only", "This flag is only used for testing."]
117526
+ ["test_only", "Used only for testing."]
117467
117527
  ]);
117468
117528
 
117469
117529
  /**
@@ -117471,7 +117531,7 @@ function requireFlags () {
117471
117531
  * @type {Map<string, string>}
117472
117532
  */
117473
117533
  const inactiveFlags = new Map([
117474
- ["test_only_old", "This flag is no longer used for testing."]
117534
+ ["test_only_old", "Used only for testing."]
117475
117535
  ]);
117476
117536
 
117477
117537
  flags = {
@@ -117646,7 +117706,7 @@ function requireLinter () {
117646
117706
  const { assertIsRuleSeverity } = requireFlatConfigSchema();
117647
117707
  const { normalizeSeverityToString } = requireSeverity();
117648
117708
  const jslang = requireJs();
117649
- const { activeFlags } = requireFlags();
117709
+ const { activeFlags, inactiveFlags } = requireFlags();
117650
117710
  const debug = requireSrc()("eslint:linter");
117651
117711
  const MAX_AUTOFIX_PASSES = 10;
117652
117712
  const DEFAULT_PARSER_NAME = "espree";
@@ -117924,9 +117984,10 @@ function requireLinter () {
117924
117984
  * @param {ASTNode|token} options.node The Comment node/token.
117925
117985
  * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
117926
117986
  * @param {Language} language The language to use to adjust the location information.
117987
+ * @param {SourceCode} sourceCode The SourceCode object to get comments from.
117927
117988
  * @returns {Object} Directives and problems from the comment
117928
117989
  */
117929
- function createDisableDirectives({ type, value, justification, node }, ruleMapper, language) {
117990
+ function createDisableDirectives({ type, value, justification, node }, ruleMapper, language, sourceCode) {
117930
117991
  const ruleIds = Object.keys(commentParser.parseListConfig(value));
117931
117992
  const directiveRules = ruleIds.length ? ruleIds : [null];
117932
117993
  const result = {
@@ -117937,11 +117998,15 @@ function requireLinter () {
117937
117998
 
117938
117999
  for (const ruleId of directiveRules) {
117939
118000
 
118001
+ const loc = sourceCode.getLoc(node);
118002
+
117940
118003
  // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/)
117941
118004
  if (ruleId === null || !!ruleMapper(ruleId)) {
118005
+
118006
+
117942
118007
  if (type === "disable-next-line") {
117943
118008
  const { line, column } = updateLocationInformation(
117944
- node.loc.end,
118009
+ loc.end,
117945
118010
  language
117946
118011
  );
117947
118012
 
@@ -117955,7 +118020,7 @@ function requireLinter () {
117955
118020
  });
117956
118021
  } else {
117957
118022
  const { line, column } = updateLocationInformation(
117958
- node.loc.start,
118023
+ loc.start,
117959
118024
  language
117960
118025
  );
117961
118026
 
@@ -117969,7 +118034,7 @@ function requireLinter () {
117969
118034
  });
117970
118035
  }
117971
118036
  } else {
117972
- result.directiveProblems.push(createLintingProblem({ ruleId, loc: node.loc, language }));
118037
+ result.directiveProblems.push(createLintingProblem({ ruleId, loc, language }));
117973
118038
  }
117974
118039
  }
117975
118040
  return result;
@@ -118011,25 +118076,27 @@ function requireLinter () {
118011
118076
  return;
118012
118077
  }
118013
118078
 
118079
+ const loc = sourceCode.getLoc(comment);
118080
+
118014
118081
  if (warnInlineConfig) {
118015
118082
  const kind = comment.type === "Block" ? `/*${directiveText}*/` : `//${directiveText}`;
118016
118083
 
118017
118084
  problems.push(createLintingProblem({
118018
118085
  ruleId: null,
118019
118086
  message: `'${kind}' has no effect because you have 'noInlineConfig' setting in ${warnInlineConfig}.`,
118020
- loc: comment.loc,
118087
+ loc,
118021
118088
  severity: 1
118022
118089
  }));
118023
118090
  return;
118024
118091
  }
118025
118092
 
118026
- if (directiveText === "eslint-disable-line" && comment.loc.start.line !== comment.loc.end.line) {
118093
+ if (directiveText === "eslint-disable-line" && loc.start.line !== loc.end.line) {
118027
118094
  const message = `${directiveText} comment should not span multiple lines.`;
118028
118095
 
118029
118096
  problems.push(createLintingProblem({
118030
118097
  ruleId: null,
118031
118098
  message,
118032
- loc: comment.loc
118099
+ loc
118033
118100
  }));
118034
118101
  return;
118035
118102
  }
@@ -118047,7 +118114,7 @@ function requireLinter () {
118047
118114
  value: directiveValue,
118048
118115
  justification: justificationPart,
118049
118116
  node: comment
118050
- }, ruleMapper, jslang);
118117
+ }, ruleMapper, jslang, sourceCode);
118051
118118
 
118052
118119
  disableDirectives.push(...directives);
118053
118120
  problems.push(...directiveProblems);
@@ -118068,7 +118135,7 @@ function requireLinter () {
118068
118135
  } catch (err) {
118069
118136
  problems.push(createLintingProblem({
118070
118137
  ruleId: null,
118071
- loc: comment.loc,
118138
+ loc,
118072
118139
  message: err.message
118073
118140
  }));
118074
118141
  continue;
@@ -118095,14 +118162,14 @@ function requireLinter () {
118095
118162
  const ruleValue = parseResult.config[name];
118096
118163
 
118097
118164
  if (!rule) {
118098
- problems.push(createLintingProblem({ ruleId: name, loc: comment.loc }));
118165
+ problems.push(createLintingProblem({ ruleId: name, loc }));
118099
118166
  return;
118100
118167
  }
118101
118168
 
118102
118169
  if (Object.hasOwn(configuredRules, name)) {
118103
118170
  problems.push(createLintingProblem({
118104
118171
  message: `Rule "${name}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`,
118105
- loc: comment.loc
118172
+ loc
118106
118173
  }));
118107
118174
  return;
118108
118175
  }
@@ -118164,7 +118231,7 @@ function requireLinter () {
118164
118231
  problems.push(createLintingProblem({
118165
118232
  ruleId: name,
118166
118233
  message: err.message,
118167
- loc: comment.loc
118234
+ loc
118168
118235
  }));
118169
118236
 
118170
118237
  // do not apply the config, if found invalid options.
@@ -118176,7 +118243,7 @@ function requireLinter () {
118176
118243
  } else {
118177
118244
  const problem = createLintingProblem({
118178
118245
  ruleId: null,
118179
- loc: comment.loc,
118246
+ loc,
118180
118247
  message: parseResult.error.message
118181
118248
  });
118182
118249
 
@@ -118224,7 +118291,7 @@ function requireLinter () {
118224
118291
  })));
118225
118292
 
118226
118293
  directivesSources.forEach(directive => {
118227
- const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper, language);
118294
+ const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper, language, sourceCode);
118228
118295
 
118229
118296
  disableDirectives.push(...directives);
118230
118297
  problems.push(...directiveProblems);
@@ -118883,9 +118950,20 @@ function requireLinter () {
118883
118950
  * @param {"flat"|"eslintrc"} [config.configType="flat"] the type of config used.
118884
118951
  */
118885
118952
  constructor({ cwd, configType = "flat", flags = [] } = {}) {
118953
+
118954
+ flags.forEach(flag => {
118955
+ if (inactiveFlags.has(flag)) {
118956
+ throw new Error(`The flag '${flag}' is inactive: ${inactiveFlags.get(flag)}`);
118957
+ }
118958
+
118959
+ if (!activeFlags.has(flag)) {
118960
+ throw new Error(`Unknown flag '${flag}'.`);
118961
+ }
118962
+ });
118963
+
118886
118964
  internalSlotsMap.set(this, {
118887
118965
  cwd: normalizeCwd(cwd),
118888
- flags: flags.filter(flag => activeFlags.has(flag)),
118966
+ flags,
118889
118967
  lastConfigArray: null,
118890
118968
  lastSourceCode: null,
118891
118969
  lastSuppressedMessages: [],
@@ -119063,7 +119141,7 @@ function requireLinter () {
119063
119141
  debug("An error occurred while traversing");
119064
119142
  debug("Filename:", options.filename);
119065
119143
  if (err.currentNode) {
119066
- const { line } = err.currentNode.loc.start;
119144
+ const { line } = sourceCode.getLoc(err.currentNode).start;
119067
119145
 
119068
119146
  debug("Line:", line);
119069
119147
  err.message += `:${line}`;
@@ -119081,6 +119159,7 @@ function requireLinter () {
119081
119159
 
119082
119160
  return applyDisableDirectives({
119083
119161
  language: jslang,
119162
+ sourceCode,
119084
119163
  directives: commentDirectives.disableDirectives,
119085
119164
  disableFixes: options.disableFixes,
119086
119165
  problems: lintingProblems
@@ -119360,10 +119439,14 @@ function requireLinter () {
119360
119439
  if (options.warnInlineConfig) {
119361
119440
  if (sourceCode.getInlineConfigNodes) {
119362
119441
  sourceCode.getInlineConfigNodes().forEach(node => {
119442
+
119443
+ const loc = sourceCode.getLoc(node);
119444
+ const range = sourceCode.getRange(node);
119445
+
119363
119446
  inlineConfigProblems.push(createLintingProblem({
119364
119447
  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,
119448
+ message: `'${sourceCode.text.slice(range[0], range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`,
119449
+ loc,
119367
119450
  severity: 1,
119368
119451
  language: config.language
119369
119452
  }));
@@ -119543,7 +119626,7 @@ function requireLinter () {
119543
119626
  debug("An error occurred while traversing");
119544
119627
  debug("Filename:", options.filename);
119545
119628
  if (err.currentNode) {
119546
- const { line } = err.currentNode.loc.start;
119629
+ const { line } = sourceCode.getLoc(err.currentNode).start;
119547
119630
 
119548
119631
  debug("Line:", line);
119549
119632
  err.message += `:${line}`;
@@ -119562,6 +119645,7 @@ function requireLinter () {
119562
119645
 
119563
119646
  return applyDisableDirectives({
119564
119647
  language: config.language,
119648
+ sourceCode,
119565
119649
  directives: commentDirectives.disableDirectives,
119566
119650
  disableFixes: options.disableFixes,
119567
119651
  problems: lintingProblems