eslint-linter-browserify 10.0.3 → 10.2.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.
Files changed (5) hide show
  1. package/linter.cjs +318 -123
  2. package/linter.js +318 -123
  3. package/linter.min.js +3 -3
  4. package/linter.mjs +318 -123
  5. package/package.json +3 -3
package/linter.cjs CHANGED
@@ -4216,7 +4216,7 @@ function requireEslintVisitorKeys$2 () {
4216
4216
  return eslintVisitorKeys$2;
4217
4217
  }
4218
4218
 
4219
- var version = "10.0.3";
4219
+ var version = "10.2.0";
4220
4220
  var require$$3$1 = {
4221
4221
  version: version};
4222
4222
 
@@ -8346,7 +8346,6 @@ function requireUtils$1 () {
8346
8346
  for (
8347
8347
  let minIndex = 0, maxIndex = tokens.length - 1;
8348
8348
  minIndex <= maxIndex;
8349
-
8350
8349
  ) {
8351
8350
  /*
8352
8351
  * Calculate the index in the middle between minIndex and maxIndex.
@@ -10013,6 +10012,7 @@ function requireGlobals () {
10013
10012
  AsyncDisposableStack: false,
10014
10013
  DisposableStack: false,
10015
10014
  SuppressedError: false,
10015
+ Temporal: false,
10016
10016
  };
10017
10017
 
10018
10018
  //-----------------------------------------------------------------------------
@@ -22914,7 +22914,9 @@ function requireCommonjs$1 () {
22914
22914
  const x = numeric(n[0]);
22915
22915
  const y = numeric(n[1]);
22916
22916
  const width = Math.max(n[0].length, n[1].length);
22917
- let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
22917
+ let incr = n.length === 3 && n[2] !== undefined ?
22918
+ Math.max(Math.abs(numeric(n[2])), 1)
22919
+ : 1;
22918
22920
  let test = lte;
22919
22921
  const reverse = y < x;
22920
22922
  if (reverse) {
@@ -23186,16 +23188,16 @@ function require_unescape () {
23186
23188
  const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
23187
23189
  if (magicalBraces) {
23188
23190
  return windowsPathsNoEscape ?
23189
- s.replace(/\[([^\/\\])\]/g, '$1')
23191
+ s.replace(/\[([^/\\])\]/g, '$1')
23190
23192
  : s
23191
- .replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
23192
- .replace(/\\([^\/])/g, '$1');
23193
+ .replace(/((?!\\).|^)\[([^/\\])\]/g, '$1$2')
23194
+ .replace(/\\([^/])/g, '$1');
23193
23195
  }
23194
23196
  return windowsPathsNoEscape ?
23195
- s.replace(/\[([^\/\\{}])\]/g, '$1')
23197
+ s.replace(/\[([^/\\{}])\]/g, '$1')
23196
23198
  : s
23197
- .replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
23198
- .replace(/\\([^\/{}])/g, '$1');
23199
+ .replace(/((?!\\).|^)\[([^/\\{}])\]/g, '$1$2')
23200
+ .replace(/\\([^/{}])/g, '$1');
23199
23201
  };
23200
23202
  _unescape.unescape = unescape;
23201
23203
 
@@ -23400,15 +23402,14 @@ function requireAst$1 () {
23400
23402
  }
23401
23403
  // reconstructs the pattern
23402
23404
  toString() {
23403
- if (this.#toString !== undefined)
23404
- return this.#toString;
23405
- if (!this.type) {
23406
- return (this.#toString = this.#parts.map(p => String(p)).join(''));
23407
- }
23408
- else {
23409
- return (this.#toString =
23410
- this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')');
23411
- }
23405
+ return (this.#toString !== undefined ? this.#toString
23406
+ : !this.type ?
23407
+ (this.#toString = this.#parts.map(p => String(p)).join(''))
23408
+ : (this.#toString =
23409
+ this.type +
23410
+ '(' +
23411
+ this.#parts.map(p => String(p)).join('|') +
23412
+ ')'));
23412
23413
  }
23413
23414
  #fillNegs() {
23414
23415
  /* c8 ignore start */
@@ -23688,7 +23689,7 @@ function requireAst$1 () {
23688
23689
  }
23689
23690
  #canUsurpType(c) {
23690
23691
  const m = usurpMap.get(this.type);
23691
- return !!(m?.has(c));
23692
+ return !!m?.has(c);
23692
23693
  }
23693
23694
  #canUsurp(child) {
23694
23695
  if (!child ||
@@ -24117,7 +24118,7 @@ function requireCommonjs () {
24117
24118
  };
24118
24119
  exports$1.minimatch = minimatch;
24119
24120
  // Optimized checking for the most common glob patterns.
24120
- const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
24121
+ const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
24121
24122
  const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext);
24122
24123
  const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
24123
24124
  const starDotExtTestNocase = (ext) => {
@@ -24136,7 +24137,7 @@ function requireCommonjs () {
24136
24137
  const starRE = /^\*+$/;
24137
24138
  const starTest = (f) => f.length !== 0 && !f.startsWith('.');
24138
24139
  const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..';
24139
- const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
24140
+ const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
24140
24141
  const qmarksTestNocase = ([$0, ext = '']) => {
24141
24142
  const noext = qmarksTestNoExt([$0]);
24142
24143
  if (!ext)
@@ -24368,6 +24369,7 @@ function requireCommonjs () {
24368
24369
  // step 2: expand braces
24369
24370
  this.globSet = [...new Set(this.braceExpand())];
24370
24371
  if (options.debug) {
24372
+ //oxlint-disable-next-line no-console
24371
24373
  this.debug = (...args) => console.error(...args);
24372
24374
  }
24373
24375
  this.debug(this.pattern, this.globSet);
@@ -24430,10 +24432,10 @@ function requireCommonjs () {
24430
24432
  preprocess(globParts) {
24431
24433
  // if we're not in globstar mode, then turn ** into *
24432
24434
  if (this.options.noglobstar) {
24433
- for (let i = 0; i < globParts.length; i++) {
24434
- for (let j = 0; j < globParts[i].length; j++) {
24435
- if (globParts[i][j] === '**') {
24436
- globParts[i][j] = '*';
24435
+ for (const partset of globParts) {
24436
+ for (let j = 0; j < partset.length; j++) {
24437
+ if (partset[j] === '**') {
24438
+ partset[j] = '*';
24437
24439
  }
24438
24440
  }
24439
24441
  }
@@ -24521,7 +24523,11 @@ function requireCommonjs () {
24521
24523
  let dd = 0;
24522
24524
  while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
24523
24525
  const p = parts[dd - 1];
24524
- if (p && p !== '.' && p !== '..' && p !== '**') {
24526
+ if (p &&
24527
+ p !== '.' &&
24528
+ p !== '..' &&
24529
+ p !== '**' &&
24530
+ !(this.isWindows && /^[a-z]:$/i.test(p))) {
24525
24531
  didSomething = true;
24526
24532
  parts.splice(dd - 1, 2);
24527
24533
  dd -= 2;
@@ -24770,15 +24776,17 @@ function requireCommonjs () {
24770
24776
  // split the pattern up into globstar-delimited sections
24771
24777
  // the tail has to be at the end, and the others just have
24772
24778
  // to be found in order from the head.
24773
- const [head, body, tail] = partial ? [
24774
- pattern.slice(patternIndex, firstgs),
24775
- pattern.slice(firstgs + 1),
24776
- [],
24777
- ] : [
24778
- pattern.slice(patternIndex, firstgs),
24779
- pattern.slice(firstgs + 1, lastgs),
24780
- pattern.slice(lastgs + 1),
24781
- ];
24779
+ const [head, body, tail] = partial ?
24780
+ [
24781
+ pattern.slice(patternIndex, firstgs),
24782
+ pattern.slice(firstgs + 1),
24783
+ [],
24784
+ ]
24785
+ : [
24786
+ pattern.slice(patternIndex, firstgs),
24787
+ pattern.slice(firstgs + 1, lastgs),
24788
+ pattern.slice(lastgs + 1),
24789
+ ];
24782
24790
  // check the head, from the current file/pattern index.
24783
24791
  if (head.length) {
24784
24792
  const fileHead = file.slice(fileIndex, fileIndex + head.length);
@@ -25124,7 +25132,7 @@ function requireCommonjs () {
25124
25132
  this.regexp = new RegExp(re, [...flags].join(''));
25125
25133
  /* c8 ignore start */
25126
25134
  }
25127
- catch (ex) {
25135
+ catch {
25128
25136
  // should be impossible
25129
25137
  this.regexp = false;
25130
25138
  }
@@ -25139,7 +25147,7 @@ function requireCommonjs () {
25139
25147
  if (this.preserveMultipleSlashes) {
25140
25148
  return p.split('/');
25141
25149
  }
25142
- else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
25150
+ else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
25143
25151
  // add an extra '' for the one we lose
25144
25152
  return ['', ...p.split(/\/+/)];
25145
25153
  }
@@ -25181,8 +25189,7 @@ function requireCommonjs () {
25181
25189
  filename = ff[i];
25182
25190
  }
25183
25191
  }
25184
- for (let i = 0; i < set.length; i++) {
25185
- const pattern = set[i];
25192
+ for (const pattern of set) {
25186
25193
  let file = ff;
25187
25194
  if (options.matchBase && pattern.length === 1) {
25188
25195
  file = [filename];
@@ -25301,7 +25308,7 @@ function requireCjs$1 () {
25301
25308
  class ValidationStrategy {
25302
25309
  /**
25303
25310
  * Validates that a value is an array.
25304
- * @param {*} value The value to validate.
25311
+ * @param {unknown} value The value to validate.
25305
25312
  * @returns {void}
25306
25313
  * @throws {TypeError} If the value is invalid.
25307
25314
  */
@@ -25313,19 +25320,19 @@ function requireCjs$1 () {
25313
25320
 
25314
25321
  /**
25315
25322
  * Validates that a value is a boolean.
25316
- * @param {*} value The value to validate.
25323
+ * @param {unknown} value The value to validate.
25317
25324
  * @returns {void}
25318
25325
  * @throws {TypeError} If the value is invalid.
25319
25326
  */
25320
25327
  static boolean(value) {
25321
25328
  if (typeof value !== "boolean") {
25322
- throw new TypeError("Expected a Boolean.");
25329
+ throw new TypeError("Expected a boolean.");
25323
25330
  }
25324
25331
  }
25325
25332
 
25326
25333
  /**
25327
25334
  * Validates that a value is a number.
25328
- * @param {*} value The value to validate.
25335
+ * @param {unknown} value The value to validate.
25329
25336
  * @returns {void}
25330
25337
  * @throws {TypeError} If the value is invalid.
25331
25338
  */
@@ -25336,8 +25343,8 @@ function requireCjs$1 () {
25336
25343
  }
25337
25344
 
25338
25345
  /**
25339
- * Validates that a value is a object.
25340
- * @param {*} value The value to validate.
25346
+ * Validates that a value is an object.
25347
+ * @param {unknown} value The value to validate.
25341
25348
  * @returns {void}
25342
25349
  * @throws {TypeError} If the value is invalid.
25343
25350
  */
@@ -25348,8 +25355,8 @@ function requireCjs$1 () {
25348
25355
  }
25349
25356
 
25350
25357
  /**
25351
- * Validates that a value is a object or null.
25352
- * @param {*} value The value to validate.
25358
+ * Validates that a value is an object or null.
25359
+ * @param {unknown} value The value to validate.
25353
25360
  * @returns {void}
25354
25361
  * @throws {TypeError} If the value is invalid.
25355
25362
  */
@@ -25361,7 +25368,7 @@ function requireCjs$1 () {
25361
25368
 
25362
25369
  /**
25363
25370
  * Validates that a value is a string.
25364
- * @param {*} value The value to validate.
25371
+ * @param {unknown} value The value to validate.
25365
25372
  * @returns {void}
25366
25373
  * @throws {TypeError} If the value is invalid.
25367
25374
  */
@@ -25373,7 +25380,7 @@ function requireCjs$1 () {
25373
25380
 
25374
25381
  /**
25375
25382
  * Validates that a value is a non-empty string.
25376
- * @param {*} value The value to validate.
25383
+ * @param {unknown} value The value to validate.
25377
25384
  * @returns {void}
25378
25385
  * @throws {TypeError} If the value is invalid.
25379
25386
  */
@@ -25548,13 +25555,17 @@ function requireCjs$1 () {
25548
25555
 
25549
25556
  // add in all strategies
25550
25557
  for (const key of Object.keys(definitions)) {
25551
- validateDefinition(key, definitions[key]);
25558
+ const definition = definitions[key];
25559
+
25560
+ validateDefinition(key, definition);
25561
+
25562
+ let normalizedDefinition = definition;
25552
25563
 
25553
25564
  // normalize merge and validate methods if subschema is present
25554
- if (typeof definitions[key].schema === "object") {
25555
- const schema = new ObjectSchema(definitions[key].schema);
25556
- definitions[key] = {
25557
- ...definitions[key],
25565
+ if (typeof normalizedDefinition.schema === "object") {
25566
+ const schema = new ObjectSchema(normalizedDefinition.schema);
25567
+ normalizedDefinition = {
25568
+ ...normalizedDefinition,
25558
25569
  merge(first = {}, second = {}) {
25559
25570
  return schema.merge(first, second);
25560
25571
  },
@@ -25566,30 +25577,25 @@ function requireCjs$1 () {
25566
25577
  }
25567
25578
 
25568
25579
  // normalize the merge method in case there's a string
25569
- if (typeof definitions[key].merge === "string") {
25570
- definitions[key] = {
25571
- ...definitions[key],
25572
- merge: MergeStrategy[
25573
- /** @type {string} */ (definitions[key].merge)
25574
- ],
25580
+ if (typeof normalizedDefinition.merge === "string") {
25581
+ normalizedDefinition = {
25582
+ ...normalizedDefinition,
25583
+ merge: MergeStrategy[normalizedDefinition.merge],
25575
25584
  };
25576
25585
  }
25577
25586
 
25578
25587
  // normalize the validate method in case there's a string
25579
- if (typeof definitions[key].validate === "string") {
25580
- definitions[key] = {
25581
- ...definitions[key],
25582
- validate:
25583
- ValidationStrategy[
25584
- /** @type {string} */ (definitions[key].validate)
25585
- ],
25588
+ if (typeof normalizedDefinition.validate === "string") {
25589
+ normalizedDefinition = {
25590
+ ...normalizedDefinition,
25591
+ validate: ValidationStrategy[normalizedDefinition.validate],
25586
25592
  };
25587
25593
  }
25588
25594
 
25589
- this.#definitions.set(key, definitions[key]);
25595
+ this.#definitions.set(key, normalizedDefinition);
25590
25596
 
25591
- if (definitions[key].required) {
25592
- this.#requiredKeys.set(key, definitions[key]);
25597
+ if (normalizedDefinition.required) {
25598
+ this.#requiredKeys.set(key, normalizedDefinition);
25593
25599
  }
25594
25600
  }
25595
25601
  }
@@ -35344,6 +35350,76 @@ function requireConfig () {
35344
35350
  };
35345
35351
  }
35346
35352
 
35353
+ /**
35354
+ * Normalizes a language name by replacing the built-in `@/` plugin prefix with `js/`.
35355
+ * @param {string} languageName The language name to normalize.
35356
+ * @returns {string} The normalized language name.
35357
+ */
35358
+ function normalizeLanguageName(languageName) {
35359
+ return languageName.startsWith("@/")
35360
+ ? `js/${languageName.slice(2)}`
35361
+ : languageName;
35362
+ }
35363
+
35364
+ /**
35365
+ * Checks if a rule's `meta.languages` supports the given language.
35366
+ * @param {Array<string>|undefined} ruleLangs The rule's `meta.languages` array.
35367
+ * @param {string} configLanguageName The normalized language name from the config (e.g., "js/js").
35368
+ * @param {Array<string>} validPluginNames The valid plugin name aliases for the config's plugin
35369
+ * (normalized plugin name plus its `meta.namespace` if defined).
35370
+ * @returns {boolean} True if the rule supports the language, false otherwise.
35371
+ */
35372
+ function doesRuleSupportLanguage(
35373
+ ruleLangs,
35374
+ configLanguageName,
35375
+ validPluginNames,
35376
+ ) {
35377
+ // If no languages specified, works with all languages (backward compatible)
35378
+ if (!ruleLangs) {
35379
+ return true;
35380
+ }
35381
+
35382
+ const { objectName: configLangPart } =
35383
+ splitPluginIdentifier(configLanguageName);
35384
+
35385
+ for (const langEntry of ruleLangs) {
35386
+ // Skip non-string entries
35387
+ if (typeof langEntry !== "string") {
35388
+ continue;
35389
+ }
35390
+
35391
+ // "*" matches any language
35392
+ if (langEntry === "*") {
35393
+ return true;
35394
+ }
35395
+
35396
+ // Direct match
35397
+ if (langEntry === configLanguageName) {
35398
+ return true;
35399
+ }
35400
+
35401
+ const { pluginName: rulePluginPart, objectName: ruleLangPart } =
35402
+ splitPluginIdentifier(langEntry);
35403
+
35404
+ // "plugin/*" wildcard - matches any language from that plugin (by name or namespace)
35405
+ if (ruleLangPart === "*") {
35406
+ if (validPluginNames.includes(rulePluginPart)) {
35407
+ return true;
35408
+ }
35409
+ } else {
35410
+ // Match by plugin name or namespace, with exact language part
35411
+ if (
35412
+ validPluginNames.includes(rulePluginPart) &&
35413
+ ruleLangPart === configLangPart
35414
+ ) {
35415
+ return true;
35416
+ }
35417
+ }
35418
+ }
35419
+
35420
+ return false;
35421
+ }
35422
+
35347
35423
  /**
35348
35424
  * Returns the name of an object in the config by reading its `meta` key.
35349
35425
  * @param {Object} object The object to check.
@@ -35688,12 +35764,30 @@ function requireConfig () {
35688
35764
  * @throws {TypeError} If the rulesConfig is not provided or is invalid.
35689
35765
  * @throws {InvalidRuleOptionsSchemaError} If a rule's `meta.schema` is invalid.
35690
35766
  * @throws {TypeError} If a rule is not found in the plugins.
35767
+ * @throws {TypeError} If a rule does not support the current language.
35691
35768
  */
35692
35769
  validateRulesConfig(rulesConfig) {
35693
35770
  if (!rulesConfig) {
35694
35771
  throw new TypeError("Config is required for validation.");
35695
35772
  }
35696
35773
 
35774
+ // Normalize "@/" prefix to "js/" for matching and user-facing messages
35775
+ const normalizedLanguageName = normalizeLanguageName(
35776
+ this.#languageName,
35777
+ );
35778
+
35779
+ // Compute valid plugin name aliases for the config's language plugin once
35780
+ const { pluginName: configPluginName } = splitPluginIdentifier(
35781
+ normalizedLanguageName,
35782
+ );
35783
+ const configPlugin =
35784
+ this.plugins[configPluginName] ??
35785
+ (configPluginName === "js" ? this.plugins["@"] : void 0);
35786
+ const validPluginNames = configPlugin?.meta?.namespace
35787
+ ? [configPluginName, configPlugin.meta.namespace]
35788
+ : [configPluginName];
35789
+ const unsupportedLanguageRules = [];
35790
+
35697
35791
  for (const [ruleId, ruleOptions] of Object.entries(rulesConfig)) {
35698
35792
  // check for edge case
35699
35793
  if (ruleId === "__proto__") {
@@ -35719,6 +35813,34 @@ function requireConfig () {
35719
35813
  throwRuleNotFoundError(parseRuleId(ruleId), this);
35720
35814
  }
35721
35815
 
35816
+ // Validate meta.languages structure if present (only for enabled rules)
35817
+ if (rule.meta?.languages !== void 0) {
35818
+ if (!Array.isArray(rule.meta.languages)) {
35819
+ throw new TypeError(
35820
+ `Key "rules": Key "${ruleId}": Key "meta": Key "languages": Expected an array.`,
35821
+ );
35822
+ }
35823
+
35824
+ for (const lang of rule.meta.languages) {
35825
+ if (typeof lang !== "string") {
35826
+ throw new TypeError(
35827
+ `Key "rules": Key "${ruleId}": Key "meta": Key "languages": Expected each element to be a string.`,
35828
+ );
35829
+ }
35830
+ }
35831
+ }
35832
+
35833
+ // Check if the rule supports the current language
35834
+ if (
35835
+ !doesRuleSupportLanguage(
35836
+ rule.meta?.languages,
35837
+ normalizedLanguageName,
35838
+ validPluginNames,
35839
+ )
35840
+ ) {
35841
+ unsupportedLanguageRules.push(ruleId);
35842
+ }
35843
+
35722
35844
  const validateRule = getOrCreateValidator(rule, ruleId);
35723
35845
 
35724
35846
  if (validateRule) {
@@ -35750,6 +35872,19 @@ function requireConfig () {
35750
35872
  }
35751
35873
  }
35752
35874
  }
35875
+
35876
+ if (unsupportedLanguageRules.length > 0) {
35877
+ const error = new TypeError(
35878
+ `Key "rules": The following rules do not support the language "${normalizedLanguageName}":\n${unsupportedLanguageRules.map(ruleId => `\t- "${ruleId}"`).join("\n")}`,
35879
+ );
35880
+
35881
+ error.messageTemplate = "rule-unsupported-language";
35882
+ error.messageData = {
35883
+ ruleIds: unsupportedLanguageRules,
35884
+ language: normalizedLanguageName,
35885
+ };
35886
+ throw error;
35887
+ }
35753
35888
  }
35754
35889
 
35755
35890
  /**
@@ -45111,24 +45246,24 @@ function requireEspree () {
45111
45246
  * Normalize sourceType from the initial config
45112
45247
  * @param {string} sourceType to normalize
45113
45248
  * @throws {Error} throw an error if sourceType is invalid
45114
- * @returns {"script"|"module"} normalized sourceType
45249
+ * @returns {"script"|"module"|"commonjs"} normalized sourceType
45115
45250
  */
45116
45251
  function normalizeSourceType(sourceType = "script") {
45117
- if (sourceType === "script" || sourceType === "module") {
45252
+ if (
45253
+ sourceType === "script" ||
45254
+ sourceType === "module" ||
45255
+ sourceType === "commonjs"
45256
+ ) {
45118
45257
  return sourceType;
45119
45258
  }
45120
45259
 
45121
- if (sourceType === "commonjs") {
45122
- return "script";
45123
- }
45124
-
45125
45260
  throw new Error("Invalid sourceType.");
45126
45261
  }
45127
45262
 
45128
45263
  /**
45129
45264
  * @typedef {{
45130
45265
  * ecmaVersion: NormalizedEcmaVersion,
45131
- * sourceType: "script"|"module",
45266
+ * sourceType: "script"|"module"|"commonjs",
45132
45267
  * range?: boolean,
45133
45268
  * loc?: boolean,
45134
45269
  * allowReserved: boolean | "never",
@@ -45933,7 +46068,7 @@ function requireEspree () {
45933
46068
  //------------------------------------------------------------------------------
45934
46069
 
45935
46070
  /** @type {string} */
45936
- const version = "11.1.1"; // x-release-please-version
46071
+ const version = "11.2.0"; // x-release-please-version
45937
46072
  const name = "espree";
45938
46073
 
45939
46074
  // Derive node types from VisitorKeys
@@ -46419,9 +46554,9 @@ function requireAstUtils () {
46419
46554
  if (left.regex || right.regex) {
46420
46555
  return Boolean(
46421
46556
  left.regex &&
46422
- right.regex &&
46423
- left.regex.pattern === right.regex.pattern &&
46424
- left.regex.flags === right.regex.flags,
46557
+ right.regex &&
46558
+ left.regex.pattern === right.regex.pattern &&
46559
+ left.regex.flags === right.regex.flags,
46425
46560
  );
46426
46561
  }
46427
46562
 
@@ -47062,9 +47197,9 @@ function requireAstUtils () {
47062
47197
 
47063
47198
  return Boolean(
47064
47199
  reference &&
47065
- reference.resolved &&
47066
- reference.resolved.scope.type === "global" &&
47067
- reference.resolved.defs.length === 0,
47200
+ reference.resolved &&
47201
+ reference.resolved.scope.type === "global" &&
47202
+ reference.resolved.defs.length === 0,
47068
47203
  );
47069
47204
  }
47070
47205
 
@@ -53154,9 +53289,9 @@ function requireCapitalizedComments () {
53154
53289
 
53155
53290
  return Boolean(
53156
53291
  previousToken &&
53157
- nextToken &&
53158
- comment.loc.start.line === previousToken.loc.end.line &&
53159
- comment.loc.end.line === nextToken.loc.start.line,
53292
+ nextToken &&
53293
+ comment.loc.start.line === previousToken.loc.end.line &&
53294
+ comment.loc.end.line === nextToken.loc.start.line,
53160
53295
  );
53161
53296
  }
53162
53297
 
@@ -53172,7 +53307,7 @@ function requireCapitalizedComments () {
53172
53307
 
53173
53308
  return Boolean(
53174
53309
  previousTokenOrComment &&
53175
- ["Block", "Line"].includes(previousTokenOrComment.type),
53310
+ ["Block", "Line"].includes(previousTokenOrComment.type),
53176
53311
  );
53177
53312
  }
53178
53313
 
@@ -82358,11 +82493,11 @@ function requireNoExtendNative () {
82358
82493
  function isPrototypePropertyAccessed(identifierNode) {
82359
82494
  return Boolean(
82360
82495
  identifierNode &&
82361
- identifierNode.parent &&
82362
- identifierNode.parent.type === "MemberExpression" &&
82363
- identifierNode.parent.object === identifierNode &&
82364
- astUtils.getStaticPropertyName(identifierNode.parent) ===
82365
- "prototype",
82496
+ identifierNode.parent &&
82497
+ identifierNode.parent.type === "MemberExpression" &&
82498
+ identifierNode.parent.object === identifierNode &&
82499
+ astUtils.getStaticPropertyName(identifierNode.parent) ===
82500
+ "prototype",
82366
82501
  );
82367
82502
  }
82368
82503
 
@@ -92704,7 +92839,14 @@ function requireNoObjCalls () {
92704
92839
  // Helpers
92705
92840
  //------------------------------------------------------------------------------
92706
92841
 
92707
- const nonCallableGlobals = ["Atomics", "JSON", "Math", "Reflect", "Intl"];
92842
+ const nonCallableGlobals = [
92843
+ "Atomics",
92844
+ "JSON",
92845
+ "Math",
92846
+ "Reflect",
92847
+ "Intl",
92848
+ "Temporal",
92849
+ ];
92708
92850
 
92709
92851
  /**
92710
92852
  * Returns the name of the node to report
@@ -99723,9 +99865,7 @@ function requireNoThisBeforeSuper () {
99723
99865
  isConstructor: true,
99724
99866
  hasExtends: Boolean(
99725
99867
  classNode.superClass &&
99726
- !astUtils.isNullOrUndefined(
99727
- classNode.superClass,
99728
- ),
99868
+ !astUtils.isNullOrUndefined(classNode.superClass),
99729
99869
  ),
99730
99870
  codePath,
99731
99871
  currentSegments: new Set(),
@@ -101254,6 +101394,35 @@ function requireNoUnmodifiedLoopCondition () {
101254
101394
  return null;
101255
101395
  }
101256
101396
 
101397
+ /**
101398
+ * Checks whether a given modifier is in a loop.
101399
+ *
101400
+ * Besides checking for the condition being in the loop, this also checks
101401
+ * whether the function that this modifier is belonging to is called
101402
+ * in the loop.
101403
+ * @param {LoopConditionInfo} condition The condition to check.
101404
+ * @param {Reference} modifier The modifier to check.
101405
+ * @returns {boolean} `true` if the modifier is in a loop.
101406
+ */
101407
+ function hasModifierInLoop(condition, modifier) {
101408
+ if (condition.isInLoop(modifier)) {
101409
+ return true;
101410
+ }
101411
+
101412
+ const funcNode = getEncloseFunctionDeclaration(modifier);
101413
+
101414
+ if (!funcNode) {
101415
+ return false;
101416
+ }
101417
+
101418
+ const funcVar = astUtils.getVariableByName(
101419
+ modifier.from.upper,
101420
+ funcNode.id.name,
101421
+ );
101422
+
101423
+ return Boolean(funcVar && funcVar.references.some(condition.isInLoop));
101424
+ }
101425
+
101257
101426
  /**
101258
101427
  * Updates the "modified" flags of given loop conditions with given modifiers.
101259
101428
  * @param {LoopConditionInfo[]} conditions The loop conditions to be updated.
@@ -101266,26 +101435,8 @@ function requireNoUnmodifiedLoopCondition () {
101266
101435
 
101267
101436
  for (let j = 0; !condition.modified && j < modifiers.length; ++j) {
101268
101437
  const modifier = modifiers[j];
101269
- let funcNode, funcVar;
101270
-
101271
- /*
101272
- * Besides checking for the condition being in the loop, we want to
101273
- * check the function that this modifier is belonging to is called
101274
- * in the loop.
101275
- * FIXME: This should probably be extracted to a function.
101276
- */
101277
- const inLoop =
101278
- condition.isInLoop(modifier) ||
101279
- Boolean(
101280
- (funcNode = getEncloseFunctionDeclaration(modifier)) &&
101281
- (funcVar = astUtils.getVariableByName(
101282
- modifier.from.upper,
101283
- funcNode.id.name,
101284
- )) &&
101285
- funcVar.references.some(condition.isInLoop),
101286
- );
101287
101438
 
101288
- condition.modified = inLoop;
101439
+ condition.modified = hasModifierInLoop(condition, modifier);
101289
101440
  }
101290
101441
  }
101291
101442
  }
@@ -108558,6 +108709,28 @@ function requireNoVar () {
108558
108709
  return variable.name === "let";
108559
108710
  }
108560
108711
 
108712
+ /**
108713
+ * Checks whether a given variable has any references before its declaration.
108714
+ * This is important because var allows hoisting, but let/const do not.
108715
+ * @param {Variable} variable The variable to check.
108716
+ * @returns {boolean} `true` if the variable is referenced before its declaration.
108717
+ */
108718
+ function hasReferenceBeforeDeclaration(variable) {
108719
+ const declarationStart = variable.defs[0].node.range[0];
108720
+
108721
+ return variable.references.some(reference => {
108722
+ const referenceStart = reference.identifier.range[0];
108723
+
108724
+ /*
108725
+ * Check if the reference occurs before the declaration.
108726
+ * We don't need to check scopes because all references to this variable
108727
+ * are already in variable.references (which only includes references
108728
+ * that resolve to this specific variable binding).
108729
+ */
108730
+ return !reference.init && referenceStart < declarationStart;
108731
+ });
108732
+ }
108733
+
108561
108734
  //------------------------------------------------------------------------------
108562
108735
  // Rule Definition
108563
108736
  //------------------------------------------------------------------------------
@@ -108611,6 +108784,7 @@ function requireNoVar () {
108611
108784
  * - A variable is used from a closure within a loop.
108612
108785
  * - A variable might be used before it is assigned within a loop.
108613
108786
  * - A variable might be used in TDZ.
108787
+ * - A variable is referenced before its declaration.
108614
108788
  * - A variable is declared in statement position (e.g. a single-line `IfStatement`)
108615
108789
  * - A variable has name that is disallowed for `let` declarations.
108616
108790
  *
@@ -108655,6 +108829,10 @@ function requireNoVar () {
108655
108829
  function canFix(node) {
108656
108830
  const variables = sourceCode.getDeclaredVariables(node);
108657
108831
  const scopeNode = getScopeNode(node);
108832
+ const parentStatementList = new Set([
108833
+ ...astUtils.STATEMENT_LIST_PARENTS,
108834
+ "TSModuleBlock",
108835
+ ]);
108658
108836
 
108659
108837
  if (
108660
108838
  node.parent.type === "SwitchCase" ||
@@ -108662,7 +108840,8 @@ function requireNoVar () {
108662
108840
  variables.some(isGlobal) ||
108663
108841
  variables.some(isRedeclared) ||
108664
108842
  variables.some(isUsedFromOutsideOf(scopeNode)) ||
108665
- variables.some(hasNameDisallowedForLetDeclarations)
108843
+ variables.some(hasNameDisallowedForLetDeclarations) ||
108844
+ variables.some(hasReferenceBeforeDeclaration)
108666
108845
  ) {
108667
108846
  return false;
108668
108847
  }
@@ -108682,7 +108861,7 @@ function requireNoVar () {
108682
108861
  node.parent.type === "ForStatement" &&
108683
108862
  node.parent.init === node
108684
108863
  ) &&
108685
- !astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)
108864
+ !parentStatementList.has(node.parent.type)
108686
108865
  ) {
108687
108866
  // If the declaration is not in a block, e.g. `if (foo) var bar = 1;`, then it can't be fixed.
108688
108867
  return false;
@@ -112985,11 +113164,11 @@ function requirePaddingLineBetweenStatements () {
112985
113164
  const nextToken = sourceCode.getTokenAfter(semiToken);
112986
113165
  const isSemicolonLessStyle = Boolean(
112987
113166
  prevToken &&
112988
- nextToken &&
112989
- prevToken.range[0] >= node.range[0] &&
112990
- astUtils.isSemicolonToken(semiToken) &&
112991
- semiToken.loc.start.line !== prevToken.loc.end.line &&
112992
- semiToken.loc.end.line === nextToken.loc.start.line,
113167
+ nextToken &&
113168
+ prevToken.range[0] >= node.range[0] &&
113169
+ astUtils.isSemicolonToken(semiToken) &&
113170
+ semiToken.loc.start.line !== prevToken.loc.end.line &&
113171
+ semiToken.loc.end.line === nextToken.loc.start.line,
112993
113172
  );
112994
113173
 
112995
113174
  return isSemicolonLessStyle ? prevToken : semiToken;
@@ -131019,6 +131198,22 @@ function requireLinter () {
131019
131198
  throw err;
131020
131199
  }
131021
131200
 
131201
+ /*
131202
+ * If the rule does not support the current language, report a
131203
+ * specific, actionable error message.
131204
+ */
131205
+ if (
131206
+ err.messageTemplate ===
131207
+ "rule-unsupported-language"
131208
+ ) {
131209
+ report.addError({
131210
+ ruleId,
131211
+ 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`,
131212
+ loc,
131213
+ });
131214
+ return;
131215
+ }
131216
+
131022
131217
  let baseMessage = err.message
131023
131218
  .slice(
131024
131219
  err.message.startsWith('Key "rules":')