eslint-linter-browserify 10.1.0 → 10.2.1

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.
Files changed (5) hide show
  1. package/linter.cjs +309 -109
  2. package/linter.js +309 -109
  3. package/linter.min.js +3 -3
  4. package/linter.mjs +309 -109
  5. package/package.json +4 -4
package/linter.cjs CHANGED
@@ -4216,7 +4216,7 @@ function requireEslintVisitorKeys$2 () {
4216
4216
  return eslintVisitorKeys$2;
4217
4217
  }
4218
4218
 
4219
- var version = "10.1.0";
4219
+ var version = "10.2.1";
4220
4220
  var require$$3$1 = {
4221
4221
  version: version};
4222
4222
 
@@ -10012,6 +10012,7 @@ function requireGlobals () {
10012
10012
  AsyncDisposableStack: false,
10013
10013
  DisposableStack: false,
10014
10014
  SuppressedError: false,
10015
+ Temporal: false,
10015
10016
  };
10016
10017
 
10017
10018
  //-----------------------------------------------------------------------------
@@ -11522,11 +11523,10 @@ function requireCodePathState () {
11522
11523
  this.position = "try";
11523
11524
 
11524
11525
  /**
11525
- * If the `try` statement has a `finally` block, this affects how a
11526
- * `return` statement behaves in the `try` block. Without `finally`,
11527
- * `return` behaves as usual and doesn't require a fork; with `finally`,
11528
- * `return` forks into the `finally` block, so we need a fork context
11529
- * to track it.
11526
+ * If the `try` statement has a `finally` block, this affects how return-like
11527
+ * leaving paths behave in the `try` block. Without `finally`, they behave as
11528
+ * usual and don't require a fork; with `finally`, they fork into the
11529
+ * `finally` block, so we need a fork context to track them.
11530
11530
  * @type {ForkContext|null}
11531
11531
  */
11532
11532
  this.returnedForkContext = hasFinalizer
@@ -12708,6 +12708,23 @@ function requireCodePathState () {
12708
12708
  this.forkContext.add(segments);
12709
12709
  }
12710
12710
 
12711
+ /**
12712
+ * Records abrupt resumption paths from a suspended `yield` expression,
12713
+ * then splits normal post-`yield` continuation into a fresh segment.
12714
+ * @returns {void}
12715
+ */
12716
+ makeYield() {
12717
+ const forkContext = this.forkContext;
12718
+ const leavingSegments = forkContext.head;
12719
+
12720
+ if (forkContext.reachable) {
12721
+ getReturnContext(this).returnedForkContext.add(leavingSegments);
12722
+ getThrowContext(this).thrownForkContext.add(leavingSegments);
12723
+
12724
+ forkContext.replaceHead(forkContext.makeNext(-1, -1));
12725
+ }
12726
+ }
12727
+
12711
12728
  /**
12712
12729
  * Makes a code path segment from the first throwable node to the `catch`
12713
12730
  * block or the `finally` block.
@@ -13483,9 +13500,10 @@ function requireCodePath () {
13483
13500
  * Final code path segments that represent normal completion of the code path.
13484
13501
  * For functions, this means both explicit `return` statements and implicit returns,
13485
13502
  * such as the last reachable segment in a function that does not have an
13486
- * explicit `return` as this implicitly returns `undefined`. For scripts,
13487
- * modules, class field initializers, and class static blocks, this means
13488
- * all lines of code have been executed.
13503
+ * explicit `return` as this implicitly returns `undefined`, as well as
13504
+ * return-like exits from suspended `yield` expressions. For scripts, modules,
13505
+ * class field initializers, and class static blocks, this means all lines of
13506
+ * code have been executed.
13489
13507
  * These segments are also present in `finalSegments`.
13490
13508
  * This is a passthrough to the underlying `CodePathState`.
13491
13509
  * @type {CodePathSegment[]}
@@ -13495,7 +13513,8 @@ function requireCodePath () {
13495
13513
  }
13496
13514
 
13497
13515
  /**
13498
- * Final code path segments that represent `throw` statements.
13516
+ * Final code path segments that represent `throw` statements and throw-like
13517
+ * exits from suspended `yield` expressions.
13499
13518
  * This is a passthrough to the underlying `CodePathState`.
13500
13519
  * These segments are also present in `finalSegments`.
13501
13520
  * @type {CodePathSegment[]}
@@ -13754,7 +13773,7 @@ function requireCodePathAnalyzer () {
13754
13773
 
13755
13774
  /**
13756
13775
  * Checks if a given node appears as the value of a PropertyDefinition node.
13757
- * @param {ASTNode} node THe node to check.
13776
+ * @param {ASTNode} node The node to check.
13758
13777
  * @returns {boolean} `true` if the node is a PropertyDefinition value,
13759
13778
  * false if not.
13760
13779
  */
@@ -14224,7 +14243,7 @@ function requireCodePathAnalyzer () {
14224
14243
 
14225
14244
  case "SwitchCase":
14226
14245
  /*
14227
- * Fork if this node is after the 2st node in `cases`.
14246
+ * Fork if this node is after the 1st node in `cases`.
14228
14247
  * It's similar to `else` blocks.
14229
14248
  * The next `test` node is processed in this path.
14230
14249
  */
@@ -14343,10 +14362,13 @@ function requireCodePathAnalyzer () {
14343
14362
  case "ImportExpression":
14344
14363
  case "MemberExpression":
14345
14364
  case "NewExpression":
14346
- case "YieldExpression":
14347
14365
  state.makeFirstThrowablePathInTryBlock();
14348
14366
  break;
14349
14367
 
14368
+ case "YieldExpression":
14369
+ state.makeYield();
14370
+ break;
14371
+
14350
14372
  case "WhileStatement":
14351
14373
  case "DoWhileStatement":
14352
14374
  case "ForStatement":
@@ -19282,15 +19304,16 @@ function requireFlatConfigSchema () {
19282
19304
  }
19283
19305
 
19284
19306
  /**
19285
- * Validates that a given string is the form pluginName/objectName.
19307
+ * Validates that a given string matches the "pluginName/memberPlaceholder" pattern.
19286
19308
  * @param {string} value The string to check.
19309
+ * @param {string} memberPlaceholder The placeholder for the member portion of the expected format in the error message.
19287
19310
  * @returns {void}
19288
- * @throws {TypeError} If the string isn't in the correct format.
19311
+ * @throws {TypeError} If the string doesn't match the expected pattern.
19289
19312
  */
19290
- function assertIsPluginMemberName(value) {
19313
+ function assertIsPluginMemberName(value, memberPlaceholder) {
19291
19314
  if (!/[\w\-@$]+(?:\/[\w\-$]+)+$/iu.test(value)) {
19292
19315
  throw new TypeError(
19293
- `Expected string in the form "pluginName/objectName" but found "${value}".`,
19316
+ `Expected string in the form "pluginName/${memberPlaceholder}" but found "${value}".`,
19294
19317
  );
19295
19318
  }
19296
19319
  }
@@ -19433,7 +19456,9 @@ function requireFlatConfigSchema () {
19433
19456
  /** @type {ObjectPropertySchema} */
19434
19457
  const languageSchema = {
19435
19458
  merge: "replace",
19436
- validate: assertIsPluginMemberName,
19459
+ validate(value) {
19460
+ assertIsPluginMemberName(value, "languageName");
19461
+ },
19437
19462
  };
19438
19463
 
19439
19464
  /** @type {ObjectPropertySchema} */
@@ -19488,7 +19513,7 @@ function requireFlatConfigSchema () {
19488
19513
  merge: "replace",
19489
19514
  validate(value) {
19490
19515
  if (typeof value === "string") {
19491
- assertIsPluginMemberName(value);
19516
+ assertIsPluginMemberName(value, "processorName");
19492
19517
  } else if (value && typeof value === "object") {
19493
19518
  if (
19494
19519
  typeof value.preprocess !== "function" ||
@@ -22913,7 +22938,9 @@ function requireCommonjs$1 () {
22913
22938
  const x = numeric(n[0]);
22914
22939
  const y = numeric(n[1]);
22915
22940
  const width = Math.max(n[0].length, n[1].length);
22916
- let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
22941
+ let incr = n.length === 3 && n[2] !== undefined ?
22942
+ Math.max(Math.abs(numeric(n[2])), 1)
22943
+ : 1;
22917
22944
  let test = lte;
22918
22945
  const reverse = y < x;
22919
22946
  if (reverse) {
@@ -23185,16 +23212,16 @@ function require_unescape () {
23185
23212
  const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
23186
23213
  if (magicalBraces) {
23187
23214
  return windowsPathsNoEscape ?
23188
- s.replace(/\[([^\/\\])\]/g, '$1')
23215
+ s.replace(/\[([^/\\])\]/g, '$1')
23189
23216
  : s
23190
- .replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
23191
- .replace(/\\([^\/])/g, '$1');
23217
+ .replace(/((?!\\).|^)\[([^/\\])\]/g, '$1$2')
23218
+ .replace(/\\([^/])/g, '$1');
23192
23219
  }
23193
23220
  return windowsPathsNoEscape ?
23194
- s.replace(/\[([^\/\\{}])\]/g, '$1')
23221
+ s.replace(/\[([^/\\{}])\]/g, '$1')
23195
23222
  : s
23196
- .replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
23197
- .replace(/\\([^\/{}])/g, '$1');
23223
+ .replace(/((?!\\).|^)\[([^/\\{}])\]/g, '$1$2')
23224
+ .replace(/\\([^/{}])/g, '$1');
23198
23225
  };
23199
23226
  _unescape.unescape = unescape;
23200
23227
 
@@ -23399,15 +23426,14 @@ function requireAst$1 () {
23399
23426
  }
23400
23427
  // reconstructs the pattern
23401
23428
  toString() {
23402
- if (this.#toString !== undefined)
23403
- return this.#toString;
23404
- if (!this.type) {
23405
- return (this.#toString = this.#parts.map(p => String(p)).join(''));
23406
- }
23407
- else {
23408
- return (this.#toString =
23409
- this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')');
23410
- }
23429
+ return (this.#toString !== undefined ? this.#toString
23430
+ : !this.type ?
23431
+ (this.#toString = this.#parts.map(p => String(p)).join(''))
23432
+ : (this.#toString =
23433
+ this.type +
23434
+ '(' +
23435
+ this.#parts.map(p => String(p)).join('|') +
23436
+ ')'));
23411
23437
  }
23412
23438
  #fillNegs() {
23413
23439
  /* c8 ignore start */
@@ -23687,7 +23713,7 @@ function requireAst$1 () {
23687
23713
  }
23688
23714
  #canUsurpType(c) {
23689
23715
  const m = usurpMap.get(this.type);
23690
- return !!(m?.has(c));
23716
+ return !!m?.has(c);
23691
23717
  }
23692
23718
  #canUsurp(child) {
23693
23719
  if (!child ||
@@ -24116,7 +24142,7 @@ function requireCommonjs () {
24116
24142
  };
24117
24143
  exports$1.minimatch = minimatch;
24118
24144
  // Optimized checking for the most common glob patterns.
24119
- const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
24145
+ const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
24120
24146
  const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext);
24121
24147
  const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
24122
24148
  const starDotExtTestNocase = (ext) => {
@@ -24135,7 +24161,7 @@ function requireCommonjs () {
24135
24161
  const starRE = /^\*+$/;
24136
24162
  const starTest = (f) => f.length !== 0 && !f.startsWith('.');
24137
24163
  const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..';
24138
- const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
24164
+ const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
24139
24165
  const qmarksTestNocase = ([$0, ext = '']) => {
24140
24166
  const noext = qmarksTestNoExt([$0]);
24141
24167
  if (!ext)
@@ -24367,6 +24393,7 @@ function requireCommonjs () {
24367
24393
  // step 2: expand braces
24368
24394
  this.globSet = [...new Set(this.braceExpand())];
24369
24395
  if (options.debug) {
24396
+ //oxlint-disable-next-line no-console
24370
24397
  this.debug = (...args) => console.error(...args);
24371
24398
  }
24372
24399
  this.debug(this.pattern, this.globSet);
@@ -24429,10 +24456,10 @@ function requireCommonjs () {
24429
24456
  preprocess(globParts) {
24430
24457
  // if we're not in globstar mode, then turn ** into *
24431
24458
  if (this.options.noglobstar) {
24432
- for (let i = 0; i < globParts.length; i++) {
24433
- for (let j = 0; j < globParts[i].length; j++) {
24434
- if (globParts[i][j] === '**') {
24435
- globParts[i][j] = '*';
24459
+ for (const partset of globParts) {
24460
+ for (let j = 0; j < partset.length; j++) {
24461
+ if (partset[j] === '**') {
24462
+ partset[j] = '*';
24436
24463
  }
24437
24464
  }
24438
24465
  }
@@ -24520,7 +24547,11 @@ function requireCommonjs () {
24520
24547
  let dd = 0;
24521
24548
  while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
24522
24549
  const p = parts[dd - 1];
24523
- if (p && p !== '.' && p !== '..' && p !== '**') {
24550
+ if (p &&
24551
+ p !== '.' &&
24552
+ p !== '..' &&
24553
+ p !== '**' &&
24554
+ !(this.isWindows && /^[a-z]:$/i.test(p))) {
24524
24555
  didSomething = true;
24525
24556
  parts.splice(dd - 1, 2);
24526
24557
  dd -= 2;
@@ -24769,15 +24800,17 @@ function requireCommonjs () {
24769
24800
  // split the pattern up into globstar-delimited sections
24770
24801
  // the tail has to be at the end, and the others just have
24771
24802
  // to be found in order from the head.
24772
- const [head, body, tail] = partial ? [
24773
- pattern.slice(patternIndex, firstgs),
24774
- pattern.slice(firstgs + 1),
24775
- [],
24776
- ] : [
24777
- pattern.slice(patternIndex, firstgs),
24778
- pattern.slice(firstgs + 1, lastgs),
24779
- pattern.slice(lastgs + 1),
24780
- ];
24803
+ const [head, body, tail] = partial ?
24804
+ [
24805
+ pattern.slice(patternIndex, firstgs),
24806
+ pattern.slice(firstgs + 1),
24807
+ [],
24808
+ ]
24809
+ : [
24810
+ pattern.slice(patternIndex, firstgs),
24811
+ pattern.slice(firstgs + 1, lastgs),
24812
+ pattern.slice(lastgs + 1),
24813
+ ];
24781
24814
  // check the head, from the current file/pattern index.
24782
24815
  if (head.length) {
24783
24816
  const fileHead = file.slice(fileIndex, fileIndex + head.length);
@@ -25123,7 +25156,7 @@ function requireCommonjs () {
25123
25156
  this.regexp = new RegExp(re, [...flags].join(''));
25124
25157
  /* c8 ignore start */
25125
25158
  }
25126
- catch (ex) {
25159
+ catch {
25127
25160
  // should be impossible
25128
25161
  this.regexp = false;
25129
25162
  }
@@ -25138,7 +25171,7 @@ function requireCommonjs () {
25138
25171
  if (this.preserveMultipleSlashes) {
25139
25172
  return p.split('/');
25140
25173
  }
25141
- else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
25174
+ else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
25142
25175
  // add an extra '' for the one we lose
25143
25176
  return ['', ...p.split(/\/+/)];
25144
25177
  }
@@ -25180,8 +25213,7 @@ function requireCommonjs () {
25180
25213
  filename = ff[i];
25181
25214
  }
25182
25215
  }
25183
- for (let i = 0; i < set.length; i++) {
25184
- const pattern = set[i];
25216
+ for (const pattern of set) {
25185
25217
  let file = ff;
25186
25218
  if (options.matchBase && pattern.length === 1) {
25187
25219
  file = [filename];
@@ -25300,7 +25332,7 @@ function requireCjs$1 () {
25300
25332
  class ValidationStrategy {
25301
25333
  /**
25302
25334
  * Validates that a value is an array.
25303
- * @param {*} value The value to validate.
25335
+ * @param {unknown} value The value to validate.
25304
25336
  * @returns {void}
25305
25337
  * @throws {TypeError} If the value is invalid.
25306
25338
  */
@@ -25312,19 +25344,19 @@ function requireCjs$1 () {
25312
25344
 
25313
25345
  /**
25314
25346
  * Validates that a value is a boolean.
25315
- * @param {*} value The value to validate.
25347
+ * @param {unknown} value The value to validate.
25316
25348
  * @returns {void}
25317
25349
  * @throws {TypeError} If the value is invalid.
25318
25350
  */
25319
25351
  static boolean(value) {
25320
25352
  if (typeof value !== "boolean") {
25321
- throw new TypeError("Expected a Boolean.");
25353
+ throw new TypeError("Expected a boolean.");
25322
25354
  }
25323
25355
  }
25324
25356
 
25325
25357
  /**
25326
25358
  * Validates that a value is a number.
25327
- * @param {*} value The value to validate.
25359
+ * @param {unknown} value The value to validate.
25328
25360
  * @returns {void}
25329
25361
  * @throws {TypeError} If the value is invalid.
25330
25362
  */
@@ -25335,8 +25367,8 @@ function requireCjs$1 () {
25335
25367
  }
25336
25368
 
25337
25369
  /**
25338
- * Validates that a value is a object.
25339
- * @param {*} value The value to validate.
25370
+ * Validates that a value is an object.
25371
+ * @param {unknown} value The value to validate.
25340
25372
  * @returns {void}
25341
25373
  * @throws {TypeError} If the value is invalid.
25342
25374
  */
@@ -25347,8 +25379,8 @@ function requireCjs$1 () {
25347
25379
  }
25348
25380
 
25349
25381
  /**
25350
- * Validates that a value is a object or null.
25351
- * @param {*} value The value to validate.
25382
+ * Validates that a value is an object or null.
25383
+ * @param {unknown} value The value to validate.
25352
25384
  * @returns {void}
25353
25385
  * @throws {TypeError} If the value is invalid.
25354
25386
  */
@@ -25360,7 +25392,7 @@ function requireCjs$1 () {
25360
25392
 
25361
25393
  /**
25362
25394
  * Validates that a value is a string.
25363
- * @param {*} value The value to validate.
25395
+ * @param {unknown} value The value to validate.
25364
25396
  * @returns {void}
25365
25397
  * @throws {TypeError} If the value is invalid.
25366
25398
  */
@@ -25372,7 +25404,7 @@ function requireCjs$1 () {
25372
25404
 
25373
25405
  /**
25374
25406
  * Validates that a value is a non-empty string.
25375
- * @param {*} value The value to validate.
25407
+ * @param {unknown} value The value to validate.
25376
25408
  * @returns {void}
25377
25409
  * @throws {TypeError} If the value is invalid.
25378
25410
  */
@@ -25547,13 +25579,17 @@ function requireCjs$1 () {
25547
25579
 
25548
25580
  // add in all strategies
25549
25581
  for (const key of Object.keys(definitions)) {
25550
- validateDefinition(key, definitions[key]);
25582
+ const definition = definitions[key];
25583
+
25584
+ validateDefinition(key, definition);
25585
+
25586
+ let normalizedDefinition = definition;
25551
25587
 
25552
25588
  // normalize merge and validate methods if subschema is present
25553
- if (typeof definitions[key].schema === "object") {
25554
- const schema = new ObjectSchema(definitions[key].schema);
25555
- definitions[key] = {
25556
- ...definitions[key],
25589
+ if (typeof normalizedDefinition.schema === "object") {
25590
+ const schema = new ObjectSchema(normalizedDefinition.schema);
25591
+ normalizedDefinition = {
25592
+ ...normalizedDefinition,
25557
25593
  merge(first = {}, second = {}) {
25558
25594
  return schema.merge(first, second);
25559
25595
  },
@@ -25565,30 +25601,25 @@ function requireCjs$1 () {
25565
25601
  }
25566
25602
 
25567
25603
  // normalize the merge method in case there's a string
25568
- if (typeof definitions[key].merge === "string") {
25569
- definitions[key] = {
25570
- ...definitions[key],
25571
- merge: MergeStrategy[
25572
- /** @type {string} */ (definitions[key].merge)
25573
- ],
25604
+ if (typeof normalizedDefinition.merge === "string") {
25605
+ normalizedDefinition = {
25606
+ ...normalizedDefinition,
25607
+ merge: MergeStrategy[normalizedDefinition.merge],
25574
25608
  };
25575
25609
  }
25576
25610
 
25577
25611
  // normalize the validate method in case there's a string
25578
- if (typeof definitions[key].validate === "string") {
25579
- definitions[key] = {
25580
- ...definitions[key],
25581
- validate:
25582
- ValidationStrategy[
25583
- /** @type {string} */ (definitions[key].validate)
25584
- ],
25612
+ if (typeof normalizedDefinition.validate === "string") {
25613
+ normalizedDefinition = {
25614
+ ...normalizedDefinition,
25615
+ validate: ValidationStrategy[normalizedDefinition.validate],
25585
25616
  };
25586
25617
  }
25587
25618
 
25588
- this.#definitions.set(key, definitions[key]);
25619
+ this.#definitions.set(key, normalizedDefinition);
25589
25620
 
25590
- if (definitions[key].required) {
25591
- this.#requiredKeys.set(key, definitions[key]);
25621
+ if (normalizedDefinition.required) {
25622
+ this.#requiredKeys.set(key, normalizedDefinition);
25592
25623
  }
25593
25624
  }
25594
25625
  }
@@ -35343,6 +35374,76 @@ function requireConfig () {
35343
35374
  };
35344
35375
  }
35345
35376
 
35377
+ /**
35378
+ * Normalizes a language name by replacing the built-in `@/` plugin prefix with `js/`.
35379
+ * @param {string} languageName The language name to normalize.
35380
+ * @returns {string} The normalized language name.
35381
+ */
35382
+ function normalizeLanguageName(languageName) {
35383
+ return languageName.startsWith("@/")
35384
+ ? `js/${languageName.slice(2)}`
35385
+ : languageName;
35386
+ }
35387
+
35388
+ /**
35389
+ * Checks if a rule's `meta.languages` supports the given language.
35390
+ * @param {Array<string>|undefined} ruleLangs The rule's `meta.languages` array.
35391
+ * @param {string} configLanguageName The normalized language name from the config (e.g., "js/js").
35392
+ * @param {Array<string>} validPluginNames The valid plugin name aliases for the config's plugin
35393
+ * (normalized plugin name plus its `meta.namespace` if defined).
35394
+ * @returns {boolean} True if the rule supports the language, false otherwise.
35395
+ */
35396
+ function doesRuleSupportLanguage(
35397
+ ruleLangs,
35398
+ configLanguageName,
35399
+ validPluginNames,
35400
+ ) {
35401
+ // If no languages specified, works with all languages (backward compatible)
35402
+ if (!ruleLangs) {
35403
+ return true;
35404
+ }
35405
+
35406
+ const { objectName: configLangPart } =
35407
+ splitPluginIdentifier(configLanguageName);
35408
+
35409
+ for (const langEntry of ruleLangs) {
35410
+ // Skip non-string entries
35411
+ if (typeof langEntry !== "string") {
35412
+ continue;
35413
+ }
35414
+
35415
+ // "*" matches any language
35416
+ if (langEntry === "*") {
35417
+ return true;
35418
+ }
35419
+
35420
+ // Direct match
35421
+ if (langEntry === configLanguageName) {
35422
+ return true;
35423
+ }
35424
+
35425
+ const { pluginName: rulePluginPart, objectName: ruleLangPart } =
35426
+ splitPluginIdentifier(langEntry);
35427
+
35428
+ // "plugin/*" wildcard - matches any language from that plugin (by name or namespace)
35429
+ if (ruleLangPart === "*") {
35430
+ if (validPluginNames.includes(rulePluginPart)) {
35431
+ return true;
35432
+ }
35433
+ } else {
35434
+ // Match by plugin name or namespace, with exact language part
35435
+ if (
35436
+ validPluginNames.includes(rulePluginPart) &&
35437
+ ruleLangPart === configLangPart
35438
+ ) {
35439
+ return true;
35440
+ }
35441
+ }
35442
+ }
35443
+
35444
+ return false;
35445
+ }
35446
+
35346
35447
  /**
35347
35448
  * Returns the name of an object in the config by reading its `meta` key.
35348
35449
  * @param {Object} object The object to check.
@@ -35687,12 +35788,30 @@ function requireConfig () {
35687
35788
  * @throws {TypeError} If the rulesConfig is not provided or is invalid.
35688
35789
  * @throws {InvalidRuleOptionsSchemaError} If a rule's `meta.schema` is invalid.
35689
35790
  * @throws {TypeError} If a rule is not found in the plugins.
35791
+ * @throws {TypeError} If a rule does not support the current language.
35690
35792
  */
35691
35793
  validateRulesConfig(rulesConfig) {
35692
35794
  if (!rulesConfig) {
35693
35795
  throw new TypeError("Config is required for validation.");
35694
35796
  }
35695
35797
 
35798
+ // Normalize "@/" prefix to "js/" for matching and user-facing messages
35799
+ const normalizedLanguageName = normalizeLanguageName(
35800
+ this.#languageName,
35801
+ );
35802
+
35803
+ // Compute valid plugin name aliases for the config's language plugin once
35804
+ const { pluginName: configPluginName } = splitPluginIdentifier(
35805
+ normalizedLanguageName,
35806
+ );
35807
+ const configPlugin =
35808
+ this.plugins[configPluginName] ??
35809
+ (configPluginName === "js" ? this.plugins["@"] : void 0);
35810
+ const validPluginNames = configPlugin?.meta?.namespace
35811
+ ? [configPluginName, configPlugin.meta.namespace]
35812
+ : [configPluginName];
35813
+ const unsupportedLanguageRules = [];
35814
+
35696
35815
  for (const [ruleId, ruleOptions] of Object.entries(rulesConfig)) {
35697
35816
  // check for edge case
35698
35817
  if (ruleId === "__proto__") {
@@ -35718,6 +35837,34 @@ function requireConfig () {
35718
35837
  throwRuleNotFoundError(parseRuleId(ruleId), this);
35719
35838
  }
35720
35839
 
35840
+ // Validate meta.languages structure if present (only for enabled rules)
35841
+ if (rule.meta?.languages !== void 0) {
35842
+ if (!Array.isArray(rule.meta.languages)) {
35843
+ throw new TypeError(
35844
+ `Key "rules": Key "${ruleId}": Key "meta": Key "languages": Expected an array.`,
35845
+ );
35846
+ }
35847
+
35848
+ for (const lang of rule.meta.languages) {
35849
+ if (typeof lang !== "string") {
35850
+ throw new TypeError(
35851
+ `Key "rules": Key "${ruleId}": Key "meta": Key "languages": Expected each element to be a string.`,
35852
+ );
35853
+ }
35854
+ }
35855
+ }
35856
+
35857
+ // Check if the rule supports the current language
35858
+ if (
35859
+ !doesRuleSupportLanguage(
35860
+ rule.meta?.languages,
35861
+ normalizedLanguageName,
35862
+ validPluginNames,
35863
+ )
35864
+ ) {
35865
+ unsupportedLanguageRules.push(ruleId);
35866
+ }
35867
+
35721
35868
  const validateRule = getOrCreateValidator(rule, ruleId);
35722
35869
 
35723
35870
  if (validateRule) {
@@ -35749,6 +35896,19 @@ function requireConfig () {
35749
35896
  }
35750
35897
  }
35751
35898
  }
35899
+
35900
+ if (unsupportedLanguageRules.length > 0) {
35901
+ const error = new TypeError(
35902
+ `Key "rules": The following rules do not support the language "${normalizedLanguageName}":\n${unsupportedLanguageRules.map(ruleId => `\t- "${ruleId}"`).join("\n")}`,
35903
+ );
35904
+
35905
+ error.messageTemplate = "rule-unsupported-language";
35906
+ error.messageData = {
35907
+ ruleIds: unsupportedLanguageRules,
35908
+ language: normalizedLanguageName,
35909
+ };
35910
+ throw error;
35911
+ }
35752
35912
  }
35753
35913
 
35754
35914
  /**
@@ -73837,12 +73997,18 @@ function requireNoAsyncPromiseExecutor () {
73837
73997
  },
73838
73998
 
73839
73999
  create(context) {
74000
+ const sourceCode = context.sourceCode;
74001
+
73840
74002
  return {
73841
74003
  "NewExpression[callee.name='Promise'][arguments.0.async=true]"(
73842
74004
  node,
73843
74005
  ) {
74006
+ if (!sourceCode.isGlobalReference(node.callee)) {
74007
+ return;
74008
+ }
74009
+
73844
74010
  context.report({
73845
- node: context.sourceCode.getFirstToken(
74011
+ node: sourceCode.getFirstToken(
73846
74012
  node.arguments[0],
73847
74013
  token => token.value === "async",
73848
74014
  ),
@@ -92703,7 +92869,14 @@ function requireNoObjCalls () {
92703
92869
  // Helpers
92704
92870
  //------------------------------------------------------------------------------
92705
92871
 
92706
- const nonCallableGlobals = ["Atomics", "JSON", "Math", "Reflect", "Intl"];
92872
+ const nonCallableGlobals = [
92873
+ "Atomics",
92874
+ "JSON",
92875
+ "Math",
92876
+ "Reflect",
92877
+ "Intl",
92878
+ "Temporal",
92879
+ ];
92707
92880
 
92708
92881
  /**
92709
92882
  * Returns the name of the node to report
@@ -98831,7 +99004,7 @@ function requireNoShadow () {
98831
99004
 
98832
99005
  /**
98833
99006
  * Checks the current context for shadowed variables.
98834
- * @param {Scope} scope Fixme
99007
+ * @param {Scope} scope The scope to check for shadowed variables.
98835
99008
  * @returns {void}
98836
99009
  */
98837
99010
  function checkForShadows(scope) {
@@ -101251,6 +101424,35 @@ function requireNoUnmodifiedLoopCondition () {
101251
101424
  return null;
101252
101425
  }
101253
101426
 
101427
+ /**
101428
+ * Checks whether a given modifier is in a loop.
101429
+ *
101430
+ * Besides checking for the condition being in the loop, this also checks
101431
+ * whether the function that this modifier is belonging to is called
101432
+ * in the loop.
101433
+ * @param {LoopConditionInfo} condition The condition to check.
101434
+ * @param {Reference} modifier The modifier to check.
101435
+ * @returns {boolean} `true` if the modifier is in a loop.
101436
+ */
101437
+ function hasModifierInLoop(condition, modifier) {
101438
+ if (condition.isInLoop(modifier)) {
101439
+ return true;
101440
+ }
101441
+
101442
+ const funcNode = getEncloseFunctionDeclaration(modifier);
101443
+
101444
+ if (!funcNode) {
101445
+ return false;
101446
+ }
101447
+
101448
+ const funcVar = astUtils.getVariableByName(
101449
+ modifier.from.upper,
101450
+ funcNode.id.name,
101451
+ );
101452
+
101453
+ return Boolean(funcVar && funcVar.references.some(condition.isInLoop));
101454
+ }
101455
+
101254
101456
  /**
101255
101457
  * Updates the "modified" flags of given loop conditions with given modifiers.
101256
101458
  * @param {LoopConditionInfo[]} conditions The loop conditions to be updated.
@@ -101263,26 +101465,8 @@ function requireNoUnmodifiedLoopCondition () {
101263
101465
 
101264
101466
  for (let j = 0; !condition.modified && j < modifiers.length; ++j) {
101265
101467
  const modifier = modifiers[j];
101266
- let funcNode, funcVar;
101267
101468
 
101268
- /*
101269
- * Besides checking for the condition being in the loop, we want to
101270
- * check the function that this modifier is belonging to is called
101271
- * in the loop.
101272
- * FIXME: This should probably be extracted to a function.
101273
- */
101274
- const inLoop =
101275
- condition.isInLoop(modifier) ||
101276
- Boolean(
101277
- (funcNode = getEncloseFunctionDeclaration(modifier)) &&
101278
- (funcVar = astUtils.getVariableByName(
101279
- modifier.from.upper,
101280
- funcNode.id.name,
101281
- )) &&
101282
- funcVar.references.some(condition.isInLoop),
101283
- );
101284
-
101285
- condition.modified = inLoop;
101469
+ condition.modified = hasModifierInLoop(condition, modifier);
101286
101470
  }
101287
101471
  }
101288
101472
  }
@@ -131044,6 +131228,22 @@ function requireLinter () {
131044
131228
  throw err;
131045
131229
  }
131046
131230
 
131231
+ /*
131232
+ * If the rule does not support the current language, report a
131233
+ * specific, actionable error message.
131234
+ */
131235
+ if (
131236
+ err.messageTemplate ===
131237
+ "rule-unsupported-language"
131238
+ ) {
131239
+ report.addError({
131240
+ ruleId,
131241
+ message: `Inline configuration for rule "${ruleId}" is invalid:\n\tRule does not support the language "${err.messageData.language}". Use a config block with "files" to apply the rule only to supported files, or disable it.\n`,
131242
+ loc,
131243
+ });
131244
+ return;
131245
+ }
131246
+
131047
131247
  let baseMessage = err.message
131048
131248
  .slice(
131049
131249
  err.message.startsWith('Key "rules":')