@plugjs/eslint-plugin 0.2.15 → 0.2.17

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.
@@ -30,7 +30,7 @@ var require_package = __commonJS({
30
30
  "node_modules/eslint-plugin-import-x/package.json"(exports2, module2) {
31
31
  module2.exports = {
32
32
  name: "eslint-plugin-import-x",
33
- version: "4.1.1",
33
+ version: "4.2.1",
34
34
  description: "Import with sanity.",
35
35
  repository: "git+https://github.com/un-ts/eslint-plugin-import-x",
36
36
  author: "JounQin <admin@1stg.me> (https://www.1stG.me)",
@@ -78,7 +78,6 @@ var require_package = __commonJS({
78
78
  eslint: "^8.57.0 || ^9.0.0"
79
79
  },
80
80
  dependencies: {
81
- "@typescript-eslint/typescript-estree": "^8.1.0",
82
81
  "@typescript-eslint/utils": "^8.1.0",
83
82
  debug: "^4.3.4",
84
83
  doctrine: "^3.0.0",
@@ -314,9 +313,7 @@ var require_typescript = __commonJS({
314
313
  "@typescript-eslint/parser": [...typeScriptExtensions]
315
314
  },
316
315
  "import-x/resolver": {
317
- node: {
318
- extensions: allExtensions
319
- }
316
+ typescript: true
320
317
  }
321
318
  },
322
319
  rules: {
@@ -434,9 +431,7 @@ var require_typescript2 = __commonJS({
434
431
  "@typescript-eslint/parser": [...typeScriptExtensions]
435
432
  },
436
433
  "import-x/resolver": {
437
- node: {
438
- extensions: allExtensions
439
- }
434
+ typescript: true
440
435
  }
441
436
  },
442
437
  rules: {
@@ -680,9 +675,12 @@ var require_parse = __commonJS({
680
675
  exports2.parse = parse;
681
676
  var tslib_12 = require("tslib");
682
677
  var node_path_1 = tslib_12.__importDefault(require("node:path"));
683
- var typescript_estree_1 = require("@typescript-eslint/typescript-estree");
684
678
  var debug_1 = tslib_12.__importDefault(require("debug"));
685
679
  var module_require_1 = require_module_require();
680
+ function withoutProjectParserOptions(opts) {
681
+ const { EXPERIMENTAL_useProjectService, project, projectService, ...rest } = opts;
682
+ return rest;
683
+ }
686
684
  var log = (0, debug_1.default)("eslint-plugin-import-x:parse");
687
685
  function keysFromParser(parserPath, parserInstance, parsedResult) {
688
686
  if (parsedResult && parsedResult.visitorKeys) {
@@ -722,7 +720,7 @@ var require_parse = __commonJS({
722
720
  parserOptions.loc = true;
723
721
  parserOptions.range = true;
724
722
  parserOptions.filePath = path;
725
- parserOptions = (0, typescript_estree_1.withoutProjectParserOptions)(parserOptions);
723
+ parserOptions = withoutProjectParserOptions(parserOptions);
726
724
  const parser = typeof parserOrPath === "string" ? (0, module_require_1.moduleRequire)(parserOrPath) : parserOrPath;
727
725
  content = transformHashbang(stripUnicodeBOM(String(content)));
728
726
  if ("parseForESLint" in parser && typeof parser.parseForESLint === "function") {
@@ -3876,7 +3874,7 @@ var require_newline_after_import = __commonJS({
3876
3874
  });
3877
3875
  }
3878
3876
  }
3879
- function commentAfterImport(node, nextComment) {
3877
+ function commentAfterImport(node, nextComment, type) {
3880
3878
  const lineDifference = getLineDifference(node, nextComment);
3881
3879
  const EXPECTED_LINE_DIFFERENCE = options.count + 1;
3882
3880
  if (lineDifference < EXPECTED_LINE_DIFFERENCE) {
@@ -3893,7 +3891,7 @@ var require_newline_after_import = __commonJS({
3893
3891
  data: {
3894
3892
  count: options.count,
3895
3893
  lineSuffix: options.count > 1 ? "s" : "",
3896
- type: "import"
3894
+ type
3897
3895
  },
3898
3896
  fix: options.exactCount && EXPECTED_LINE_DIFFERENCE < lineDifference ? void 0 : (fixer) => fixer.insertTextAfter(node, "\n".repeat(EXPECTED_LINE_DIFFERENCE - lineDifference))
3899
3897
  });
@@ -3922,7 +3920,7 @@ var require_newline_after_import = __commonJS({
3922
3920
  return;
3923
3921
  }
3924
3922
  if (nextComment) {
3925
- commentAfterImport(node, nextComment);
3923
+ commentAfterImport(node, nextComment, "import");
3926
3924
  } else if (nextNode && nextNode.type !== "ImportDeclaration" && (nextNode.type !== "TSImportEqualsDeclaration" || nextNode.isExport)) {
3927
3925
  checkForNewLine(node, nextNode, "import");
3928
3926
  }
@@ -3949,7 +3947,16 @@ var require_newline_after_import = __commonJS({
3949
3947
  continue;
3950
3948
  }
3951
3949
  if (nextStatement && (!nextRequireCall || !containsNodeOrEqual(nextStatement, nextRequireCall))) {
3952
- checkForNewLine(statementWithRequireCall, nextStatement, "require");
3950
+ let nextComment;
3951
+ if ("comments" in statementWithRequireCall.parent && statementWithRequireCall.parent.comments !== void 0 && options.considerComments) {
3952
+ const endLine = node2.loc.end.line;
3953
+ nextComment = statementWithRequireCall.parent.comments.find((o) => o.loc.start.line >= endLine && o.loc.start.line <= endLine + options.count + 1);
3954
+ }
3955
+ if (nextComment && nextComment !== void 0) {
3956
+ commentAfterImport(statementWithRequireCall, nextComment, "require");
3957
+ } else {
3958
+ checkForNewLine(statementWithRequireCall, nextStatement, "require");
3959
+ }
3953
3960
  }
3954
3961
  }
3955
3962
  },
@@ -4783,6 +4790,18 @@ var require_no_duplicates = __commonJS({
4783
4790
  ];
4784
4791
  }, ["", !firstHasTrailingComma && !firstIsEmpty, firstExistingIdentifiers]);
4785
4792
  const fixes = [];
4793
+ if (shouldAddSpecifiers && preferInline && first.importKind === "type") {
4794
+ const typeIdentifierToken = tokens.find((token) => token.type === "Identifier" && token.value === "type");
4795
+ if (typeIdentifierToken) {
4796
+ fixes.push(fixer.removeRange([
4797
+ typeIdentifierToken.range[0],
4798
+ typeIdentifierToken.range[1] + 1
4799
+ ]));
4800
+ }
4801
+ for (const identifier of tokens.filter((token) => firstExistingIdentifiers.has(token.value))) {
4802
+ fixes.push(fixer.replaceTextRange([identifier.range[0], identifier.range[1]], `type ${identifier.value}`));
4803
+ }
4804
+ }
4786
4805
  if (openBrace == null && shouldAddSpecifiers && shouldAddDefault()) {
4787
4806
  fixes.push(fixer.insertTextAfter(firstToken, ` ${defaultImportName}, {${specifiersText}} from`));
4788
4807
  } else if (openBrace == null && !shouldAddSpecifiers && shouldAddDefault()) {
@@ -5251,7 +5270,7 @@ var require_no_extraneous_dependencies = __commonJS({
5251
5270
  isInBundledDeps: result.isInBundledDeps || deps.bundledDependencies.includes(ancestorName)
5252
5271
  }), newDeclarationStatus);
5253
5272
  }
5254
- function reportIfMissing(context, deps, depsOptions, node, name) {
5273
+ function reportIfMissing(context, deps, depsOptions, node, name, whitelist) {
5255
5274
  if (!depsOptions.verifyTypeImports && ("importKind" in node && (node.importKind === "type" || node.importKind === "typeof") || "exportKind" in node && node.exportKind === "type" || "specifiers" in node && Array.isArray(node.specifiers) && node.specifiers.length > 0 && node.specifiers.every((specifier) => "importKind" in specifier && (specifier.importKind === "type" || specifier.importKind === "typeof")))) {
5256
5275
  return;
5257
5276
  }
@@ -5276,6 +5295,9 @@ var require_no_extraneous_dependencies = __commonJS({
5276
5295
  }
5277
5296
  }
5278
5297
  const packageName = realPackageName || importPackageName;
5298
+ if (whitelist?.has(packageName)) {
5299
+ return;
5300
+ }
5279
5301
  if (declarationStatus.isInDevDeps && !depsOptions.allowDevDeps) {
5280
5302
  context.report({
5281
5303
  node,
@@ -5328,7 +5350,8 @@ var require_no_extraneous_dependencies = __commonJS({
5328
5350
  bundledDependencies: { type: ["boolean", "array"] },
5329
5351
  packageDir: { type: ["string", "array"] },
5330
5352
  includeInternal: { type: ["boolean"] },
5331
- includeTypes: { type: ["boolean"] }
5353
+ includeTypes: { type: ["boolean"] },
5354
+ whitelist: { type: ["array"] }
5332
5355
  },
5333
5356
  additionalProperties: false
5334
5357
  }
@@ -5356,7 +5379,7 @@ var require_no_extraneous_dependencies = __commonJS({
5356
5379
  };
5357
5380
  return {
5358
5381
  ...(0, utils_1.moduleVisitor)((source, node) => {
5359
- reportIfMissing(context, deps, depsOptions, node, source.value);
5382
+ reportIfMissing(context, deps, depsOptions, node, source.value, options.whitelist ? new Set(options.whitelist) : void 0);
5360
5383
  }, { commonjs: true }),
5361
5384
  "Program:exit"() {
5362
5385
  depFieldCache.clear();
@@ -6970,15 +6993,9 @@ var require_no_unused_modules = __commonJS({
6970
6993
  }
6971
6994
  }
6972
6995
  };
6973
- var getSrc = (src) => {
6974
- if (src) {
6975
- return src;
6976
- }
6977
- return [process.cwd()];
6978
- };
6979
6996
  var srcFiles;
6980
6997
  var lastPrepareKey;
6981
- var doPreparation = (src = [], ignoreExports, context) => {
6998
+ var doPreparation = (src, ignoreExports, context) => {
6982
6999
  const prepareKey = JSON.stringify({
6983
7000
  src: src.sort(),
6984
7001
  ignoreExports: (ignoreExports || []).sort(),
@@ -6991,7 +7008,7 @@ var require_no_unused_modules = __commonJS({
6991
7008
  exportList.clear();
6992
7009
  ignoredFiles.clear();
6993
7010
  filesOutsideSrc.clear();
6994
- srcFiles = resolveFiles(getSrc(src), ignoreExports, context);
7011
+ srcFiles = resolveFiles(src, ignoreExports, context);
6995
7012
  prepareImportsAndExports(srcFiles, context);
6996
7013
  determineUsage();
6997
7014
  lastPrepareKey = prepareKey;
@@ -7115,7 +7132,7 @@ var require_no_unused_modules = __commonJS({
7115
7132
  },
7116
7133
  defaultOptions: [],
7117
7134
  create(context) {
7118
- const { src, ignoreExports = [], missingExports, unusedExports, ignoreUnusedTypeExports } = context.options[0] || {};
7135
+ const { src = [process.cwd()], ignoreExports = [], missingExports, unusedExports, ignoreUnusedTypeExports } = context.options[0] || {};
7119
7136
  if (unusedExports) {
7120
7137
  doPreparation(src, ignoreExports, context);
7121
7138
  }
@@ -7161,7 +7178,7 @@ var require_no_unused_modules = __commonJS({
7161
7178
  return;
7162
7179
  }
7163
7180
  if (!srcFiles.has(filename)) {
7164
- srcFiles = resolveFiles(getSrc(src), ignoreExports, context);
7181
+ srcFiles = resolveFiles(src, ignoreExports, context);
7165
7182
  if (!srcFiles.has(filename)) {
7166
7183
  filesOutsideSrc.add(filename);
7167
7184
  return;
@@ -11,6 +11,29 @@ var require_utils = __commonJS({
11
11
  var eslintVisitorKeys = require("eslint-visitor-keys");
12
12
  var espree = require("espree");
13
13
  var estraverse = require("estraverse");
14
+ function createAllConfigs(plugin, name, flat, filter) {
15
+ const rules = Object.fromEntries(
16
+ Object.entries(plugin.rules).filter(
17
+ ([key, rule]) => (
18
+ // Only include fixable rules
19
+ rule.meta.fixable && !rule.meta.deprecated && key === rule.meta.docs.url.split("/").pop() && (!filter || filter(key, rule))
20
+ )
21
+ ).map(([key]) => [`${name}/${key}`, 2])
22
+ );
23
+ if (flat) {
24
+ return {
25
+ plugins: {
26
+ [name]: plugin
27
+ },
28
+ rules
29
+ };
30
+ } else {
31
+ return {
32
+ plugins: [name],
33
+ rules
34
+ };
35
+ }
36
+ }
14
37
  var anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u;
15
38
  var COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u;
16
39
  var LINEBREAKS = /* @__PURE__ */ new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
@@ -184,6 +207,7 @@ var require_utils = __commonJS({
184
207
  case "&&":
185
208
  return 5;
186
209
  }
210
+ /* falls through */
187
211
  case "BinaryExpression":
188
212
  switch (node.operator) {
189
213
  case "|":
@@ -218,6 +242,7 @@ var require_utils = __commonJS({
218
242
  case "**":
219
243
  return 15;
220
244
  }
245
+ /* falls through */
221
246
  case "UnaryExpression":
222
247
  case "AwaitExpression":
223
248
  return 16;
@@ -465,34 +490,6 @@ var require_utils = __commonJS({
465
490
  function castRuleModule(rule) {
466
491
  return rule;
467
492
  }
468
- function getVariable(variables, name) {
469
- return variables.find((variable) => variable.name === name);
470
- }
471
- function variablesInScope(context) {
472
- let scope = context.getScope();
473
- let variables = scope.variables;
474
- while (scope.type !== "global") {
475
- scope = scope.upper;
476
- variables = scope.variables.concat(variables);
477
- }
478
- if (scope.childScopes.length) {
479
- variables = scope.childScopes[0].variables.concat(variables);
480
- if (scope.childScopes[0].childScopes.length)
481
- variables = scope.childScopes[0].childScopes[0].variables.concat(variables);
482
- }
483
- variables.reverse();
484
- return variables;
485
- }
486
- function findVariableByName(context, name) {
487
- const variable = getVariable(variablesInScope(context), name);
488
- if (!variable || !variable.defs[0] || !variable.defs[0].node)
489
- return null;
490
- if (variable.defs[0].node.type === "TypeAlias")
491
- return variable.defs[0].node.right;
492
- if (variable.defs[0].type === "ImportBinding")
493
- return variable.defs[0].node;
494
- return variable.defs[0].node.init;
495
- }
496
493
  function traverse(ASTnode, visitor) {
497
494
  const opts = Object.assign({}, {
498
495
  fallback(node) {
@@ -543,6 +540,34 @@ var require_utils = __commonJS({
543
540
  }
544
541
  });
545
542
  }
543
+ function getVariable(variables, name) {
544
+ return variables.find((variable) => variable.name === name);
545
+ }
546
+ function variablesInScope(context) {
547
+ let scope = context.getScope();
548
+ let variables = scope.variables;
549
+ while (scope.type !== "global") {
550
+ scope = scope.upper;
551
+ variables = scope.variables.concat(variables);
552
+ }
553
+ if (scope.childScopes.length) {
554
+ variables = scope.childScopes[0].variables.concat(variables);
555
+ if (scope.childScopes[0].childScopes.length)
556
+ variables = scope.childScopes[0].childScopes[0].variables.concat(variables);
557
+ }
558
+ variables.reverse();
559
+ return variables;
560
+ }
561
+ function findVariableByName(context, name) {
562
+ const variable = getVariable(variablesInScope(context), name);
563
+ if (!variable || !variable.defs[0] || !variable.defs[0].node)
564
+ return null;
565
+ if (variable.defs[0].node.type === "TypeAlias")
566
+ return variable.defs[0].node.right;
567
+ if (variable.defs[0].type === "ImportBinding")
568
+ return variable.defs[0].node;
569
+ return variable.defs[0].node.init;
570
+ }
546
571
  var COMPAT_TAG_REGEX = /^[a-z]/;
547
572
  function isDOMComponent(node) {
548
573
  const name = getElementType(node);
@@ -632,6 +657,16 @@ var require_utils = __commonJS({
632
657
  segmenter ?? (segmenter = new Intl.Segmenter());
633
658
  return [...segmenter.segment(value)].length;
634
659
  }
660
+ var NullThrowsReasons = {
661
+ MissingParent: "Expected node to have a parent.",
662
+ MissingToken: (token, thing) => `Expected to find a ${token} for the ${thing}.`
663
+ };
664
+ function nullThrows(value, message) {
665
+ if (value == null) {
666
+ throw new Error(`Non-null Assertion Failed: ${message}`);
667
+ }
668
+ return value;
669
+ }
635
670
  var KEYWORDS_JS = [
636
671
  "abstract",
637
672
  "boolean",
@@ -693,16 +728,6 @@ var require_utils = __commonJS({
693
728
  "while",
694
729
  "with"
695
730
  ];
696
- var NullThrowsReasons = {
697
- MissingParent: "Expected node to have a parent.",
698
- MissingToken: (token, thing) => `Expected to find a ${token} for the ${thing}.`
699
- };
700
- function nullThrows(value, message) {
701
- if (value == null) {
702
- throw new Error(`Non-null Assertion Failed: ${message}`);
703
- }
704
- return value;
705
- }
706
731
  var __defProp = Object.defineProperty;
707
732
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
708
733
  var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
@@ -786,29 +811,6 @@ var require_utils = __commonJS({
786
811
  return this.replaceTextRange(nodeOrToken.range, "");
787
812
  }
788
813
  };
789
- function createAllConfigs(plugin, name, flat, filter) {
790
- const rules = Object.fromEntries(
791
- Object.entries(plugin.rules).filter(
792
- ([key, rule]) => (
793
- // Only include fixable rules
794
- rule.meta.fixable && !rule.meta.deprecated && key === rule.meta.docs.url.split("/").pop() && (!filter || filter(key, rule))
795
- )
796
- ).map(([key]) => [`${name}/${key}`, 2])
797
- );
798
- if (flat) {
799
- return {
800
- plugins: {
801
- [name]: plugin
802
- },
803
- rules
804
- };
805
- } else {
806
- return {
807
- plugins: [name],
808
- rules
809
- };
810
- }
811
- }
812
814
  exports2.COMMENTS_IGNORE_PATTERN = COMMENTS_IGNORE_PATTERN;
813
815
  exports2.FixTracker = FixTracker;
814
816
  exports2.KEYWORDS_JS = KEYWORDS_JS;
@@ -1587,9 +1589,9 @@ var require_arrow_spacing = __commonJS({
1587
1589
  var require_block_spacing = __commonJS({
1588
1590
  "node_modules/@stylistic/eslint-plugin/dist/rules/block-spacing.js"(exports2, module2) {
1589
1591
  "use strict";
1592
+ var utils = require_utils();
1590
1593
  var utils$1 = require("@typescript-eslint/utils");
1591
1594
  var astUtils = require("@typescript-eslint/utils/ast-utils");
1592
- var utils = require_utils();
1593
1595
  require("eslint-visitor-keys");
1594
1596
  require("espree");
1595
1597
  require("estraverse");
@@ -1800,8 +1802,8 @@ var require_block_spacing = __commonJS({
1800
1802
  var require_brace_style = __commonJS({
1801
1803
  "node_modules/@stylistic/eslint-plugin/dist/rules/brace-style.js"(exports2, module2) {
1802
1804
  "use strict";
1803
- var astUtils = require("@typescript-eslint/utils/ast-utils");
1804
1805
  var utils = require_utils();
1806
+ var astUtils = require("@typescript-eslint/utils/ast-utils");
1805
1807
  require("eslint-visitor-keys");
1806
1808
  require("espree");
1807
1809
  require("estraverse");
@@ -2035,9 +2037,9 @@ var require_brace_style = __commonJS({
2035
2037
  var require_comma_dangle = __commonJS({
2036
2038
  "node_modules/@stylistic/eslint-plugin/dist/rules/comma-dangle.js"(exports2, module2) {
2037
2039
  "use strict";
2040
+ var utils = require_utils();
2038
2041
  var utils$1 = require("@typescript-eslint/utils");
2039
2042
  var astUtils = require("@typescript-eslint/utils/ast-utils");
2040
- var utils = require_utils();
2041
2043
  require("eslint-visitor-keys");
2042
2044
  require("espree");
2043
2045
  require("estraverse");
@@ -2432,9 +2434,9 @@ var require_comma_dangle = __commonJS({
2432
2434
  var require_comma_spacing = __commonJS({
2433
2435
  "node_modules/@stylistic/eslint-plugin/dist/rules/comma-spacing.js"(exports2, module2) {
2434
2436
  "use strict";
2437
+ var utils = require_utils();
2435
2438
  var utils$1 = require("@typescript-eslint/utils");
2436
2439
  var astUtils = require("@typescript-eslint/utils/ast-utils");
2437
- var utils = require_utils();
2438
2440
  require("eslint-visitor-keys");
2439
2441
  require("espree");
2440
2442
  require("estraverse");
@@ -3162,8 +3164,8 @@ var require_function_call_argument_newline = __commonJS({
3162
3164
  var require_function_call_spacing = __commonJS({
3163
3165
  "node_modules/@stylistic/eslint-plugin/dist/rules/function-call-spacing.js"(exports2, module2) {
3164
3166
  "use strict";
3165
- var astUtils = require("@typescript-eslint/utils/ast-utils");
3166
3167
  var utils = require_utils();
3168
+ var astUtils = require("@typescript-eslint/utils/ast-utils");
3167
3169
  require("eslint-visitor-keys");
3168
3170
  require("espree");
3169
3171
  require("estraverse");
@@ -3442,6 +3444,7 @@ var require_function_paren_newline = __commonJS({
3442
3444
  if (!node.arguments.length && !(utils.isOpeningParenToken(sourceCode.getLastToken(node, { skip: 1 })) && utils.isClosingParenToken(sourceCode.getLastToken(node)) && node.callee.range[1] < node.range[1])) {
3443
3445
  return null;
3444
3446
  }
3447
+ // falls through
3445
3448
  case "CallExpression":
3446
3449
  return {
3447
3450
  leftParen: sourceCode.getTokenAfter(node.callee, isOpeningParenTokenOutsideTypeParameter()),
@@ -3709,8 +3712,8 @@ var require_implicit_arrow_linebreak = __commonJS({
3709
3712
  var require_indent = __commonJS({
3710
3713
  "node_modules/@stylistic/eslint-plugin/dist/rules/indent.js"(exports2, module2) {
3711
3714
  "use strict";
3712
- var utils$1 = require("@typescript-eslint/utils");
3713
3715
  var utils = require_utils();
3716
+ var utils$1 = require("@typescript-eslint/utils");
3714
3717
  require("eslint-visitor-keys");
3715
3718
  require("espree");
3716
3719
  require("estraverse");
@@ -3811,7 +3814,7 @@ var require_indent = __commonJS({
3811
3814
  */
3812
3815
  constructor(maxKey) {
3813
3816
  __publicField(this, "_values");
3814
- this._values = Array(maxKey + 1);
3817
+ this._values = new Array(maxKey + 1);
3815
3818
  }
3816
3819
  /**
3817
3820
  * Inserts an entry into the map.
@@ -4206,6 +4209,10 @@ var require_indent = __commonJS({
4206
4209
  ignoreComments: {
4207
4210
  type: "boolean",
4208
4211
  default: false
4212
+ },
4213
+ tabLength: {
4214
+ type: "number",
4215
+ default: 4
4209
4216
  }
4210
4217
  },
4211
4218
  additionalProperties: false
@@ -4250,7 +4257,8 @@ var require_indent = __commonJS({
4250
4257
  flatTernaryExpressions: false,
4251
4258
  ignoredNodes: [],
4252
4259
  ignoreComments: false,
4253
- offsetTernaryExpressions: false
4260
+ offsetTernaryExpressions: false,
4261
+ tabLength: 4
4254
4262
  };
4255
4263
  if (context.options.length) {
4256
4264
  if (context.options[0] === "tab") {
@@ -4730,8 +4738,21 @@ var require_indent = __commonJS({
4730
4738
  const previousQuasi = node.quasis[index2];
4731
4739
  const nextQuasi = node.quasis[index2 + 1];
4732
4740
  const tokenToAlignFrom = previousQuasi.loc.start.line === previousQuasi.loc.end.line ? sourceCode.getFirstToken(previousQuasi) : null;
4733
- offsets.setDesiredOffsets([previousQuasi.range[1], nextQuasi.range[0]], tokenToAlignFrom, 1);
4734
- offsets.setDesiredOffset(sourceCode.getFirstToken(nextQuasi), tokenToAlignFrom, 0);
4741
+ let indentOffset = 1;
4742
+ let nextQuasiStartIndent = 0;
4743
+ if (!tokenToAlignFrom) {
4744
+ const tokenBeforeText = sourceCode.text.slice(previousQuasi.range[1] - previousQuasi.loc.end.column, previousQuasi.range[1] - 2).split("");
4745
+ if (tokenBeforeText.every((char) => char === " " || char === " ")) {
4746
+ const numSpaces = tokenBeforeText.filter((char) => char !== " ").length;
4747
+ const numTabs = tokenBeforeText.filter((char) => char === " ").length;
4748
+ indentOffset = numTabs + Math.ceil(numSpaces / (indentType === "tab" ? options.tabLength : indentSize)) + 1;
4749
+ }
4750
+ }
4751
+ if (nextQuasi.loc.start.line !== expression.loc.end.line) {
4752
+ nextQuasiStartIndent = Math.max(indentOffset - 1, 0);
4753
+ }
4754
+ offsets.setDesiredOffsets([previousQuasi.range[1], nextQuasi.range[0]], tokenToAlignFrom, indentOffset);
4755
+ offsets.setDesiredOffset(sourceCode.getFirstToken(nextQuasi), tokenToAlignFrom, nextQuasiStartIndent);
4735
4756
  });
4736
4757
  },
4737
4758
  VariableDeclaration(node) {
@@ -4900,7 +4921,7 @@ var require_indent = __commonJS({
4900
4921
  }
4901
4922
  const indentChar = indentType === "space" ? " " : " ";
4902
4923
  function getFixerFunction(node, needed) {
4903
- const indent2 = Array(needed + 1).join(indentChar);
4924
+ const indent2 = new Array(needed + 1).join(indentChar);
4904
4925
  return function fix(fixer) {
4905
4926
  const regExp = /\n[\t ]*(\S)/g;
4906
4927
  const fixedText = node.raw.replace(regExp, (match, p1) => `
@@ -5430,13 +5451,14 @@ var require_indent_binary_ops = __commonJS({
5430
5451
  if (tokenOperator.range[0] <= right.parent.range[0])
5431
5452
  return;
5432
5453
  }
5454
+ const tokenBeforeAll = sourceCode.getTokenBefore(node);
5433
5455
  const tokenLeft = sourceCode.getTokenBefore(tokenOperator);
5434
5456
  const isMultiline = tokenRight.loc.start.line !== tokenLeft.loc.start.line;
5435
5457
  if (!isMultiline)
5436
5458
  return;
5437
5459
  const firstTokenOfLineLeft = firstTokenOfLine(tokenLeft.loc.start.line);
5438
5460
  const lastTokenOfLineLeft = lastTokenOfLine(tokenLeft.loc.start.line);
5439
- const needAdditionIndent = firstTokenOfLineLeft?.type === "Keyword" && !["typeof", "instanceof", "this"].includes(firstTokenOfLineLeft.value) || firstTokenOfLineLeft?.type === "Identifier" && firstTokenOfLineLeft.value === "type" && node.parent?.type === "TSTypeAliasDeclaration" || [":", "[", "(", "<", "="].includes(lastTokenOfLineLeft?.value || "") || ["||", "&&"].includes(lastTokenOfLineLeft?.value || "") && node.loc.start.line === tokenLeft.loc.start.line && node.loc.start.column !== getIndentOfLine(node.loc.start.line).length;
5461
+ const needAdditionIndent = firstTokenOfLineLeft?.type === "Keyword" && !["typeof", "instanceof", "this"].includes(firstTokenOfLineLeft.value) || firstTokenOfLineLeft?.type === "Identifier" && firstTokenOfLineLeft.value === "type" && node.parent?.type === "TSTypeAliasDeclaration" || [":", "[", "(", "<", "="].includes(lastTokenOfLineLeft?.value || "") || ["[", "(", "=>", ":"].includes(tokenBeforeAll?.value || "") && firstTokenOfLineLeft?.loc.start.line === tokenBeforeAll?.loc.start.line || ["||", "&&"].includes(lastTokenOfLineLeft?.value || "") && node.loc.start.line === tokenLeft.loc.start.line && node.loc.start.column !== getIndentOfLine(node.loc.start.line).length;
5440
5462
  const indentTarget = getIndentOfLine(tokenLeft.loc.start.line) + (needAdditionIndent ? indentStr : "");
5441
5463
  const indentRight = getIndentOfLine(tokenRight.loc.start.line);
5442
5464
  if (indentTarget !== indentRight) {
@@ -5888,7 +5910,7 @@ var require_jsx_closing_tag_location = __commonJS({
5888
5910
  messageId,
5889
5911
  loc: node.loc,
5890
5912
  fix(fixer) {
5891
- const indent = Array(opening.loc.start.column + 1).join(" ");
5913
+ const indent = new Array(opening.loc.start.column + 1).join(" ");
5892
5914
  if (utils.isNodeFirstInLine(context, node)) {
5893
5915
  return fixer.replaceTextRange(
5894
5916
  [node.range[0] - node.loc.start.column, node.range[0]],
@@ -6940,7 +6962,7 @@ var require_jsx_indent = __commonJS({
6940
6962
  const checkAttributes = options.checkAttributes || false;
6941
6963
  const indentLogicalExpressions = options.indentLogicalExpressions || false;
6942
6964
  function getFixerFunction(node, needed) {
6943
- const indent = Array(needed + 1).join(indentChar);
6965
+ const indent = new Array(needed + 1).join(indentChar);
6944
6966
  if (node.type === "JSXText" || node.type === "Literal") {
6945
6967
  return function fix(fixer) {
6946
6968
  const regExp = /\n[\t ]*(\S)/g;
@@ -7247,7 +7269,7 @@ var require_jsx_indent_props = __commonJS({
7247
7269
  node.range[0] - node.loc.start.column,
7248
7270
  node.range[0]
7249
7271
  ],
7250
- Array(nestedIndent + 1).join(indentType === "space" ? " " : " ")
7272
+ new Array(nestedIndent + 1).join(indentType === "space" ? " " : " ")
7251
7273
  );
7252
7274
  }
7253
7275
  });
@@ -7730,8 +7752,8 @@ var require_jsx_one_expression_per_line = __commonJS({
7730
7752
  var require_jsx_pascal_case = __commonJS({
7731
7753
  "node_modules/@stylistic/eslint-plugin/dist/rules/jsx-pascal-case.js"(exports2, module2) {
7732
7754
  "use strict";
7733
- var picomatch = require("picomatch");
7734
7755
  var utils = require_utils();
7756
+ var picomatch = require("picomatch");
7735
7757
  require("eslint-visitor-keys");
7736
7758
  require("espree");
7737
7759
  require("estraverse");
@@ -9056,9 +9078,9 @@ ${fixed}`;
9056
9078
  var require_key_spacing = __commonJS({
9057
9079
  "node_modules/@stylistic/eslint-plugin/dist/rules/key-spacing.js"(exports2, module2) {
9058
9080
  "use strict";
9081
+ var utils = require_utils();
9059
9082
  var utils$1 = require("@typescript-eslint/utils");
9060
9083
  var astUtils = require("@typescript-eslint/utils/ast-utils");
9061
- var utils = require_utils();
9062
9084
  require("eslint-visitor-keys");
9063
9085
  require("espree");
9064
9086
  require("estraverse");
@@ -9360,7 +9382,7 @@ var require_key_spacing = __commonJS({
9360
9382
  const isKeySide = side === "key";
9361
9383
  const isExtra = diff > 0;
9362
9384
  const diffAbs = Math.abs(diff);
9363
- const spaces = Array(diffAbs + 1).join(" ");
9385
+ const spaces = new Array(diffAbs + 1).join(" ");
9364
9386
  const locStart = isKeySide ? tokenBeforeColon.loc.end : nextColon.loc.start;
9365
9387
  const locEnd = isKeySide ? nextColon.loc.start : tokenAfterColon.loc.start;
9366
9388
  const missingLoc = isKeySide ? tokenBeforeColon.loc : tokenAfterColon.loc;
@@ -9752,8 +9774,8 @@ var require_key_spacing = __commonJS({
9752
9774
  var require_keyword_spacing = __commonJS({
9753
9775
  "node_modules/@stylistic/eslint-plugin/dist/rules/keyword-spacing.js"(exports2, module2) {
9754
9776
  "use strict";
9755
- var utils$1 = require("@typescript-eslint/utils");
9756
9777
  var utils = require_utils();
9778
+ var utils$1 = require("@typescript-eslint/utils");
9757
9779
  require("eslint-visitor-keys");
9758
9780
  require("espree");
9759
9781
  require("estraverse");
@@ -9764,7 +9786,7 @@ var require_keyword_spacing = __commonJS({
9764
9786
  var TEMPLATE_OPEN_PAREN = /\$\{$/u;
9765
9787
  var TEMPLATE_CLOSE_PAREN = /^\}/u;
9766
9788
  var CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template|PrivateIdentifier)$/u;
9767
- var KEYS = utils.KEYWORDS_JS.concat(["as", "async", "await", "from", "get", "let", "of", "set", "yield"]);
9789
+ var KEYS = utils.KEYWORDS_JS.concat(["as", "async", "await", "from", "get", "let", "of", "satisfies", "set", "yield"]);
9768
9790
  (function() {
9769
9791
  KEYS.sort();
9770
9792
  for (let i = 1; i < KEYS.length; ++i) {
@@ -10135,6 +10157,20 @@ var require_keyword_spacing = __commonJS({
10135
10157
  baseRules.DebuggerStatement(asToken);
10136
10158
  asToken.type = oldTokenType;
10137
10159
  },
10160
+ // TODO: Stage3: copy from `TSAsExpression`, just call `checkSpacingAroundFirstToken` when refactor
10161
+ TSSatisfiesExpression(node) {
10162
+ const satisfiesToken = utils.nullThrows(
10163
+ sourceCode.getTokenAfter(
10164
+ node.expression,
10165
+ (token) => token.value === "satisfies"
10166
+ ),
10167
+ utils.NullThrowsReasons.MissingToken("satisfies", node.type)
10168
+ );
10169
+ const oldTokenType = satisfiesToken.type;
10170
+ satisfiesToken.type = utils$1.AST_TOKEN_TYPES.Keyword;
10171
+ baseRules.DebuggerStatement(satisfiesToken);
10172
+ satisfiesToken.type = oldTokenType;
10173
+ },
10138
10174
  "ImportDeclaration[importKind=type]": function(node) {
10139
10175
  const { type: typeOptionOverride = {} } = overrides ?? {};
10140
10176
  const typeToken = sourceCode.getFirstToken(node, { skip: 1 });
@@ -10355,9 +10391,9 @@ var require_linebreak_style = __commonJS({
10355
10391
  var require_lines_around_comment = __commonJS({
10356
10392
  "node_modules/@stylistic/eslint-plugin/dist/rules/lines-around-comment.js"(exports2, module2) {
10357
10393
  "use strict";
10394
+ var utils = require_utils();
10358
10395
  var utils$1 = require("@typescript-eslint/utils");
10359
10396
  var astUtils = require("@typescript-eslint/utils/ast-utils");
10360
- var utils = require_utils();
10361
10397
  require("eslint-visitor-keys");
10362
10398
  require("espree");
10363
10399
  require("estraverse");
@@ -10908,8 +10944,8 @@ var require_lines_around_comment = __commonJS({
10908
10944
  var require_lines_between_class_members = __commonJS({
10909
10945
  "node_modules/@stylistic/eslint-plugin/dist/rules/lines-between-class-members.js"(exports2, module2) {
10910
10946
  "use strict";
10911
- var utils$1 = require("@typescript-eslint/utils");
10912
10947
  var utils = require_utils();
10948
+ var utils$1 = require("@typescript-eslint/utils");
10913
10949
  require("eslint-visitor-keys");
10914
10950
  require("espree");
10915
10951
  require("estraverse");
@@ -11493,8 +11529,8 @@ var require_max_statements_per_line = __commonJS({
11493
11529
  var require_member_delimiter_style = __commonJS({
11494
11530
  "node_modules/@stylistic/eslint-plugin/dist/rules/member-delimiter-style.js"(exports2, module2) {
11495
11531
  "use strict";
11496
- var utils$1 = require("@typescript-eslint/utils");
11497
11532
  var utils = require_utils();
11533
+ var utils$1 = require("@typescript-eslint/utils");
11498
11534
  require("eslint-visitor-keys");
11499
11535
  require("espree");
11500
11536
  require("estraverse");
@@ -12401,9 +12437,9 @@ var require_no_confusing_arrow = __commonJS({
12401
12437
  var require_no_extra_parens = __commonJS({
12402
12438
  "node_modules/@stylistic/eslint-plugin/dist/rules/no-extra-parens.js"(exports2, module2) {
12403
12439
  "use strict";
12440
+ var utils = require_utils();
12404
12441
  var utils$1 = require("@typescript-eslint/utils");
12405
12442
  var astUtils = require("@typescript-eslint/utils/ast-utils");
12406
- var utils = require_utils();
12407
12443
  require("eslint-visitor-keys");
12408
12444
  require("espree");
12409
12445
  require("estraverse");
@@ -12491,10 +12527,13 @@ var require_no_extra_parens = __commonJS({
12491
12527
  if (node.type === "JSXElement" || node.type === "JSXFragment") {
12492
12528
  const isSingleLine = node.loc.start.line === node.loc.end.line;
12493
12529
  switch (IGNORE_JSX) {
12530
+ // Exclude this JSX element from linting
12494
12531
  case "all":
12495
12532
  return false;
12533
+ // Exclude this JSX element if it is multi-line element
12496
12534
  case "multi-line":
12497
12535
  return isSingleLine;
12536
+ // Exclude this JSX element if it is single-line element
12498
12537
  case "single-line":
12499
12538
  return !isSingleLine;
12500
12539
  }
@@ -13687,6 +13726,7 @@ var require_no_mixed_spaces_and_tabs = __commonJS({
13687
13726
  let smartTabs;
13688
13727
  switch (context.options[0]) {
13689
13728
  case true:
13729
+ // Support old syntax, maybe add deprecation warning here
13690
13730
  case "smart-tabs":
13691
13731
  smartTabs = true;
13692
13732
  break;
@@ -14537,9 +14577,9 @@ var require_object_curly_newline = __commonJS({
14537
14577
  var require_object_curly_spacing = __commonJS({
14538
14578
  "node_modules/@stylistic/eslint-plugin/dist/rules/object-curly-spacing.js"(exports2, module2) {
14539
14579
  "use strict";
14580
+ var utils = require_utils();
14540
14581
  var utils$1 = require("@typescript-eslint/utils");
14541
14582
  var astUtils = require("@typescript-eslint/utils/ast-utils");
14542
- var utils = require_utils();
14543
14583
  require("eslint-visitor-keys");
14544
14584
  require("espree");
14545
14585
  require("estraverse");
@@ -15320,6 +15360,7 @@ var require_padded_blocks = __commonJS({
15320
15360
  return options.switches;
15321
15361
  case "ClassBody":
15322
15362
  return options.classes;
15363
+ /* c8 ignore next */
15323
15364
  default:
15324
15365
  throw new Error("unreachable");
15325
15366
  }
@@ -15425,9 +15466,9 @@ var require_padded_blocks = __commonJS({
15425
15466
  var require_padding_line_between_statements = __commonJS({
15426
15467
  "node_modules/@stylistic/eslint-plugin/dist/rules/padding-line-between-statements.js"(exports2, module2) {
15427
15468
  "use strict";
15469
+ var utils$1 = require_utils();
15428
15470
  var utils = require("@typescript-eslint/utils");
15429
15471
  var astUtils = require("@typescript-eslint/utils/ast-utils");
15430
- var utils$1 = require_utils();
15431
15472
  require("eslint-visitor-keys");
15432
15473
  require("espree");
15433
15474
  require("estraverse");
@@ -15863,9 +15904,9 @@ var require_padding_line_between_statements = __commonJS({
15863
15904
  var require_quote_props = __commonJS({
15864
15905
  "node_modules/@stylistic/eslint-plugin/dist/rules/quote-props.js"(exports2, module2) {
15865
15906
  "use strict";
15907
+ var utils = require_utils();
15866
15908
  var utils$1 = require("@typescript-eslint/utils");
15867
15909
  var espree = require("espree");
15868
- var utils = require_utils();
15869
15910
  require("eslint-visitor-keys");
15870
15911
  require("estraverse");
15871
15912
  var _baseRule = utils.createRule({
@@ -16155,8 +16196,8 @@ var require_quote_props = __commonJS({
16155
16196
  var require_quotes = __commonJS({
16156
16197
  "node_modules/@stylistic/eslint-plugin/dist/rules/quotes.js"(exports2, module2) {
16157
16198
  "use strict";
16158
- var utils$1 = require("@typescript-eslint/utils");
16159
16199
  var utils = require_utils();
16200
+ var utils$1 = require("@typescript-eslint/utils");
16160
16201
  require("eslint-visitor-keys");
16161
16202
  require("espree");
16162
16203
  require("estraverse");
@@ -16279,23 +16320,30 @@ var require_quotes = __commonJS({
16279
16320
  if (!parent)
16280
16321
  return false;
16281
16322
  switch (parent.type) {
16323
+ // Directive Prologues.
16282
16324
  case "ExpressionStatement":
16283
16325
  return !utils.isParenthesised(sourceCode, node) && isExpressionInOrJustAfterDirectivePrologue(node);
16326
+ // LiteralPropertyName.
16284
16327
  case "Property":
16285
16328
  case "PropertyDefinition":
16286
16329
  case "MethodDefinition":
16287
16330
  return parent.key === node && !parent.computed;
16331
+ // ModuleSpecifier.
16288
16332
  case "ImportDeclaration":
16289
16333
  case "ExportNamedDeclaration":
16290
16334
  return parent.source === node;
16335
+ // ModuleExportName or ModuleSpecifier.
16291
16336
  case "ExportAllDeclaration":
16292
16337
  return parent.exported === node || parent.source === node;
16338
+ // ModuleExportName.
16293
16339
  case "ImportSpecifier":
16294
16340
  return parent.imported === node;
16341
+ // ModuleExportName.
16295
16342
  case "ExportSpecifier":
16296
16343
  return parent.local === node || parent.exported === node;
16297
16344
  case "ImportAttribute":
16298
16345
  return parent.value === node;
16346
+ // Others don't allow.
16299
16347
  default:
16300
16348
  return false;
16301
16349
  }
@@ -16515,8 +16563,8 @@ var require_rest_spread_spacing = __commonJS({
16515
16563
  var require_semi = __commonJS({
16516
16564
  "node_modules/@stylistic/eslint-plugin/dist/rules/semi.js"(exports2, module2) {
16517
16565
  "use strict";
16518
- var utils$1 = require("@typescript-eslint/utils");
16519
16566
  var utils = require_utils();
16567
+ var utils$1 = require("@typescript-eslint/utils");
16520
16568
  require("eslint-visitor-keys");
16521
16569
  require("espree");
16522
16570
  require("estraverse");
@@ -17072,8 +17120,8 @@ var require_semi_style = __commonJS({
17072
17120
  var require_space_before_blocks = __commonJS({
17073
17121
  "node_modules/@stylistic/eslint-plugin/dist/rules/space-before-blocks.js"(exports2, module2) {
17074
17122
  "use strict";
17075
- var astUtils = require("@typescript-eslint/utils/ast-utils");
17076
17123
  var utils = require_utils();
17124
+ var astUtils = require("@typescript-eslint/utils/ast-utils");
17077
17125
  require("eslint-visitor-keys");
17078
17126
  require("espree");
17079
17127
  require("estraverse");
@@ -17273,9 +17321,9 @@ var require_space_before_blocks = __commonJS({
17273
17321
  var require_space_before_function_paren = __commonJS({
17274
17322
  "node_modules/@stylistic/eslint-plugin/dist/rules/space-before-function-paren.js"(exports2, module2) {
17275
17323
  "use strict";
17324
+ var utils = require_utils();
17276
17325
  var utils$1 = require("@typescript-eslint/utils");
17277
17326
  var astUtils = require("@typescript-eslint/utils/ast-utils");
17278
- var utils = require_utils();
17279
17327
  require("eslint-visitor-keys");
17280
17328
  require("espree");
17281
17329
  require("estraverse");
@@ -17584,9 +17632,9 @@ var require_space_in_parens = __commonJS({
17584
17632
  var require_space_infix_ops = __commonJS({
17585
17633
  "node_modules/@stylistic/eslint-plugin/dist/rules/space-infix-ops.js"(exports2, module2) {
17586
17634
  "use strict";
17635
+ var utils = require_utils();
17587
17636
  var utils$1 = require("@typescript-eslint/utils");
17588
17637
  var astUtils = require("@typescript-eslint/utils/ast-utils");
17589
- var utils = require_utils();
17590
17638
  require("eslint-visitor-keys");
17591
17639
  require("espree");
17592
17640
  require("estraverse");
@@ -18029,8 +18077,8 @@ var require_vendor = __commonJS({
18029
18077
  var require_spaced_comment = __commonJS({
18030
18078
  "node_modules/@stylistic/eslint-plugin/dist/rules/spaced-comment.js"(exports2, module2) {
18031
18079
  "use strict";
18032
- var vendor = require_vendor();
18033
18080
  var utils = require_utils();
18081
+ var vendor = require_vendor();
18034
18082
  require("eslint-visitor-keys");
18035
18083
  require("espree");
18036
18084
  require("estraverse");
@@ -18536,9 +18584,8 @@ var require_template_tag_spacing = __commonJS({
18536
18584
  var require_type_annotation_spacing = __commonJS({
18537
18585
  "node_modules/@stylistic/eslint-plugin/dist/rules/type-annotation-spacing.js"(exports2, module2) {
18538
18586
  "use strict";
18539
- var astUtils = require("@typescript-eslint/utils/ast-utils");
18540
- var utils$1 = require("@typescript-eslint/utils");
18541
18587
  var utils = require_utils();
18588
+ var astUtils = require("@typescript-eslint/utils/ast-utils");
18542
18589
  require("eslint-visitor-keys");
18543
18590
  require("espree");
18544
18591
  require("estraverse");
@@ -18558,19 +18605,13 @@ var require_type_annotation_spacing = __commonJS({
18558
18605
  ...globals,
18559
18606
  ...override?.arrow
18560
18607
  };
18561
- const operator = {
18562
- ...{ before: true, after: true },
18563
- ...globals,
18564
- ...override?.operator
18565
- };
18566
18608
  return {
18567
18609
  colon,
18568
18610
  arrow,
18569
18611
  variable: { ...colon, ...override?.variable },
18570
18612
  property: { ...colon, ...override?.property },
18571
18613
  parameter: { ...colon, ...override?.parameter },
18572
- returnType: { ...colon, ...override?.returnType },
18573
- operator
18614
+ returnType: { ...colon, ...override?.returnType }
18574
18615
  };
18575
18616
  }
18576
18617
  function getIdentifierRules(rules, node) {
@@ -18582,8 +18623,6 @@ var require_type_annotation_spacing = __commonJS({
18582
18623
  return rules.colon;
18583
18624
  }
18584
18625
  function getRules(rules, node) {
18585
- if ([utils$1.AST_NODE_TYPES.TSAsExpression, utils$1.AST_NODE_TYPES.TSSatisfiesExpression].includes(node?.parent?.type))
18586
- return rules.operator;
18587
18626
  const scope = node?.parent?.parent;
18588
18627
  if (astUtils.isTSFunctionType(scope) || astUtils.isTSConstructorType(scope))
18589
18628
  return rules.arrow;
@@ -18635,8 +18674,7 @@ var require_type_annotation_spacing = __commonJS({
18635
18674
  variable: { $ref: "#/items/0/$defs/spacingConfig" },
18636
18675
  parameter: { $ref: "#/items/0/$defs/spacingConfig" },
18637
18676
  property: { $ref: "#/items/0/$defs/spacingConfig" },
18638
- returnType: { $ref: "#/items/0/$defs/spacingConfig" },
18639
- operator: { $ref: "#/items/0/$defs/spacingConfig" }
18677
+ returnType: { $ref: "#/items/0/$defs/spacingConfig" }
18640
18678
  },
18641
18679
  additionalProperties: false
18642
18680
  }
@@ -18652,7 +18690,6 @@ var require_type_annotation_spacing = __commonJS({
18652
18690
  ],
18653
18691
  create(context, [options]) {
18654
18692
  const punctuators = [":", "=>"];
18655
- const operator = ["as", "satisfies"];
18656
18693
  const sourceCode = context.sourceCode;
18657
18694
  const ruleSet = createRules(options);
18658
18695
  function checkTypeAnnotationSpacing(typeAnnotation) {
@@ -18661,8 +18698,7 @@ var require_type_annotation_spacing = __commonJS({
18661
18698
  let punctuatorTokenStart = punctuatorTokenEnd;
18662
18699
  let previousToken = sourceCode.getTokenBefore(punctuatorTokenEnd);
18663
18700
  let type = punctuatorTokenEnd.value;
18664
- const isOperator = operator.includes(type);
18665
- if (!punctuators.includes(type) && !isOperator)
18701
+ if (!punctuators.includes(type))
18666
18702
  return;
18667
18703
  const { before, after } = getRules(ruleSet, typeAnnotation);
18668
18704
  if (type === ":" && previousToken.value === "?") {
@@ -18696,9 +18732,7 @@ var require_type_annotation_spacing = __commonJS({
18696
18732
  }
18697
18733
  const previousDelta = punctuatorTokenStart.range[0] - previousToken.range[1];
18698
18734
  const nextDelta = nextNode.range[0] - punctuatorTokenEnd.range[1];
18699
- const ignoreBefore = isOperator && ![utils$1.AST_TOKEN_TYPES.String, utils$1.AST_TOKEN_TYPES.Template, utils$1.AST_TOKEN_TYPES.Punctuator].includes(previousToken.type);
18700
- const ignoreAfter = isOperator && nextNode.type !== utils$1.AST_NODE_TYPES.TSTypeLiteral;
18701
- if (after && nextDelta === 0 && !ignoreAfter) {
18735
+ if (after && nextDelta === 0) {
18702
18736
  context.report({
18703
18737
  node: punctuatorTokenEnd,
18704
18738
  messageId: "expectedSpaceAfter",
@@ -18709,7 +18743,7 @@ var require_type_annotation_spacing = __commonJS({
18709
18743
  return fixer.insertTextAfter(punctuatorTokenEnd, " ");
18710
18744
  }
18711
18745
  });
18712
- } else if (!after && nextDelta > 0 && !ignoreAfter) {
18746
+ } else if (!after && nextDelta > 0) {
18713
18747
  context.report({
18714
18748
  node: punctuatorTokenEnd,
18715
18749
  messageId: "unexpectedSpaceAfter",
@@ -18724,7 +18758,7 @@ var require_type_annotation_spacing = __commonJS({
18724
18758
  }
18725
18759
  });
18726
18760
  }
18727
- if (before && previousDelta === 0 && !ignoreBefore) {
18761
+ if (before && previousDelta === 0) {
18728
18762
  context.report({
18729
18763
  node: punctuatorTokenStart,
18730
18764
  messageId: "expectedSpaceBefore",
@@ -18735,7 +18769,7 @@ var require_type_annotation_spacing = __commonJS({
18735
18769
  return fixer.insertTextAfter(previousToken, " ");
18736
18770
  }
18737
18771
  });
18738
- } else if (!before && previousDelta > 0 && !ignoreBefore) {
18772
+ } else if (!before && previousDelta > 0) {
18739
18773
  context.report({
18740
18774
  node: punctuatorTokenStart,
18741
18775
  messageId: "unexpectedSpaceBefore",
@@ -18758,12 +18792,6 @@ var require_type_annotation_spacing = __commonJS({
18758
18792
  },
18759
18793
  TSTypeAnnotation(node) {
18760
18794
  checkTypeAnnotationSpacing(node.typeAnnotation);
18761
- },
18762
- TSAsExpression(node) {
18763
- checkTypeAnnotationSpacing(node.typeAnnotation);
18764
- },
18765
- TSSatisfiesExpression(node) {
18766
- checkTypeAnnotationSpacing(node.typeAnnotation);
18767
18795
  }
18768
18796
  };
18769
18797
  }
@@ -19217,6 +19245,7 @@ var require_yield_star_spacing = __commonJS({
19217
19245
  var require_configs = __commonJS({
19218
19246
  "node_modules/@stylistic/eslint-plugin/dist/configs.js"(exports2) {
19219
19247
  "use strict";
19248
+ var utils = require_utils();
19220
19249
  var arrayBracketNewline = require_array_bracket_newline();
19221
19250
  var arrayBracketSpacing = require_array_bracket_spacing();
19222
19251
  var arrayElementNewline = require_array_element_newline();
@@ -19311,7 +19340,6 @@ var require_configs = __commonJS({
19311
19340
  var wrapIife = require_wrap_iife();
19312
19341
  var wrapRegex = require_wrap_regex();
19313
19342
  var yieldStarSpacing = require_yield_star_spacing();
19314
- var utils = require_utils();
19315
19343
  var rules = {
19316
19344
  "array-bracket-newline": arrayBracketNewline,
19317
19345
  "array-bracket-spacing": arrayBracketSpacing,
@@ -19412,116 +19440,6 @@ var require_configs = __commonJS({
19412
19440
  var plugin = {
19413
19441
  rules
19414
19442
  };
19415
- var config = {
19416
- rules: {
19417
- "array-bracket-newline": 0,
19418
- "array-bracket-spacing": 0,
19419
- "array-element-newline": 0,
19420
- "arrow-parens": 0,
19421
- "arrow-spacing": 0,
19422
- "block-spacing": 0,
19423
- "brace-style": 0,
19424
- "comma-dangle": 0,
19425
- "comma-spacing": 0,
19426
- "comma-style": 0,
19427
- "computed-property-spacing": 0,
19428
- "dot-location": 0,
19429
- "eol-last": 0,
19430
- "func-call-spacing": 0,
19431
- "function-call-argument-newline": 0,
19432
- "function-paren-newline": 0,
19433
- "generator-star-spacing": 0,
19434
- "implicit-arrow-linebreak": 0,
19435
- "indent": 0,
19436
- "jsx-quotes": 0,
19437
- "key-spacing": 0,
19438
- "keyword-spacing": 0,
19439
- "linebreak-style": 0,
19440
- "lines-around-comment": 0,
19441
- "lines-between-class-members": 0,
19442
- "max-len": 0,
19443
- "max-statements-per-line": 0,
19444
- "multiline-ternary": 0,
19445
- "new-parens": 0,
19446
- "newline-per-chained-call": 0,
19447
- "no-confusing-arrow": 0,
19448
- "no-extra-parens": 0,
19449
- "no-extra-semi": 0,
19450
- "no-floating-decimal": 0,
19451
- "no-mixed-operators": 0,
19452
- "no-mixed-spaces-and-tabs": 0,
19453
- "no-multi-spaces": 0,
19454
- "no-multiple-empty-lines": 0,
19455
- "no-tabs": 0,
19456
- "no-trailing-spaces": 0,
19457
- "no-whitespace-before-property": 0,
19458
- "nonblock-statement-body-position": 0,
19459
- "object-curly-newline": 0,
19460
- "object-curly-spacing": 0,
19461
- "object-property-newline": 0,
19462
- "one-var-declaration-per-line": 0,
19463
- "operator-linebreak": 0,
19464
- "padded-blocks": 0,
19465
- "padding-line-between-statements": 0,
19466
- "quote-props": 0,
19467
- "quotes": 0,
19468
- "rest-spread-spacing": 0,
19469
- "semi": 0,
19470
- "semi-spacing": 0,
19471
- "semi-style": 0,
19472
- "space-before-blocks": 0,
19473
- "space-before-function-paren": 0,
19474
- "space-in-parens": 0,
19475
- "space-infix-ops": 0,
19476
- "space-unary-ops": 0,
19477
- "spaced-comment": 0,
19478
- "switch-colon-spacing": 0,
19479
- "template-curly-spacing": 0,
19480
- "template-tag-spacing": 0,
19481
- "wrap-iife": 0,
19482
- "wrap-regex": 0,
19483
- "yield-star-spacing": 0,
19484
- "@typescript-eslint/block-spacing": 0,
19485
- "@typescript-eslint/brace-style": 0,
19486
- "@typescript-eslint/comma-dangle": 0,
19487
- "@typescript-eslint/comma-spacing": 0,
19488
- "@typescript-eslint/func-call-spacing": 0,
19489
- "@typescript-eslint/indent": 0,
19490
- "@typescript-eslint/key-spacing": 0,
19491
- "@typescript-eslint/keyword-spacing": 0,
19492
- "@typescript-eslint/lines-around-comment": 0,
19493
- "@typescript-eslint/lines-between-class-members": 0,
19494
- "@typescript-eslint/member-delimiter-style": 0,
19495
- "@typescript-eslint/no-extra-parens": 0,
19496
- "@typescript-eslint/no-extra-semi": 0,
19497
- "@typescript-eslint/object-curly-spacing": 0,
19498
- "@typescript-eslint/padding-line-between-statements": 0,
19499
- "@typescript-eslint/quotes": 0,
19500
- "@typescript-eslint/semi": 0,
19501
- "@typescript-eslint/space-before-blocks": 0,
19502
- "@typescript-eslint/space-before-function-paren": 0,
19503
- "@typescript-eslint/space-infix-ops": 0,
19504
- "@typescript-eslint/type-annotation-spacing": 0,
19505
- "react/jsx-child-element-spacing": 0,
19506
- "react/jsx-closing-bracket-location": 0,
19507
- "react/jsx-closing-tag-location": 0,
19508
- "react/jsx-curly-brace-presence": 0,
19509
- "react/jsx-curly-newline": 0,
19510
- "react/jsx-curly-spacing": 0,
19511
- "react/jsx-equals-spacing": 0,
19512
- "react/jsx-first-prop-new-line": 0,
19513
- "react/jsx-indent": 0,
19514
- "react/jsx-indent-props": 0,
19515
- "react/jsx-max-props-per-line": 0,
19516
- "react/jsx-newline": 0,
19517
- "react/jsx-one-expression-per-line": 0,
19518
- "react/jsx-props-no-multi-spaces": 0,
19519
- "react/jsx-self-closing-comp": 0,
19520
- "react/jsx-sort-props": 0,
19521
- "react/jsx-tag-spacing": 0,
19522
- "react/jsx-wrap-multilines": 0
19523
- }
19524
- };
19525
19443
  function customize(options = {}) {
19526
19444
  const {
19527
19445
  arrowParens: arrowParens2 = false,
@@ -19704,6 +19622,116 @@ var require_configs = __commonJS({
19704
19622
  };
19705
19623
  }
19706
19624
  }
19625
+ var config = {
19626
+ rules: {
19627
+ "array-bracket-newline": 0,
19628
+ "array-bracket-spacing": 0,
19629
+ "array-element-newline": 0,
19630
+ "arrow-parens": 0,
19631
+ "arrow-spacing": 0,
19632
+ "block-spacing": 0,
19633
+ "brace-style": 0,
19634
+ "comma-dangle": 0,
19635
+ "comma-spacing": 0,
19636
+ "comma-style": 0,
19637
+ "computed-property-spacing": 0,
19638
+ "dot-location": 0,
19639
+ "eol-last": 0,
19640
+ "func-call-spacing": 0,
19641
+ "function-call-argument-newline": 0,
19642
+ "function-paren-newline": 0,
19643
+ "generator-star-spacing": 0,
19644
+ "implicit-arrow-linebreak": 0,
19645
+ "indent": 0,
19646
+ "jsx-quotes": 0,
19647
+ "key-spacing": 0,
19648
+ "keyword-spacing": 0,
19649
+ "linebreak-style": 0,
19650
+ "lines-around-comment": 0,
19651
+ "lines-between-class-members": 0,
19652
+ "max-len": 0,
19653
+ "max-statements-per-line": 0,
19654
+ "multiline-ternary": 0,
19655
+ "new-parens": 0,
19656
+ "newline-per-chained-call": 0,
19657
+ "no-confusing-arrow": 0,
19658
+ "no-extra-parens": 0,
19659
+ "no-extra-semi": 0,
19660
+ "no-floating-decimal": 0,
19661
+ "no-mixed-operators": 0,
19662
+ "no-mixed-spaces-and-tabs": 0,
19663
+ "no-multi-spaces": 0,
19664
+ "no-multiple-empty-lines": 0,
19665
+ "no-tabs": 0,
19666
+ "no-trailing-spaces": 0,
19667
+ "no-whitespace-before-property": 0,
19668
+ "nonblock-statement-body-position": 0,
19669
+ "object-curly-newline": 0,
19670
+ "object-curly-spacing": 0,
19671
+ "object-property-newline": 0,
19672
+ "one-var-declaration-per-line": 0,
19673
+ "operator-linebreak": 0,
19674
+ "padded-blocks": 0,
19675
+ "padding-line-between-statements": 0,
19676
+ "quote-props": 0,
19677
+ "quotes": 0,
19678
+ "rest-spread-spacing": 0,
19679
+ "semi": 0,
19680
+ "semi-spacing": 0,
19681
+ "semi-style": 0,
19682
+ "space-before-blocks": 0,
19683
+ "space-before-function-paren": 0,
19684
+ "space-in-parens": 0,
19685
+ "space-infix-ops": 0,
19686
+ "space-unary-ops": 0,
19687
+ "spaced-comment": 0,
19688
+ "switch-colon-spacing": 0,
19689
+ "template-curly-spacing": 0,
19690
+ "template-tag-spacing": 0,
19691
+ "wrap-iife": 0,
19692
+ "wrap-regex": 0,
19693
+ "yield-star-spacing": 0,
19694
+ "@typescript-eslint/block-spacing": 0,
19695
+ "@typescript-eslint/brace-style": 0,
19696
+ "@typescript-eslint/comma-dangle": 0,
19697
+ "@typescript-eslint/comma-spacing": 0,
19698
+ "@typescript-eslint/func-call-spacing": 0,
19699
+ "@typescript-eslint/indent": 0,
19700
+ "@typescript-eslint/key-spacing": 0,
19701
+ "@typescript-eslint/keyword-spacing": 0,
19702
+ "@typescript-eslint/lines-around-comment": 0,
19703
+ "@typescript-eslint/lines-between-class-members": 0,
19704
+ "@typescript-eslint/member-delimiter-style": 0,
19705
+ "@typescript-eslint/no-extra-parens": 0,
19706
+ "@typescript-eslint/no-extra-semi": 0,
19707
+ "@typescript-eslint/object-curly-spacing": 0,
19708
+ "@typescript-eslint/padding-line-between-statements": 0,
19709
+ "@typescript-eslint/quotes": 0,
19710
+ "@typescript-eslint/semi": 0,
19711
+ "@typescript-eslint/space-before-blocks": 0,
19712
+ "@typescript-eslint/space-before-function-paren": 0,
19713
+ "@typescript-eslint/space-infix-ops": 0,
19714
+ "@typescript-eslint/type-annotation-spacing": 0,
19715
+ "react/jsx-child-element-spacing": 0,
19716
+ "react/jsx-closing-bracket-location": 0,
19717
+ "react/jsx-closing-tag-location": 0,
19718
+ "react/jsx-curly-brace-presence": 0,
19719
+ "react/jsx-curly-newline": 0,
19720
+ "react/jsx-curly-spacing": 0,
19721
+ "react/jsx-equals-spacing": 0,
19722
+ "react/jsx-first-prop-new-line": 0,
19723
+ "react/jsx-indent": 0,
19724
+ "react/jsx-indent-props": 0,
19725
+ "react/jsx-max-props-per-line": 0,
19726
+ "react/jsx-newline": 0,
19727
+ "react/jsx-one-expression-per-line": 0,
19728
+ "react/jsx-props-no-multi-spaces": 0,
19729
+ "react/jsx-self-closing-comp": 0,
19730
+ "react/jsx-sort-props": 0,
19731
+ "react/jsx-tag-spacing": 0,
19732
+ "react/jsx-wrap-multilines": 0
19733
+ }
19734
+ };
19707
19735
  var recommendedExtends = /* @__PURE__ */ customize({ flat: false });
19708
19736
  var configs2 = {
19709
19737
  /**
@@ -19744,11 +19772,11 @@ var require_configs = __commonJS({
19744
19772
 
19745
19773
  // node_modules/@stylistic/eslint-plugin/dist/index.js
19746
19774
  var configs = require_configs();
19747
- require_array_bracket_newline();
19748
19775
  require_utils();
19749
19776
  require("eslint-visitor-keys");
19750
19777
  require("espree");
19751
19778
  require("estraverse");
19779
+ require_array_bracket_newline();
19752
19780
  require_array_bracket_spacing();
19753
19781
  require_array_element_newline();
19754
19782
  require_arrow_parens();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plugjs/eslint-plugin",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "Shared ESLint configurations and extras",
5
5
  "main": "./index.mjs",
6
6
  "type": "module",
@@ -10,7 +10,7 @@
10
10
  "build": "eslint"
11
11
  },
12
12
  "peerDependencies": {
13
- "eslint": "^9.9.1"
13
+ "eslint": "^9.10.0"
14
14
  },
15
15
  "files": [
16
16
  "*.md",
@@ -35,23 +35,22 @@
35
35
  },
36
36
  "homepage": "https://github.com/plugjs/eslint-plugin#readme",
37
37
  "dependencies": {
38
- "@eslint/js": "9.9.1",
38
+ "@eslint/js": "9.10.0",
39
39
  "@nolyfill/is-core-module": "1.0.39",
40
- "@typescript-eslint/typescript-estree": "8.3.0",
41
- "@typescript-eslint/utils": "8.3.0",
42
- "debug": "4.3.6",
40
+ "@typescript-eslint/utils": "8.5.0",
41
+ "debug": "4.3.7",
43
42
  "doctrine": "3.0.0",
44
43
  "enhanced-resolve": "5.17.1",
45
- "eslint": "9.9.1",
46
- "eslint-module-utils": "2.8.2",
44
+ "eslint": "9.10.0",
45
+ "eslint-module-utils": "2.11.0",
47
46
  "eslint-plugin-unicorn": "55.0.0",
48
47
  "eslint-visitor-keys": "4.0.0",
49
48
  "espree": "10.1.0",
50
49
  "estraverse": "5.3.0",
51
50
  "fast-glob": "3.3.2",
52
- "get-tsconfig": "4.8.0",
51
+ "get-tsconfig": "4.8.1",
53
52
  "globals": "15.9.0",
54
- "is-bun-module": "1.1.0",
53
+ "is-bun-module": "1.2.1",
55
54
  "is-core-module": "2.15.1",
56
55
  "is-glob": "4.0.3",
57
56
  "minimatch": "9.0.5",
@@ -60,7 +59,7 @@
60
59
  "semver": "7.6.3",
61
60
  "stable-hash": "0.0.4",
62
61
  "tslib": "2.7.0",
63
- "typescript": "5.5.4",
64
- "typescript-eslint": "8.3.0"
62
+ "typescript": "5.6.2",
63
+ "typescript-eslint": "8.5.0"
65
64
  }
66
65
  }