@pobammer-ts/eslint-cease-nonsense-rules 1.6.0 → 1.7.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 (79) hide show
  1. package/README.md +594 -535
  2. package/dist/build-metadata.json +3 -3
  3. package/dist/index.d.ts +7 -3
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +1704 -777
  6. package/dist/index.js.map +35 -28
  7. package/dist/oxfmt-sync.d.ts +4 -0
  8. package/dist/oxfmt-sync.d.ts.map +1 -0
  9. package/dist/oxfmt-worker.d.ts +12 -0
  10. package/dist/oxfmt-worker.d.ts.map +1 -0
  11. package/dist/oxfmt-worker.js +172786 -0
  12. package/dist/oxfmt-worker.js.map +27 -0
  13. package/dist/recognizers/camel-case-detector.d.ts +2 -2
  14. package/dist/recognizers/camel-case-detector.d.ts.map +1 -0
  15. package/dist/recognizers/code-recognizer.d.ts +6 -6
  16. package/dist/recognizers/code-recognizer.d.ts.map +1 -0
  17. package/dist/recognizers/contains-detector.d.ts +2 -2
  18. package/dist/recognizers/contains-detector.d.ts.map +1 -0
  19. package/dist/recognizers/detector.d.ts +3 -4
  20. package/dist/recognizers/detector.d.ts.map +1 -0
  21. package/dist/recognizers/end-with-detector.d.ts +2 -2
  22. package/dist/recognizers/end-with-detector.d.ts.map +1 -0
  23. package/dist/recognizers/javascript-footprint.d.ts +2 -2
  24. package/dist/recognizers/javascript-footprint.d.ts.map +1 -0
  25. package/dist/recognizers/keywords-detector.d.ts +2 -2
  26. package/dist/recognizers/keywords-detector.d.ts.map +1 -0
  27. package/dist/rules/ban-instances.d.ts +1 -0
  28. package/dist/rules/ban-instances.d.ts.map +1 -0
  29. package/dist/rules/ban-react-fc.d.ts +1 -0
  30. package/dist/rules/ban-react-fc.d.ts.map +1 -0
  31. package/dist/rules/enforce-ianitor-check-type.d.ts +2 -1
  32. package/dist/rules/enforce-ianitor-check-type.d.ts.map +1 -0
  33. package/dist/rules/fast-format.d.ts +36 -0
  34. package/dist/rules/fast-format.d.ts.map +1 -0
  35. package/dist/rules/no-async-constructor.d.ts +1 -0
  36. package/dist/rules/no-async-constructor.d.ts.map +1 -0
  37. package/dist/rules/no-color3-constructor.d.ts +1 -0
  38. package/dist/rules/no-color3-constructor.d.ts.map +1 -0
  39. package/dist/rules/no-commented-code.d.ts +1 -0
  40. package/dist/rules/no-commented-code.d.ts.map +1 -0
  41. package/dist/rules/no-god-components.d.ts +1 -0
  42. package/dist/rules/no-god-components.d.ts.map +1 -0
  43. package/dist/rules/no-identity-map.d.ts +9 -0
  44. package/dist/rules/no-identity-map.d.ts.map +1 -0
  45. package/dist/rules/no-instance-methods-without-this.d.ts +1 -0
  46. package/dist/rules/no-instance-methods-without-this.d.ts.map +1 -0
  47. package/dist/rules/no-print.d.ts +1 -0
  48. package/dist/rules/no-print.d.ts.map +1 -0
  49. package/dist/rules/no-shorthand-names.d.ts +1 -0
  50. package/dist/rules/no-shorthand-names.d.ts.map +1 -0
  51. package/dist/rules/no-useless-use-spring.d.ts +1 -0
  52. package/dist/rules/no-useless-use-spring.d.ts.map +1 -0
  53. package/dist/rules/no-warn.d.ts +1 -0
  54. package/dist/rules/no-warn.d.ts.map +1 -0
  55. package/dist/rules/prefer-sequence-overloads.d.ts +1 -0
  56. package/dist/rules/prefer-sequence-overloads.d.ts.map +1 -0
  57. package/dist/rules/prefer-udim2-shorthand.d.ts +1 -0
  58. package/dist/rules/prefer-udim2-shorthand.d.ts.map +1 -0
  59. package/dist/rules/require-named-effect-functions.d.ts +4 -3
  60. package/dist/rules/require-named-effect-functions.d.ts.map +1 -0
  61. package/dist/rules/require-paired-calls.d.ts +1 -0
  62. package/dist/rules/require-paired-calls.d.ts.map +1 -0
  63. package/dist/rules/require-react-component-keys.d.ts +1 -0
  64. package/dist/rules/require-react-component-keys.d.ts.map +1 -0
  65. package/dist/rules/use-exhaustive-dependencies.d.ts +1 -0
  66. package/dist/rules/use-exhaustive-dependencies.d.ts.map +1 -0
  67. package/dist/rules/use-hook-at-top-level.d.ts +1 -0
  68. package/dist/rules/use-hook-at-top-level.d.ts.map +1 -0
  69. package/dist/types/oxfmt.d.ts +88 -0
  70. package/dist/types/oxfmt.d.ts.map +1 -0
  71. package/dist/{configure-utilities.d.ts → utilities/configure-utilities.d.ts} +12 -11
  72. package/dist/utilities/configure-utilities.d.ts.map +1 -0
  73. package/dist/utilities/error-utilities.d.ts +25 -0
  74. package/dist/utilities/error-utilities.d.ts.map +1 -0
  75. package/dist/utilities/format-utilities.d.ts +20 -0
  76. package/dist/utilities/format-utilities.d.ts.map +1 -0
  77. package/dist/utilities/typebox-utilities.d.ts +4 -0
  78. package/dist/utilities/typebox-utilities.d.ts.map +1 -0
  79. package/package.json +23 -10
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ var __export = (target, all) => {
25
25
  set: (newValue) => all[name] = () => newValue
26
26
  });
27
27
  };
28
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
28
29
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
29
30
 
30
31
  // node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
@@ -380,33 +381,33 @@ var require_get_keys = __commonJS((exports) => {
380
381
 
381
382
  // node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js
382
383
  var require_visitor_keys = __commonJS((exports) => {
383
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
384
- if (k2 === undefined)
385
- k2 = k;
386
- var desc = Object.getOwnPropertyDescriptor(m, k);
387
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
384
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
385
+ if (k22 === undefined)
386
+ k22 = k2;
387
+ var desc = Object.getOwnPropertyDescriptor(m2, k2);
388
+ if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
388
389
  desc = { enumerable: true, get: function() {
389
- return m[k];
390
+ return m2[k2];
390
391
  } };
391
392
  }
392
- Object.defineProperty(o, k2, desc);
393
- } : function(o, m, k, k2) {
394
- if (k2 === undefined)
395
- k2 = k;
396
- o[k2] = m[k];
393
+ Object.defineProperty(o, k22, desc);
394
+ } : function(o, m2, k2, k22) {
395
+ if (k22 === undefined)
396
+ k22 = k2;
397
+ o[k22] = m2[k2];
397
398
  });
398
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
399
- Object.defineProperty(o, "default", { enumerable: true, value: v });
400
- } : function(o, v) {
401
- o["default"] = v;
399
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v2) {
400
+ Object.defineProperty(o, "default", { enumerable: true, value: v2 });
401
+ } : function(o, v2) {
402
+ o["default"] = v2;
402
403
  });
403
404
  var __importStar = exports && exports.__importStar || function() {
404
405
  var ownKeys = function(o) {
405
406
  ownKeys = Object.getOwnPropertyNames || function(o2) {
406
407
  var ar = [];
407
- for (var k in o2)
408
- if (Object.prototype.hasOwnProperty.call(o2, k))
409
- ar[ar.length] = k;
408
+ for (var k2 in o2)
409
+ if (Object.prototype.hasOwnProperty.call(o2, k2))
410
+ ar[ar.length] = k2;
410
411
  return ar;
411
412
  };
412
413
  return ownKeys(o);
@@ -416,9 +417,9 @@ var require_visitor_keys = __commonJS((exports) => {
416
417
  return mod;
417
418
  var result = {};
418
419
  if (mod != null) {
419
- for (var k = ownKeys(mod), i = 0;i < k.length; i++)
420
- if (k[i] !== "default")
421
- __createBinding(result, mod, k[i]);
420
+ for (var k2 = ownKeys(mod), i = 0;i < k2.length; i++)
421
+ if (k2[i] !== "default")
422
+ __createBinding(result, mod, k2[i]);
422
423
  }
423
424
  __setModuleDefault(result, mod);
424
425
  return result;
@@ -850,25 +851,25 @@ var require_VariableDefinition = __commonJS((exports) => {
850
851
 
851
852
  // node_modules/@typescript-eslint/scope-manager/dist/definition/index.js
852
853
  var require_definition = __commonJS((exports) => {
853
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
854
- if (k2 === undefined)
855
- k2 = k;
856
- var desc = Object.getOwnPropertyDescriptor(m, k);
857
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
854
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
855
+ if (k22 === undefined)
856
+ k22 = k2;
857
+ var desc = Object.getOwnPropertyDescriptor(m2, k2);
858
+ if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
858
859
  desc = { enumerable: true, get: function() {
859
- return m[k];
860
+ return m2[k2];
860
861
  } };
861
862
  }
862
- Object.defineProperty(o, k2, desc);
863
- } : function(o, m, k, k2) {
864
- if (k2 === undefined)
865
- k2 = k;
866
- o[k2] = m[k];
863
+ Object.defineProperty(o, k22, desc);
864
+ } : function(o, m2, k2, k22) {
865
+ if (k22 === undefined)
866
+ k22 = k2;
867
+ o[k22] = m2[k2];
867
868
  });
868
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
869
- for (var p in m)
869
+ var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
870
+ for (var p in m2)
870
871
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
871
- __createBinding(exports2, m, p);
872
+ __createBinding(exports2, m2, p);
872
873
  };
873
874
  Object.defineProperty(exports, "__esModule", { value: true });
874
875
  __exportStar(require_CatchClauseDefinition(), exports);
@@ -5663,7 +5664,7 @@ var require_ScopeBase = __commonJS((exports) => {
5663
5664
  }
5664
5665
  };
5665
5666
  #staticCloseRef = (ref6) => {
5666
- const resolve2 = () => {
5667
+ const resolve3 = () => {
5667
5668
  const name = ref6.identifier.name;
5668
5669
  const variable = this.set.get(name);
5669
5670
  if (!variable) {
@@ -5681,7 +5682,7 @@ var require_ScopeBase = __commonJS((exports) => {
5681
5682
  ref6.resolved = variable;
5682
5683
  return true;
5683
5684
  };
5684
- if (!resolve2()) {
5685
+ if (!resolve3()) {
5685
5686
  this.delegateToUpperScope(ref6);
5686
5687
  }
5687
5688
  };
@@ -5928,7 +5929,7 @@ var require_FunctionScope = __commonJS((exports) => {
5928
5929
  return true;
5929
5930
  }
5930
5931
  const bodyStart = this.block.body?.range[0] ?? -1;
5931
- return !(variable.scope === this && ref6.identifier.range[0] < bodyStart && variable.defs.every((d) => d.name.range[0] >= bodyStart));
5932
+ return !(variable.scope === this && ref6.identifier.range[0] < bodyStart && variable.defs.every((d2) => d2.name.range[0] >= bodyStart));
5932
5933
  }
5933
5934
  }
5934
5935
  exports.FunctionScope = FunctionScope;
@@ -6113,25 +6114,25 @@ var require_WithScope = __commonJS((exports) => {
6113
6114
 
6114
6115
  // node_modules/@typescript-eslint/scope-manager/dist/scope/index.js
6115
6116
  var require_scope = __commonJS((exports) => {
6116
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
6117
- if (k2 === undefined)
6118
- k2 = k;
6119
- var desc = Object.getOwnPropertyDescriptor(m, k);
6120
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6117
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
6118
+ if (k22 === undefined)
6119
+ k22 = k2;
6120
+ var desc = Object.getOwnPropertyDescriptor(m2, k2);
6121
+ if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
6121
6122
  desc = { enumerable: true, get: function() {
6122
- return m[k];
6123
+ return m2[k2];
6123
6124
  } };
6124
6125
  }
6125
- Object.defineProperty(o, k2, desc);
6126
- } : function(o, m, k, k2) {
6127
- if (k2 === undefined)
6128
- k2 = k;
6129
- o[k2] = m[k];
6126
+ Object.defineProperty(o, k22, desc);
6127
+ } : function(o, m2, k2, k22) {
6128
+ if (k22 === undefined)
6129
+ k22 = k2;
6130
+ o[k22] = m2[k2];
6130
6131
  });
6131
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
6132
- for (var p in m)
6132
+ var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
6133
+ for (var p in m2)
6133
6134
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
6134
- __createBinding(exports2, m, p);
6135
+ __createBinding(exports2, m2, p);
6135
6136
  };
6136
6137
  Object.defineProperty(exports, "__esModule", { value: true });
6137
6138
  __exportStar(require_BlockScope(), exports);
@@ -6163,7 +6164,7 @@ var require_VisitorBase = __commonJS((exports) => {
6163
6164
  function isObject(obj) {
6164
6165
  return typeof obj === "object" && obj != null;
6165
6166
  }
6166
- function isNode3(node) {
6167
+ function isNode2(node) {
6167
6168
  return isObject(node) && typeof node.type === "string";
6168
6169
  }
6169
6170
 
@@ -6190,11 +6191,11 @@ var require_VisitorBase = __commonJS((exports) => {
6190
6191
  }
6191
6192
  if (Array.isArray(child)) {
6192
6193
  for (const subChild of child) {
6193
- if (isNode3(subChild)) {
6194
+ if (isNode2(subChild)) {
6194
6195
  this.visit(subChild);
6195
6196
  }
6196
6197
  }
6197
- } else if (isNode3(child)) {
6198
+ } else if (isNode2(child)) {
6198
6199
  this.visit(child);
6199
6200
  }
6200
6201
  }
@@ -6537,7 +6538,7 @@ var require_ClassVisitor = __commonJS((exports) => {
6537
6538
  if (node.type === types_1.AST_NODE_TYPES.ClassDeclaration && node.id) {
6538
6539
  this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.ClassNameDefinition(node.id, node));
6539
6540
  }
6540
- node.decorators.forEach((d) => this.#referencer.visit(d));
6541
+ node.decorators.forEach((d2) => this.#referencer.visit(d2));
6541
6542
  this.#referencer.scopeManager.nestClassScope(node);
6542
6543
  if (node.id) {
6543
6544
  this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.ClassNameDefinition(node.id, node));
@@ -6570,14 +6571,14 @@ var require_ClassVisitor = __commonJS((exports) => {
6570
6571
  } else {
6571
6572
  this.#referencer.visit(node.value);
6572
6573
  }
6573
- node.decorators.forEach((d) => this.#referencer.visit(d));
6574
+ node.decorators.forEach((d2) => this.#referencer.visit(d2));
6574
6575
  }
6575
6576
  visitMethodFunction(node) {
6576
6577
  if (node.id) {
6577
6578
  this.#referencer.scopeManager.nestFunctionExpressionNameScope(node);
6578
6579
  }
6579
6580
  node.params.forEach((param) => {
6580
- param.decorators.forEach((d) => this.visit(d));
6581
+ param.decorators.forEach((d2) => this.visit(d2));
6581
6582
  });
6582
6583
  this.#referencer.scopeManager.nestFunctionScope(node, true);
6583
6584
  for (const param of node.params) {
@@ -6605,7 +6606,7 @@ var require_ClassVisitor = __commonJS((exports) => {
6605
6606
  this.#referencer.close(node.value);
6606
6607
  }
6607
6608
  }
6608
- node.decorators.forEach((d) => this.#referencer.visit(d));
6609
+ node.decorators.forEach((d2) => this.#referencer.visit(d2));
6609
6610
  }
6610
6611
  visitPropertyDefinition(node) {
6611
6612
  this.visitPropertyBase(node);
@@ -6877,7 +6878,7 @@ var require_Referencer = __commonJS((exports) => {
6877
6878
  this.referencingDefaultValue(pattern4, info.assignments, null, true);
6878
6879
  }, { processRightHandNodes: true });
6879
6880
  this.visitFunctionParameterTypeAnnotation(param);
6880
- param.decorators.forEach((d) => this.visit(d));
6881
+ param.decorators.forEach((d2) => this.visit(d2));
6881
6882
  }
6882
6883
  this.visitType(node.returnType);
6883
6884
  this.visitType(node.typeParameters);
@@ -7275,7 +7276,7 @@ var require_ScopeManager = __commonJS((exports) => {
7275
7276
  get variables() {
7276
7277
  const variables = new Set;
7277
7278
  function recurse(scope) {
7278
- scope.variables.forEach((v) => variables.add(v));
7279
+ scope.variables.forEach((v2) => variables.add(v2));
7279
7280
  scope.childScopes.forEach(recurse);
7280
7281
  }
7281
7282
  this.scopes.forEach(recurse);
@@ -7399,7 +7400,7 @@ var require_analyze = __commonJS((exports) => {
7399
7400
  var visitor_keys_1 = require_dist();
7400
7401
  var referencer_1 = require_referencer();
7401
7402
  var ScopeManager_1 = require_ScopeManager();
7402
- var DEFAULT_OPTIONS3 = {
7403
+ var DEFAULT_OPTIONS = {
7403
7404
  childVisitorKeys: visitor_keys_1.visitorKeys,
7404
7405
  emitDecoratorMetadata: false,
7405
7406
  globalReturn: false,
@@ -7411,14 +7412,14 @@ var require_analyze = __commonJS((exports) => {
7411
7412
  };
7412
7413
  function analyze(tree, providedOptions) {
7413
7414
  const options3 = {
7414
- childVisitorKeys: providedOptions?.childVisitorKeys ?? DEFAULT_OPTIONS3.childVisitorKeys,
7415
+ childVisitorKeys: providedOptions?.childVisitorKeys ?? DEFAULT_OPTIONS.childVisitorKeys,
7415
7416
  emitDecoratorMetadata: false,
7416
- globalReturn: providedOptions?.globalReturn ?? DEFAULT_OPTIONS3.globalReturn,
7417
- impliedStrict: providedOptions?.impliedStrict ?? DEFAULT_OPTIONS3.impliedStrict,
7418
- jsxFragmentName: providedOptions?.jsxFragmentName ?? DEFAULT_OPTIONS3.jsxFragmentName,
7419
- jsxPragma: providedOptions?.jsxPragma === undefined ? DEFAULT_OPTIONS3.jsxPragma : providedOptions.jsxPragma,
7417
+ globalReturn: providedOptions?.globalReturn ?? DEFAULT_OPTIONS.globalReturn,
7418
+ impliedStrict: providedOptions?.impliedStrict ?? DEFAULT_OPTIONS.impliedStrict,
7419
+ jsxFragmentName: providedOptions?.jsxFragmentName ?? DEFAULT_OPTIONS.jsxFragmentName,
7420
+ jsxPragma: providedOptions?.jsxPragma === undefined ? DEFAULT_OPTIONS.jsxPragma : providedOptions.jsxPragma,
7420
7421
  lib: providedOptions?.lib ?? ["esnext"],
7421
- sourceType: providedOptions?.sourceType ?? DEFAULT_OPTIONS3.sourceType
7422
+ sourceType: providedOptions?.sourceType ?? DEFAULT_OPTIONS.sourceType
7422
7423
  };
7423
7424
  options3.lib = options3.lib.map((l) => l.toLowerCase());
7424
7425
  const scopeManager = new ScopeManager_1.ScopeManager(options3);
@@ -7430,25 +7431,25 @@ var require_analyze = __commonJS((exports) => {
7430
7431
 
7431
7432
  // node_modules/@typescript-eslint/scope-manager/dist/index.js
7432
7433
  var require_dist2 = __commonJS((exports) => {
7433
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
7434
- if (k2 === undefined)
7435
- k2 = k;
7436
- var desc = Object.getOwnPropertyDescriptor(m, k);
7437
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7434
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
7435
+ if (k22 === undefined)
7436
+ k22 = k2;
7437
+ var desc = Object.getOwnPropertyDescriptor(m2, k2);
7438
+ if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
7438
7439
  desc = { enumerable: true, get: function() {
7439
- return m[k];
7440
+ return m2[k2];
7440
7441
  } };
7441
7442
  }
7442
- Object.defineProperty(o, k2, desc);
7443
- } : function(o, m, k, k2) {
7444
- if (k2 === undefined)
7445
- k2 = k;
7446
- o[k2] = m[k];
7443
+ Object.defineProperty(o, k22, desc);
7444
+ } : function(o, m2, k2, k22) {
7445
+ if (k22 === undefined)
7446
+ k22 = k2;
7447
+ o[k22] = m2[k2];
7447
7448
  });
7448
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
7449
- for (var p in m)
7449
+ var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
7450
+ for (var p in m2)
7450
7451
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
7451
- __createBinding(exports2, m, p);
7452
+ __createBinding(exports2, m2, p);
7452
7453
  };
7453
7454
  Object.defineProperty(exports, "__esModule", { value: true });
7454
7455
  exports.ScopeManager = exports.Visitor = exports.Reference = exports.PatternVisitor = exports.analyze = undefined;
@@ -15425,7 +15426,10 @@ function Compile(...args) {
15425
15426
  var isArrayConfig = Compile(build_default.Array(build_default.String()));
15426
15427
  var isObjectConfig = Compile(build_default.Record(build_default.String(), build_default.String()));
15427
15428
  var isOptionsObject = Compile(build_default.Object({
15428
- bannedInstances: build_default.Union([build_default.Array(build_default.String()), build_default.Record(build_default.String(), build_default.String())])
15429
+ bannedInstances: build_default.Union([
15430
+ build_default.Array(build_default.String()),
15431
+ build_default.Record(build_default.String(), build_default.String())
15432
+ ])
15429
15433
  }));
15430
15434
  function normalizeConfig(options3) {
15431
15435
  if (!isOptionsObject.Check(options3))
@@ -15434,13 +15438,13 @@ function normalizeConfig(options3) {
15434
15438
  if (isArrayConfig.Check(bannedInstances)) {
15435
15439
  const map = new Map;
15436
15440
  for (const className of bannedInstances)
15437
- map.set(className.toLowerCase(), { originalName: className, message: undefined });
15441
+ map.set(className.toLowerCase(), { message: undefined, originalName: className });
15438
15442
  return { bannedClasses: map };
15439
15443
  }
15440
15444
  if (isObjectConfig.Check(bannedInstances)) {
15441
15445
  const map = new Map;
15442
15446
  for (const [className, message] of Object.entries(bannedInstances))
15443
- map.set(className.toLowerCase(), { originalName: className, message });
15447
+ map.set(className.toLowerCase(), { message, originalName: className });
15444
15448
  return { bannedClasses: map };
15445
15449
  }
15446
15450
  return { bannedClasses: new Map };
@@ -15597,9 +15601,9 @@ function hasTypeAnnotationProperty(node) {
15597
15601
  }
15598
15602
  function hasTypeAnnotation(node) {
15599
15603
  if (node.type === TSESTree3.AST_NODE_TYPES.VariableDeclarator && node.id && typeof node.id === "object" && hasTypeAnnotationProperty(node.id))
15600
- return !!node.id.typeAnnotation;
15604
+ return Boolean(node.id.typeAnnotation);
15601
15605
  if (SHOULD_NOT_NOT_RETURN_TYPE.has(node.type))
15602
- return !!node.returnType;
15606
+ return Boolean(node.returnType);
15603
15607
  return false;
15604
15608
  }
15605
15609
  function getTypeName(node) {
@@ -15610,29 +15614,33 @@ function isIanitorValidator(node) {
15610
15614
  }
15611
15615
  function extractIanitorStaticVariable(typeAnnotation) {
15612
15616
  let currentType = typeAnnotation;
15613
- if (currentType.type === TSESTree3.AST_NODE_TYPES.TSTypeReference && currentType.typeName.type === TSESTree3.AST_NODE_TYPES.Identifier && currentType.typeName.name === "Readonly" && currentType.typeArguments?.params[0])
15614
- currentType = currentType.typeArguments.params[0];
15617
+ if (currentType.type === TSESTree3.AST_NODE_TYPES.TSTypeReference && currentType.typeName.type === TSESTree3.AST_NODE_TYPES.Identifier && currentType.typeName.name === "Readonly" && currentType.typeArguments?.params[0]) {
15618
+ [currentType] = currentType.typeArguments.params;
15619
+ }
15615
15620
  if (currentType.type !== TSESTree3.AST_NODE_TYPES.TSTypeReference)
15616
15621
  return;
15617
15622
  const { typeName, typeArguments } = currentType;
15618
15623
  const firstParam = typeArguments?.params[0];
15619
- if (typeName.type === TSESTree3.AST_NODE_TYPES.TSQualifiedName && typeName.left.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.left.name === "Ianitor" && typeName.right.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.right.name === "Static" && firstParam?.type === TSESTree3.AST_NODE_TYPES.TSTypeQuery && firstParam.exprName.type === TSESTree3.AST_NODE_TYPES.Identifier)
15624
+ if (typeName.type === TSESTree3.AST_NODE_TYPES.TSQualifiedName && typeName.left.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.left.name === "Ianitor" && typeName.right.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.right.name === "Static" && firstParam?.type === TSESTree3.AST_NODE_TYPES.TSTypeQuery && firstParam.exprName.type === TSESTree3.AST_NODE_TYPES.Identifier) {
15620
15625
  return firstParam.exprName.name;
15626
+ }
15621
15627
  return;
15622
15628
  }
15623
15629
  function hasIanitorStaticType(typeAnnotation) {
15624
15630
  let currentType = typeAnnotation;
15625
- if (currentType.type === TSESTree3.AST_NODE_TYPES.TSTypeReference && currentType.typeName.type === TSESTree3.AST_NODE_TYPES.Identifier && currentType.typeName.name === "Readonly" && currentType.typeArguments?.params[0])
15626
- currentType = currentType.typeArguments.params[0];
15631
+ if (currentType.type === TSESTree3.AST_NODE_TYPES.TSTypeReference && currentType.typeName.type === TSESTree3.AST_NODE_TYPES.Identifier && currentType.typeName.name === "Readonly" && currentType.typeArguments?.params[0]) {
15632
+ [currentType] = currentType.typeArguments.params;
15633
+ }
15627
15634
  if (currentType.type !== TSESTree3.AST_NODE_TYPES.TSTypeReference)
15628
15635
  return false;
15629
15636
  const { typeName, typeArguments } = currentType;
15630
15637
  return typeName.type === TSESTree3.AST_NODE_TYPES.TSQualifiedName && typeName.left.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.left.name === "Ianitor" && typeName.right.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.right.name === "Static" && typeArguments?.params[0]?.type === TSESTree3.AST_NODE_TYPES.TSTypeQuery;
15631
15638
  }
15632
15639
  function calculateIanitorComplexity(node) {
15633
- const callee = node.callee;
15634
- if (callee?.type !== TSESTree3.AST_NODE_TYPES.MemberExpression || callee.property?.type !== TSESTree3.AST_NODE_TYPES.Identifier)
15640
+ const { callee } = node;
15641
+ if (callee?.type !== TSESTree3.AST_NODE_TYPES.MemberExpression || callee.property?.type !== TSESTree3.AST_NODE_TYPES.Identifier) {
15635
15642
  return 0;
15643
+ }
15636
15644
  const method = callee.property.name;
15637
15645
  switch (method) {
15638
15646
  case "interface":
@@ -15662,7 +15670,8 @@ function calculateIanitorComplexity(node) {
15662
15670
  var createRule = ESLintUtils.RuleCreator((name) => `https://github.com/howmanysmall/eslint-cease-nonsense-rules/blob/main/docs/rules/${name}.md`);
15663
15671
  var enforceIanitorCheckType = createRule({
15664
15672
  create(context) {
15665
- const config = { ...DEFAULT_CONFIGURATION, ...context.options[0] };
15673
+ const [rawOptions] = context.options;
15674
+ const config = { ...DEFAULT_CONFIGURATION, ...rawOptions };
15666
15675
  const cache = {
15667
15676
  nodeCache: new WeakMap,
15668
15677
  visitedNodes: new WeakSet
@@ -15789,15 +15798,14 @@ var enforceIanitorCheckType = createRule({
15789
15798
  }
15790
15799
  case TSESTree3.AST_NODE_TYPES.TSFunctionType:
15791
15800
  case TSESTree3.AST_NODE_TYPES.TSMethodSignature: {
15792
- const func = node;
15793
15801
  score = 2;
15794
- for (const param of func.params) {
15802
+ for (const param of node.params) {
15795
15803
  const typeAnnotation = "typeAnnotation" in param ? param.typeAnnotation : undefined;
15796
15804
  if (typeAnnotation)
15797
15805
  score = addScore(score, calculateStructuralComplexity(typeAnnotation.typeAnnotation, nextDepth));
15798
15806
  }
15799
- if (func.returnType)
15800
- score = addScore(score, calculateStructuralComplexity(func.returnType.typeAnnotation, nextDepth));
15807
+ if (node.returnType)
15808
+ score = addScore(score, calculateStructuralComplexity(node.returnType.typeAnnotation, nextDepth));
15801
15809
  break;
15802
15810
  }
15803
15811
  default:
@@ -15811,8 +15819,7 @@ var enforceIanitorCheckType = createRule({
15811
15819
  const variableDeclaratorsToCheck = new Map;
15812
15820
  return {
15813
15821
  "Program:exit"() {
15814
- for (const [nodeKey, data] of variableDeclaratorsToCheck.entries()) {
15815
- const node = nodeKey;
15822
+ for (const [node, data] of variableDeclaratorsToCheck.entries()) {
15816
15823
  if (node.id.type === TSESTree3.AST_NODE_TYPES.Identifier && ianitorStaticVariables.has(node.id.name))
15817
15824
  continue;
15818
15825
  context.report({
@@ -15890,6 +15897,715 @@ var enforceIanitorCheckType = createRule({
15890
15897
  });
15891
15898
  var enforce_ianitor_check_type_default = enforceIanitorCheckType;
15892
15899
 
15900
+ // src/utilities/format-utilities.ts
15901
+ import { readFileSync } from "node:fs";
15902
+ import { resolve as resolve2 } from "node:path";
15903
+
15904
+ // node_modules/arkregex/out/regex.js
15905
+ var regex2 = (src, flags) => new RegExp(src, flags);
15906
+ Object.assign(regex2, { as: regex2 });
15907
+ // node_modules/confbox/dist/shared/confbox.DA7CpUDY.mjs
15908
+ var m = Symbol.for("__confbox_fmt__");
15909
+ var k = /^(\s+)/;
15910
+ var v = /(\s+)$/;
15911
+ function x(e, t = {}) {
15912
+ const n = t.indent === undefined && t.preserveIndentation !== false && e.slice(0, t?.sampleSize || 1024), s = t.preserveWhitespace === false ? undefined : { start: k.exec(e)?.[0] || "", end: v.exec(e)?.[0] || "" };
15913
+ return { sample: n, whiteSpace: s };
15914
+ }
15915
+ function N(e, t, n) {
15916
+ !t || typeof t != "object" || Object.defineProperty(t, m, { enumerable: false, configurable: true, writable: true, value: x(e, n) });
15917
+ }
15918
+
15919
+ // node_modules/confbox/dist/shared/confbox.DnMsyigM.mjs
15920
+ function $(n, l = false) {
15921
+ const g = n.length;
15922
+ let e = 0, u = "", p = 0, k2 = 16, A = 0, o = 0, O = 0, B = 0, b = 0;
15923
+ function I(i, T) {
15924
+ let s = 0, c = 0;
15925
+ for (;s < i; ) {
15926
+ let t = n.charCodeAt(e);
15927
+ if (t >= 48 && t <= 57)
15928
+ c = c * 16 + t - 48;
15929
+ else if (t >= 65 && t <= 70)
15930
+ c = c * 16 + t - 65 + 10;
15931
+ else if (t >= 97 && t <= 102)
15932
+ c = c * 16 + t - 97 + 10;
15933
+ else
15934
+ break;
15935
+ e++, s++;
15936
+ }
15937
+ return s < i && (c = -1), c;
15938
+ }
15939
+ function V(i) {
15940
+ e = i, u = "", p = 0, k2 = 16, b = 0;
15941
+ }
15942
+ function F() {
15943
+ let i = e;
15944
+ if (n.charCodeAt(e) === 48)
15945
+ e++;
15946
+ else
15947
+ for (e++;e < n.length && L(n.charCodeAt(e)); )
15948
+ e++;
15949
+ if (e < n.length && n.charCodeAt(e) === 46)
15950
+ if (e++, e < n.length && L(n.charCodeAt(e)))
15951
+ for (e++;e < n.length && L(n.charCodeAt(e)); )
15952
+ e++;
15953
+ else
15954
+ return b = 3, n.substring(i, e);
15955
+ let T = e;
15956
+ if (e < n.length && (n.charCodeAt(e) === 69 || n.charCodeAt(e) === 101))
15957
+ if (e++, (e < n.length && n.charCodeAt(e) === 43 || n.charCodeAt(e) === 45) && e++, e < n.length && L(n.charCodeAt(e))) {
15958
+ for (e++;e < n.length && L(n.charCodeAt(e)); )
15959
+ e++;
15960
+ T = e;
15961
+ } else
15962
+ b = 3;
15963
+ return n.substring(i, T);
15964
+ }
15965
+ function a() {
15966
+ let i = "", T = e;
15967
+ for (;; ) {
15968
+ if (e >= g) {
15969
+ i += n.substring(T, e), b = 2;
15970
+ break;
15971
+ }
15972
+ const s = n.charCodeAt(e);
15973
+ if (s === 34) {
15974
+ i += n.substring(T, e), e++;
15975
+ break;
15976
+ }
15977
+ if (s === 92) {
15978
+ if (i += n.substring(T, e), e++, e >= g) {
15979
+ b = 2;
15980
+ break;
15981
+ }
15982
+ switch (n.charCodeAt(e++)) {
15983
+ case 34:
15984
+ i += '"';
15985
+ break;
15986
+ case 92:
15987
+ i += "\\";
15988
+ break;
15989
+ case 47:
15990
+ i += "/";
15991
+ break;
15992
+ case 98:
15993
+ i += "\b";
15994
+ break;
15995
+ case 102:
15996
+ i += "\f";
15997
+ break;
15998
+ case 110:
15999
+ i += `
16000
+ `;
16001
+ break;
16002
+ case 114:
16003
+ i += "\r";
16004
+ break;
16005
+ case 116:
16006
+ i += "\t";
16007
+ break;
16008
+ case 117:
16009
+ const t = I(4);
16010
+ t >= 0 ? i += String.fromCharCode(t) : b = 4;
16011
+ break;
16012
+ default:
16013
+ b = 5;
16014
+ }
16015
+ T = e;
16016
+ continue;
16017
+ }
16018
+ if (s >= 0 && s <= 31)
16019
+ if (r(s)) {
16020
+ i += n.substring(T, e), b = 2;
16021
+ break;
16022
+ } else
16023
+ b = 6;
16024
+ e++;
16025
+ }
16026
+ return i;
16027
+ }
16028
+ function w() {
16029
+ if (u = "", b = 0, p = e, o = A, B = O, e >= g)
16030
+ return p = g, k2 = 17;
16031
+ let i = n.charCodeAt(e);
16032
+ if (J(i)) {
16033
+ do
16034
+ e++, u += String.fromCharCode(i), i = n.charCodeAt(e);
16035
+ while (J(i));
16036
+ return k2 = 15;
16037
+ }
16038
+ if (r(i))
16039
+ return e++, u += String.fromCharCode(i), i === 13 && n.charCodeAt(e) === 10 && (e++, u += `
16040
+ `), A++, O = e, k2 = 14;
16041
+ switch (i) {
16042
+ case 123:
16043
+ return e++, k2 = 1;
16044
+ case 125:
16045
+ return e++, k2 = 2;
16046
+ case 91:
16047
+ return e++, k2 = 3;
16048
+ case 93:
16049
+ return e++, k2 = 4;
16050
+ case 58:
16051
+ return e++, k2 = 6;
16052
+ case 44:
16053
+ return e++, k2 = 5;
16054
+ case 34:
16055
+ return e++, u = a(), k2 = 10;
16056
+ case 47:
16057
+ const T = e - 1;
16058
+ if (n.charCodeAt(e + 1) === 47) {
16059
+ for (e += 2;e < g && !r(n.charCodeAt(e)); )
16060
+ e++;
16061
+ return u = n.substring(T, e), k2 = 12;
16062
+ }
16063
+ if (n.charCodeAt(e + 1) === 42) {
16064
+ e += 2;
16065
+ const s = g - 1;
16066
+ let c = false;
16067
+ for (;e < s; ) {
16068
+ const t = n.charCodeAt(e);
16069
+ if (t === 42 && n.charCodeAt(e + 1) === 47) {
16070
+ e += 2, c = true;
16071
+ break;
16072
+ }
16073
+ e++, r(t) && (t === 13 && n.charCodeAt(e) === 10 && e++, A++, O = e);
16074
+ }
16075
+ return c || (e++, b = 1), u = n.substring(T, e), k2 = 13;
16076
+ }
16077
+ return u += String.fromCharCode(i), e++, k2 = 16;
16078
+ case 45:
16079
+ if (u += String.fromCharCode(i), e++, e === g || !L(n.charCodeAt(e)))
16080
+ return k2 = 16;
16081
+ case 48:
16082
+ case 49:
16083
+ case 50:
16084
+ case 51:
16085
+ case 52:
16086
+ case 53:
16087
+ case 54:
16088
+ case 55:
16089
+ case 56:
16090
+ case 57:
16091
+ return u += F(), k2 = 11;
16092
+ default:
16093
+ for (;e < g && v2(i); )
16094
+ e++, i = n.charCodeAt(e);
16095
+ if (p !== e) {
16096
+ switch (u = n.substring(p, e), u) {
16097
+ case "true":
16098
+ return k2 = 8;
16099
+ case "false":
16100
+ return k2 = 9;
16101
+ case "null":
16102
+ return k2 = 7;
16103
+ }
16104
+ return k2 = 16;
16105
+ }
16106
+ return u += String.fromCharCode(i), e++, k2 = 16;
16107
+ }
16108
+ }
16109
+ function v2(i) {
16110
+ if (J(i) || r(i))
16111
+ return false;
16112
+ switch (i) {
16113
+ case 125:
16114
+ case 93:
16115
+ case 123:
16116
+ case 91:
16117
+ case 34:
16118
+ case 58:
16119
+ case 44:
16120
+ case 47:
16121
+ return false;
16122
+ }
16123
+ return true;
16124
+ }
16125
+ function j() {
16126
+ let i;
16127
+ do
16128
+ i = w();
16129
+ while (i >= 12 && i <= 15);
16130
+ return i;
16131
+ }
16132
+ return { setPosition: V, getPosition: () => e, scan: l ? j : w, getToken: () => k2, getTokenValue: () => u, getTokenOffset: () => p, getTokenLength: () => e - p, getTokenStartLine: () => o, getTokenStartCharacter: () => p - B, getTokenError: () => b };
16133
+ }
16134
+ function J(n) {
16135
+ return n === 32 || n === 9;
16136
+ }
16137
+ function r(n) {
16138
+ return n === 10 || n === 13;
16139
+ }
16140
+ function L(n) {
16141
+ return n >= 48 && n <= 57;
16142
+ }
16143
+ var Q;
16144
+ (function(n) {
16145
+ n[n.lineFeed = 10] = "lineFeed", n[n.carriageReturn = 13] = "carriageReturn", n[n.space = 32] = "space", n[n._0 = 48] = "_0", n[n._1 = 49] = "_1", n[n._2 = 50] = "_2", n[n._3 = 51] = "_3", n[n._4 = 52] = "_4", n[n._5 = 53] = "_5", n[n._6 = 54] = "_6", n[n._7 = 55] = "_7", n[n._8 = 56] = "_8", n[n._9 = 57] = "_9", n[n.a = 97] = "a", n[n.b = 98] = "b", n[n.c = 99] = "c", n[n.d = 100] = "d", n[n.e = 101] = "e", n[n.f = 102] = "f", n[n.g = 103] = "g", n[n.h = 104] = "h", n[n.i = 105] = "i", n[n.j = 106] = "j", n[n.k = 107] = "k", n[n.l = 108] = "l", n[n.m = 109] = "m", n[n.n = 110] = "n", n[n.o = 111] = "o", n[n.p = 112] = "p", n[n.q = 113] = "q", n[n.r = 114] = "r", n[n.s = 115] = "s", n[n.t = 116] = "t", n[n.u = 117] = "u", n[n.v = 118] = "v", n[n.w = 119] = "w", n[n.x = 120] = "x", n[n.y = 121] = "y", n[n.z = 122] = "z", n[n.A = 65] = "A", n[n.B = 66] = "B", n[n.C = 67] = "C", n[n.D = 68] = "D", n[n.E = 69] = "E", n[n.F = 70] = "F", n[n.G = 71] = "G", n[n.H = 72] = "H", n[n.I = 73] = "I", n[n.J = 74] = "J", n[n.K = 75] = "K", n[n.L = 76] = "L", n[n.M = 77] = "M", n[n.N = 78] = "N", n[n.O = 79] = "O", n[n.P = 80] = "P", n[n.Q = 81] = "Q", n[n.R = 82] = "R", n[n.S = 83] = "S", n[n.T = 84] = "T", n[n.U = 85] = "U", n[n.V = 86] = "V", n[n.W = 87] = "W", n[n.X = 88] = "X", n[n.Y = 89] = "Y", n[n.Z = 90] = "Z", n[n.asterisk = 42] = "asterisk", n[n.backslash = 92] = "backslash", n[n.closeBrace = 125] = "closeBrace", n[n.closeBracket = 93] = "closeBracket", n[n.colon = 58] = "colon", n[n.comma = 44] = "comma", n[n.dot = 46] = "dot", n[n.doubleQuote = 34] = "doubleQuote", n[n.minus = 45] = "minus", n[n.openBrace = 123] = "openBrace", n[n.openBracket = 91] = "openBracket", n[n.plus = 43] = "plus", n[n.slash = 47] = "slash", n[n.formFeed = 12] = "formFeed", n[n.tab = 9] = "tab";
16146
+ })(Q || (Q = {})), new Array(20).fill(0).map((n, l) => " ".repeat(l));
16147
+ var N2 = 200;
16148
+ new Array(N2).fill(0).map((n, l) => `
16149
+ ` + " ".repeat(l)), new Array(N2).fill(0).map((n, l) => "\r" + " ".repeat(l)), new Array(N2).fill(0).map((n, l) => `\r
16150
+ ` + " ".repeat(l)), new Array(N2).fill(0).map((n, l) => `
16151
+ ` + "\t".repeat(l)), new Array(N2).fill(0).map((n, l) => "\r" + "\t".repeat(l)), new Array(N2).fill(0).map((n, l) => `\r
16152
+ ` + "\t".repeat(l));
16153
+ var U;
16154
+ (function(n) {
16155
+ n.DEFAULT = { allowTrailingComma: false };
16156
+ })(U || (U = {}));
16157
+ function S(n, l = [], g = U.DEFAULT) {
16158
+ let e = null, u = [];
16159
+ const p = [];
16160
+ function k2(o) {
16161
+ Array.isArray(u) ? u.push(o) : e !== null && (u[e] = o);
16162
+ }
16163
+ return P(n, { onObjectBegin: () => {
16164
+ const o = {};
16165
+ k2(o), p.push(u), u = o, e = null;
16166
+ }, onObjectProperty: (o) => {
16167
+ e = o;
16168
+ }, onObjectEnd: () => {
16169
+ u = p.pop();
16170
+ }, onArrayBegin: () => {
16171
+ const o = [];
16172
+ k2(o), p.push(u), u = o, e = null;
16173
+ }, onArrayEnd: () => {
16174
+ u = p.pop();
16175
+ }, onLiteralValue: k2, onError: (o, O, B) => {
16176
+ l.push({ error: o, offset: O, length: B });
16177
+ } }, g), u[0];
16178
+ }
16179
+ function P(n, l, g = U.DEFAULT) {
16180
+ const e = $(n, false), u = [];
16181
+ let p = 0;
16182
+ function k2(f) {
16183
+ return f ? () => p === 0 && f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter()) : () => true;
16184
+ }
16185
+ function A(f) {
16186
+ return f ? (m2) => p === 0 && f(m2, e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter()) : () => true;
16187
+ }
16188
+ function o(f) {
16189
+ return f ? (m2) => p === 0 && f(m2, e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter(), () => u.slice()) : () => true;
16190
+ }
16191
+ function O(f) {
16192
+ return f ? () => {
16193
+ p > 0 ? p++ : f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter(), () => u.slice()) === false && (p = 1);
16194
+ } : () => true;
16195
+ }
16196
+ function B(f) {
16197
+ return f ? () => {
16198
+ p > 0 && p--, p === 0 && f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter());
16199
+ } : () => true;
16200
+ }
16201
+ const b = O(l.onObjectBegin), I = o(l.onObjectProperty), V = B(l.onObjectEnd), F = O(l.onArrayBegin), a = B(l.onArrayEnd), w = o(l.onLiteralValue), v2 = A(l.onSeparator), j = k2(l.onComment), i = A(l.onError), T = g && g.disallowComments, s = g && g.allowTrailingComma;
16202
+ function c() {
16203
+ for (;; ) {
16204
+ const f = e.scan();
16205
+ switch (e.getTokenError()) {
16206
+ case 4:
16207
+ t(14);
16208
+ break;
16209
+ case 5:
16210
+ t(15);
16211
+ break;
16212
+ case 3:
16213
+ t(13);
16214
+ break;
16215
+ case 1:
16216
+ T || t(11);
16217
+ break;
16218
+ case 2:
16219
+ t(12);
16220
+ break;
16221
+ case 6:
16222
+ t(16);
16223
+ break;
16224
+ }
16225
+ switch (f) {
16226
+ case 12:
16227
+ case 13:
16228
+ T ? t(10) : j();
16229
+ break;
16230
+ case 16:
16231
+ t(1);
16232
+ break;
16233
+ case 15:
16234
+ case 14:
16235
+ break;
16236
+ default:
16237
+ return f;
16238
+ }
16239
+ }
16240
+ }
16241
+ function t(f, m2 = [], y = []) {
16242
+ if (i(f), m2.length + y.length > 0) {
16243
+ let _ = e.getToken();
16244
+ for (;_ !== 17; ) {
16245
+ if (m2.indexOf(_) !== -1) {
16246
+ c();
16247
+ break;
16248
+ } else if (y.indexOf(_) !== -1)
16249
+ break;
16250
+ _ = c();
16251
+ }
16252
+ }
16253
+ }
16254
+ function D(f) {
16255
+ const m2 = e.getTokenValue();
16256
+ return f ? w(m2) : (I(m2), u.push(m2)), c(), true;
16257
+ }
16258
+ function G() {
16259
+ switch (e.getToken()) {
16260
+ case 11:
16261
+ const f = e.getTokenValue();
16262
+ let m2 = Number(f);
16263
+ isNaN(m2) && (t(2), m2 = 0), w(m2);
16264
+ break;
16265
+ case 7:
16266
+ w(null);
16267
+ break;
16268
+ case 8:
16269
+ w(true);
16270
+ break;
16271
+ case 9:
16272
+ w(false);
16273
+ break;
16274
+ default:
16275
+ return false;
16276
+ }
16277
+ return c(), true;
16278
+ }
16279
+ function M() {
16280
+ return e.getToken() !== 10 ? (t(3, [], [2, 5]), false) : (D(false), e.getToken() === 6 ? (v2(":"), c(), E() || t(4, [], [2, 5])) : t(5, [], [2, 5]), u.pop(), true);
16281
+ }
16282
+ function X() {
16283
+ b(), c();
16284
+ let f = false;
16285
+ for (;e.getToken() !== 2 && e.getToken() !== 17; ) {
16286
+ if (e.getToken() === 5) {
16287
+ if (f || t(4, [], []), v2(","), c(), e.getToken() === 2 && s)
16288
+ break;
16289
+ } else
16290
+ f && t(6, [], []);
16291
+ M() || t(4, [], [2, 5]), f = true;
16292
+ }
16293
+ return V(), e.getToken() !== 2 ? t(7, [2], []) : c(), true;
16294
+ }
16295
+ function Y() {
16296
+ F(), c();
16297
+ let f = true, m2 = false;
16298
+ for (;e.getToken() !== 4 && e.getToken() !== 17; ) {
16299
+ if (e.getToken() === 5) {
16300
+ if (m2 || t(4, [], []), v2(","), c(), e.getToken() === 4 && s)
16301
+ break;
16302
+ } else
16303
+ m2 && t(6, [], []);
16304
+ f ? (u.push(0), f = false) : u[u.length - 1]++, E() || t(4, [], [4, 5]), m2 = true;
16305
+ }
16306
+ return a(), f || u.pop(), e.getToken() !== 4 ? t(8, [4], []) : c(), true;
16307
+ }
16308
+ function E() {
16309
+ switch (e.getToken()) {
16310
+ case 3:
16311
+ return Y();
16312
+ case 1:
16313
+ return X();
16314
+ case 10:
16315
+ return D(true);
16316
+ default:
16317
+ return G();
16318
+ }
16319
+ }
16320
+ return c(), e.getToken() === 17 ? g.allowEmptyContent ? true : (t(4, [], []), false) : E() ? (e.getToken() !== 17 && t(9, [], []), true) : (t(4, [], []), false);
16321
+ }
16322
+ var W;
16323
+ (function(n) {
16324
+ n[n.None = 0] = "None", n[n.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", n[n.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", n[n.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", n[n.InvalidUnicode = 4] = "InvalidUnicode", n[n.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", n[n.InvalidCharacter = 6] = "InvalidCharacter";
16325
+ })(W || (W = {}));
16326
+ var H;
16327
+ (function(n) {
16328
+ n[n.OpenBraceToken = 1] = "OpenBraceToken", n[n.CloseBraceToken = 2] = "CloseBraceToken", n[n.OpenBracketToken = 3] = "OpenBracketToken", n[n.CloseBracketToken = 4] = "CloseBracketToken", n[n.CommaToken = 5] = "CommaToken", n[n.ColonToken = 6] = "ColonToken", n[n.NullKeyword = 7] = "NullKeyword", n[n.TrueKeyword = 8] = "TrueKeyword", n[n.FalseKeyword = 9] = "FalseKeyword", n[n.StringLiteral = 10] = "StringLiteral", n[n.NumericLiteral = 11] = "NumericLiteral", n[n.LineCommentTrivia = 12] = "LineCommentTrivia", n[n.BlockCommentTrivia = 13] = "BlockCommentTrivia", n[n.LineBreakTrivia = 14] = "LineBreakTrivia", n[n.Trivia = 15] = "Trivia", n[n.Unknown = 16] = "Unknown", n[n.EOF = 17] = "EOF";
16329
+ })(H || (H = {}));
16330
+ var K = S;
16331
+ var q;
16332
+ (function(n) {
16333
+ n[n.InvalidSymbol = 1] = "InvalidSymbol", n[n.InvalidNumberFormat = 2] = "InvalidNumberFormat", n[n.PropertyNameExpected = 3] = "PropertyNameExpected", n[n.ValueExpected = 4] = "ValueExpected", n[n.ColonExpected = 5] = "ColonExpected", n[n.CommaExpected = 6] = "CommaExpected", n[n.CloseBraceExpected = 7] = "CloseBraceExpected", n[n.CloseBracketExpected = 8] = "CloseBracketExpected", n[n.EndOfFileExpected = 9] = "EndOfFileExpected", n[n.InvalidCommentToken = 10] = "InvalidCommentToken", n[n.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", n[n.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", n[n.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", n[n.InvalidUnicode = 14] = "InvalidUnicode", n[n.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", n[n.InvalidCharacter = 16] = "InvalidCharacter";
16334
+ })(q || (q = {}));
16335
+ function h(n, l) {
16336
+ const g = K(n, l?.errors, l);
16337
+ return N(n, g, l), g;
16338
+ }
16339
+ // src/oxfmt-sync.ts
16340
+ import { existsSync } from "node:fs";
16341
+ import { fileURLToPath } from "node:url";
16342
+ import { MessageChannel, receiveMessageOnPort, Worker } from "node:worker_threads";
16343
+ var FORMAT_TIMEOUT = 30000;
16344
+ var workerState;
16345
+ function resolveWorkerPath() {
16346
+ const jsPath = new URL("./oxfmt-worker.js", import.meta.url);
16347
+ const jsFilePath = fileURLToPath(jsPath);
16348
+ if (existsSync(jsFilePath))
16349
+ return jsPath;
16350
+ const tsPath = new URL("./oxfmt-worker.ts", import.meta.url);
16351
+ const tsFilePath = fileURLToPath(tsPath);
16352
+ if (existsSync(tsFilePath))
16353
+ return tsPath;
16354
+ throw new Error(`Oxfmt worker not found at ${jsFilePath} or ${tsFilePath}. Did you run 'bun run build'?`);
16355
+ }
16356
+ function getWorker() {
16357
+ if (workerState !== undefined)
16358
+ return workerState;
16359
+ const controlBuffer = new SharedArrayBuffer(4);
16360
+ const workerPath = resolveWorkerPath();
16361
+ const { port1: responsePort, port2: requestPort } = new MessageChannel;
16362
+ const worker = new Worker(workerPath, {
16363
+ stderr: true,
16364
+ stdout: true,
16365
+ transferList: [requestPort],
16366
+ workerData: { requestPort }
16367
+ });
16368
+ worker.unref();
16369
+ workerState = { controlBuffer, responsePort, worker };
16370
+ return workerState;
16371
+ }
16372
+ function formatSync(fileName, sourceText, options3 = {}) {
16373
+ const { controlBuffer, responsePort } = getWorker();
16374
+ const control = new Int32Array(controlBuffer);
16375
+ Atomics.store(control, 0, 0);
16376
+ const request = {
16377
+ controlBuffer,
16378
+ fileName,
16379
+ options: options3,
16380
+ sourceText
16381
+ };
16382
+ responsePort.postMessage(request);
16383
+ const waitResult = Atomics.wait(control, 0, 0, FORMAT_TIMEOUT);
16384
+ if (waitResult === "timed-out")
16385
+ throw new Error(`Oxfmt timed out after ${FORMAT_TIMEOUT}ms`);
16386
+ const received = receiveMessageOnPort(responsePort);
16387
+ if (received === undefined)
16388
+ throw new Error("No response received from oxfmt worker");
16389
+ const response = received.message;
16390
+ if (response.error !== undefined)
16391
+ throw new Error(response.error);
16392
+ if (response.code === undefined)
16393
+ throw new Error("Oxfmt returned undefined code");
16394
+ return response.code;
16395
+ }
16396
+
16397
+ // src/utilities/format-utilities.ts
16398
+ var cachedConfig;
16399
+ function loadOxfmtConfig() {
16400
+ if (cachedConfig !== undefined)
16401
+ return cachedConfig;
16402
+ try {
16403
+ const configPath = resolve2(process.cwd(), ".oxfmtrc.json");
16404
+ const configText = readFileSync(configPath, "utf8");
16405
+ const parsed = h(configText);
16406
+ if (typeof parsed !== "object" || parsed === null) {
16407
+ cachedConfig = {};
16408
+ return cachedConfig;
16409
+ }
16410
+ const config = parsed;
16411
+ const { $schema: _schema, ignorePatterns: _ignore, ...formatOptions } = config;
16412
+ cachedConfig = formatOptions;
16413
+ return cachedConfig;
16414
+ } catch {
16415
+ cachedConfig = {};
16416
+ return cachedConfig;
16417
+ }
16418
+ }
16419
+ function getExtension(filePath) {
16420
+ if (filePath.endsWith(".tsx"))
16421
+ return ".tsx";
16422
+ if (filePath.endsWith(".ts"))
16423
+ return ".ts";
16424
+ if (filePath.endsWith(".jsx"))
16425
+ return ".jsx";
16426
+ if (filePath.endsWith(".js"))
16427
+ return ".js";
16428
+ if (filePath.endsWith(".mts"))
16429
+ return ".mts";
16430
+ if (filePath.endsWith(".mjs"))
16431
+ return ".mjs";
16432
+ if (filePath.endsWith(".cts"))
16433
+ return ".cts";
16434
+ if (filePath.endsWith(".cjs"))
16435
+ return ".cjs";
16436
+ return;
16437
+ }
16438
+ function formatWithOxfmtSync(source, filePath) {
16439
+ const extension = getExtension(filePath);
16440
+ if (extension === undefined)
16441
+ throw new Error(`Unsupported file extension for ${filePath}`);
16442
+ const config = loadOxfmtConfig();
16443
+ return formatSync(filePath, source, config);
16444
+ }
16445
+ function generateDifferences(original, formatted) {
16446
+ if (original === formatted)
16447
+ return [];
16448
+ return [
16449
+ {
16450
+ deleteText: original,
16451
+ insertText: formatted,
16452
+ offset: 0,
16453
+ operation: "REPLACE"
16454
+ }
16455
+ ];
16456
+ }
16457
+ var MAX_LENGTH = 60;
16458
+ var SYMBOLS = {
16459
+ " ": "·",
16460
+ "\n": "␊",
16461
+ "\r": "␍",
16462
+ "\t": "→"
16463
+ };
16464
+ var WHITESPACE_REGEXP = regex2(`[\r
16465
+ ]`, "g");
16466
+ function toSymbol(character) {
16467
+ return SYMBOLS[character] ?? character;
16468
+ }
16469
+ function showInvisibles(text) {
16470
+ let result = text;
16471
+ if (result.length > MAX_LENGTH)
16472
+ result = `${result.slice(0, MAX_LENGTH)}…`;
16473
+ return result.replaceAll(WHITESPACE_REGEXP, toSymbol);
16474
+ }
16475
+
16476
+ // src/rules/fast-format.ts
16477
+ var INSERT = "INSERT";
16478
+ var DELETE = "DELETE";
16479
+ var REPLACE = "REPLACE";
16480
+ var DEFAULT_CACHE_CAPACITY = 32;
16481
+ function getLocFromIndex(sourceCode, index2) {
16482
+ if (typeof sourceCode.getLocFromIndex === "function")
16483
+ return sourceCode.getLocFromIndex(index2);
16484
+ return { column: index2, line: 1 };
16485
+ }
16486
+ function createCacheKey(filename, source) {
16487
+ return `${filename}::${source}`;
16488
+ }
16489
+ function createLruCache(limit) {
16490
+ const entries = new Map;
16491
+ const capacity = Math.max(limit, 1);
16492
+ function clear() {
16493
+ entries.clear();
16494
+ }
16495
+ function get(key) {
16496
+ const value = entries.get(key);
16497
+ if (value === undefined)
16498
+ return;
16499
+ entries.delete(key);
16500
+ entries.set(key, value);
16501
+ return value;
16502
+ }
16503
+ function set(key, value) {
16504
+ entries.set(key, value);
16505
+ if (entries.size > capacity) {
16506
+ const oldestKey = entries.keys().next().value;
16507
+ if (oldestKey !== undefined)
16508
+ entries.delete(oldestKey);
16509
+ }
16510
+ return value;
16511
+ }
16512
+ return { clear, get, set };
16513
+ }
16514
+ function cacheFormattedResult(cache, filename, source, formatted) {
16515
+ const entry = { formatted, kind: "formatted" };
16516
+ const sourceKey = createCacheKey(filename, source);
16517
+ cache.set(sourceKey, entry);
16518
+ if (formatted !== source) {
16519
+ const formattedKey = createCacheKey(filename, formatted);
16520
+ cache.set(formattedKey, entry);
16521
+ }
16522
+ return entry;
16523
+ }
16524
+ function formatWithCaching(cache, filename, source, services) {
16525
+ const cacheKey = createCacheKey(filename, source);
16526
+ const cached = cache.get(cacheKey);
16527
+ if (cached !== undefined)
16528
+ return cached;
16529
+ try {
16530
+ const formatted = services.format(source, filename);
16531
+ return cacheFormattedResult(cache, filename, source, formatted);
16532
+ } catch (error2) {
16533
+ const message = error2 instanceof Error ? error2.message : String(error2);
16534
+ return cache.set(cacheKey, { kind: "error", message: `Oxfmt error: ${message}` });
16535
+ }
16536
+ }
16537
+ function createFormatCache(limit = DEFAULT_CACHE_CAPACITY) {
16538
+ return createLruCache(limit);
16539
+ }
16540
+ var defaultServices = {
16541
+ format: formatWithOxfmtSync,
16542
+ generate: generateDifferences,
16543
+ show: showInvisibles
16544
+ };
16545
+ var defaultCache = createFormatCache();
16546
+ function createFastFormatRule(options3 = {}) {
16547
+ const cache = options3.cache ?? defaultCache;
16548
+ const services = {
16549
+ format: options3.services?.format ?? defaultServices.format,
16550
+ generate: options3.services?.generate ?? defaultServices.generate,
16551
+ show: options3.services?.show ?? defaultServices.show
16552
+ };
16553
+ return {
16554
+ create(context) {
16555
+ const { filename, sourceCode } = context;
16556
+ if (getExtension(filename) === undefined)
16557
+ return {};
16558
+ return {
16559
+ Program() {
16560
+ const source = sourceCode.text;
16561
+ const outcome = formatWithCaching(cache, filename, source, services);
16562
+ if (outcome.kind === "error") {
16563
+ context.report({
16564
+ loc: { column: 0, line: 1 },
16565
+ message: outcome.message
16566
+ });
16567
+ return;
16568
+ }
16569
+ if (source === outcome.formatted)
16570
+ return;
16571
+ const differences = services.generate(source, outcome.formatted);
16572
+ for (const { operation, offset, deleteText, insertText } of differences) {
16573
+ const range = [offset, offset + (deleteText?.length ?? 0)];
16574
+ context.report({
16575
+ data: {
16576
+ deleteText: services.show(deleteText ?? ""),
16577
+ insertText: services.show(insertText ?? "")
16578
+ },
16579
+ fix: (fixer) => fixer.replaceTextRange(range, insertText ?? ""),
16580
+ loc: {
16581
+ end: getLocFromIndex(sourceCode, range[1]),
16582
+ start: getLocFromIndex(sourceCode, range[0])
16583
+ },
16584
+ messageId: operation
16585
+ });
16586
+ }
16587
+ }
16588
+ };
16589
+ },
16590
+ meta: {
16591
+ docs: {
16592
+ description: "Enforce oxfmt code formatting",
16593
+ recommended: true
16594
+ },
16595
+ fixable: "code",
16596
+ messages: {
16597
+ [INSERT]: "Insert `{{ insertText }}`",
16598
+ [DELETE]: "Delete `{{ deleteText }}`",
16599
+ [REPLACE]: "Replace `{{ deleteText }}` with `{{ insertText }}`"
16600
+ },
16601
+ schema: [],
16602
+ type: "layout"
16603
+ }
16604
+ };
16605
+ }
16606
+ var fastFormat = createFastFormatRule();
16607
+ var fast_format_default = fastFormat;
16608
+
15893
16609
  // src/rules/no-async-constructor.ts
15894
16610
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
15895
16611
  var PROMISE_CHAIN_METHODS = new Set(["then", "catch", "finally"]);
@@ -16023,22 +16739,24 @@ function findConstructorViolations(constructorBody, asyncMethods) {
16023
16739
  if (!hasDynamicProperties(current))
16024
16740
  return;
16025
16741
  for (const key in current) {
16026
- const childValue = current[key];
16027
- if (childValue === undefined)
16028
- continue;
16029
- if (Array.isArray(childValue)) {
16030
- for (const item of childValue) {
16031
- if (!isNode(item))
16032
- continue;
16033
- parentMap.set(item, current);
16034
- traverse(item);
16742
+ if (Object.hasOwn(current, key)) {
16743
+ const childValue = current[key];
16744
+ if (childValue === undefined)
16745
+ continue;
16746
+ if (Array.isArray(childValue)) {
16747
+ for (const item of childValue) {
16748
+ if (!isNode(item))
16749
+ continue;
16750
+ parentMap.set(item, current);
16751
+ traverse(item);
16752
+ }
16753
+ continue;
16035
16754
  }
16036
- continue;
16755
+ if (!isNode(childValue))
16756
+ continue;
16757
+ parentMap.set(childValue, current);
16758
+ traverse(childValue);
16037
16759
  }
16038
- if (!isNode(childValue))
16039
- continue;
16040
- parentMap.set(childValue, current);
16041
- traverse(childValue);
16042
16760
  }
16043
16761
  }
16044
16762
  traverse(constructorBody);
@@ -16182,7 +16900,7 @@ import { createRequire as createRequire4 } from "node:module";
16182
16900
  import { createRequire as createRequire2 } from "node:module";
16183
16901
  var require2 = createRequire2(import.meta.url);
16184
16902
  var __dirname2 = new URL(".", import.meta.url).pathname;
16185
- var { readFileSync } = require2("node:fs");
16903
+ var { readFileSync: readFileSync2 } = require2("node:fs");
16186
16904
  var nativeBinding = null;
16187
16905
  var loadErrors = [];
16188
16906
  var isMusl = () => {
@@ -16201,7 +16919,7 @@ var isMusl = () => {
16201
16919
  var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
16202
16920
  var isMuslFromFilesystem = () => {
16203
16921
  try {
16204
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
16922
+ return readFileSync2("/usr/bin/ldd", "utf-8").includes("musl");
16205
16923
  } catch {
16206
16924
  return null;
16207
16925
  }
@@ -17106,8 +17824,8 @@ function createCamelCaseDetector(probability) {
17106
17824
  }
17107
17825
 
17108
17826
  // src/recognizers/contains-detector.ts
17109
- var WHITESPACE_GLOBAL_REGEX = /\s+/g;
17110
- var ESCAPE = /[-/\\^$*+?.()|[\]{}]/g;
17827
+ var WHITESPACE_GLOBAL_REGEX = regex2("\\s+", "g");
17828
+ var ESCAPE = regex2("[-/\\^$*+?.()|[\\]{}]", "g");
17111
17829
  function escapeForRegex(value) {
17112
17830
  return value.replaceAll(ESCAPE, String.raw`\$&`);
17113
17831
  }
@@ -17130,17 +17848,17 @@ function createContainsDetector(probability, patterns2) {
17130
17848
  }
17131
17849
 
17132
17850
  // src/recognizers/end-with-detector.ts
17133
- var WHITESPACE_REGEX = /\s/;
17851
+ var WHITESPACE_REGEX = regex2("\\s");
17134
17852
  function createEndWithDetector(probability, endings) {
17135
17853
  const endingsSet = new Set(endings);
17136
17854
  return {
17137
17855
  probability,
17138
17856
  scan(line) {
17139
17857
  for (let index2 = line.length - 1;index2 >= 0; index2 -= 1) {
17140
- const char = line.charAt(index2);
17141
- if (endingsSet.has(char))
17858
+ const character = line.charAt(index2);
17859
+ if (endingsSet.has(character))
17142
17860
  return 1;
17143
- if (!WHITESPACE_REGEX.test(char) && char !== "*" && char !== "/")
17861
+ if (!WHITESPACE_REGEX.test(character) && character !== "*" && character !== "/")
17144
17862
  return 0;
17145
17863
  }
17146
17864
  return 0;
@@ -17258,7 +17976,7 @@ function groupComments(comments, sourceCode) {
17258
17976
  if (size > 0) {
17259
17977
  groups[groupsSize++] = {
17260
17978
  comments: currentLineComments,
17261
- value: currentLineComments.map((c) => c.value).join(`
17979
+ value: currentLineComments.map(({ value }) => value).join(`
17262
17980
  `)
17263
17981
  };
17264
17982
  currentLineComments = [];
@@ -17341,7 +18059,7 @@ function toParsedStatements(body) {
17341
18059
  function isExpressionExclusion(statement, codeText) {
17342
18060
  if (statement.type !== "ExpressionStatement")
17343
18061
  return false;
17344
- const expression = statement.expression;
18062
+ const { expression } = statement;
17345
18063
  if (!expression)
17346
18064
  return false;
17347
18065
  if (expression.type === "Identifier")
@@ -17418,7 +18136,7 @@ var noCommentedCode = {
17418
18136
  if (containsCode(balanced, context.filename)) {
17419
18137
  const firstComment = group.comments.at(0);
17420
18138
  const lastComment = group.comments.at(-1);
17421
- if (!firstComment || !lastComment)
18139
+ if (!(firstComment && lastComment))
17422
18140
  continue;
17423
18141
  context.report({
17424
18142
  loc: {
@@ -17455,84 +18173,622 @@ var noCommentedCode = {
17455
18173
  };
17456
18174
  var no_commented_code_default = noCommentedCode;
17457
18175
 
17458
- // src/rules/no-instance-methods-without-this.ts
17459
- import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/types";
17460
- var DEFAULT_OPTIONS = {
17461
- checkPrivate: true,
17462
- checkProtected: true,
17463
- checkPublic: true
17464
- };
17465
- function normalizeOptions(rawOptions) {
17466
- const mergedOptions = { ...DEFAULT_OPTIONS };
17467
- if (rawOptions?.checkPrivate !== undefined)
17468
- mergedOptions.checkPrivate = rawOptions.checkPrivate;
17469
- if (rawOptions?.checkProtected !== undefined)
17470
- mergedOptions.checkProtected = rawOptions.checkProtected;
17471
- if (rawOptions?.checkPublic !== undefined)
17472
- mergedOptions.checkPublic = rawOptions.checkPublic;
17473
- return mergedOptions;
17474
- }
17475
- function shouldCheckMethod(node, options3) {
17476
- if (node.static)
17477
- return false;
17478
- if (node.kind !== "method")
17479
- return false;
17480
- const accessibility = node.accessibility ?? "public";
17481
- if (accessibility === "private" && !options3.checkPrivate)
17482
- return false;
17483
- if (accessibility === "protected" && !options3.checkProtected)
17484
- return false;
17485
- if (accessibility === "public" && !options3.checkPublic)
17486
- return false;
17487
- return true;
18176
+ // src/rules/no-god-components.ts
18177
+ import { TSESTree as TSESTree5 } from "@typescript-eslint/types";
18178
+ var COMPONENT_NAME_PATTERN = /^[A-Z]/;
18179
+ var FUNCTION_BOUNDARIES = new Set([
18180
+ TSESTree5.AST_NODE_TYPES.FunctionDeclaration,
18181
+ TSESTree5.AST_NODE_TYPES.FunctionExpression,
18182
+ TSESTree5.AST_NODE_TYPES.ArrowFunctionExpression
18183
+ ]);
18184
+ var RUNTIME_TS_WRAPPERS = new Set([
18185
+ "ParenthesizedExpression",
18186
+ "TSAsExpression",
18187
+ "TSSatisfiesExpression",
18188
+ "TSTypeAssertion",
18189
+ "TSNonNullExpression",
18190
+ "TSInstantiationExpression",
18191
+ "ChainExpression"
18192
+ ]);
18193
+ function isComponentName(name) {
18194
+ return COMPONENT_NAME_PATTERN.test(name);
17488
18195
  }
17489
- function isNode2(value) {
17490
- return typeof value === "object" && value !== null && "type" in value;
18196
+ function isReactComponentHOC(callExpr) {
18197
+ const { callee } = callExpr;
18198
+ if (callee.type === TSESTree5.AST_NODE_TYPES.Identifier)
18199
+ return callee.name === "forwardRef" || callee.name === "memo";
18200
+ if (callee.type === TSESTree5.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree5.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === TSESTree5.AST_NODE_TYPES.Identifier)
18201
+ return callee.property.name === "forwardRef" || callee.property.name === "memo";
18202
+ return false;
17491
18203
  }
17492
- function hasDynamicProperties2(_node) {
17493
- return true;
18204
+ function getComponentNameFromFunction(node) {
18205
+ if (node.type === TSESTree5.AST_NODE_TYPES.FunctionDeclaration && node.id && isComponentName(node.id.name)) {
18206
+ return node.id.name;
18207
+ }
18208
+ if (node.type === TSESTree5.AST_NODE_TYPES.FunctionExpression || node.type === TSESTree5.AST_NODE_TYPES.ArrowFunctionExpression) {
18209
+ const { parent } = node;
18210
+ if (parent === null || parent === undefined)
18211
+ return;
18212
+ if (parent.type === TSESTree5.AST_NODE_TYPES.VariableDeclarator && parent.id.type === TSESTree5.AST_NODE_TYPES.Identifier && isComponentName(parent.id.name)) {
18213
+ return parent.id.name;
18214
+ }
18215
+ if (parent.type === TSESTree5.AST_NODE_TYPES.Property && parent.key.type === TSESTree5.AST_NODE_TYPES.Identifier && isComponentName(parent.key.name)) {
18216
+ return parent.key.name;
18217
+ }
18218
+ if (parent.type === TSESTree5.AST_NODE_TYPES.MethodDefinition && parent.key.type === TSESTree5.AST_NODE_TYPES.Identifier && isComponentName(parent.key.name)) {
18219
+ return parent.key.name;
18220
+ }
18221
+ }
18222
+ return;
17494
18223
  }
17495
- function traverseForThis(currentNode, visited2) {
17496
- if (visited2.has(currentNode))
17497
- return false;
17498
- visited2.add(currentNode);
17499
- if (currentNode.type === AST_NODE_TYPES2.ThisExpression || currentNode.type === AST_NODE_TYPES2.Super)
17500
- return true;
17501
- if (!hasDynamicProperties2(currentNode))
17502
- return false;
17503
- for (const key in currentNode) {
17504
- const childValue = currentNode[key];
17505
- if (childValue === null || childValue === undefined)
17506
- continue;
17507
- if (Array.isArray(childValue)) {
17508
- for (const item of childValue)
17509
- if (isNode2(item) && traverseForThis(item, visited2))
17510
- return true;
17511
- continue;
18224
+ function getComponentNameFromCallParent(callExpr) {
18225
+ const { parent } = callExpr;
18226
+ if (parent === null || parent === undefined)
18227
+ return;
18228
+ if (parent.type === TSESTree5.AST_NODE_TYPES.VariableDeclarator && parent.id.type === TSESTree5.AST_NODE_TYPES.Identifier && isComponentName(parent.id.name)) {
18229
+ return parent.id.name;
18230
+ }
18231
+ if (parent.type === TSESTree5.AST_NODE_TYPES.AssignmentExpression && parent.left.type === TSESTree5.AST_NODE_TYPES.Identifier && isComponentName(parent.left.name)) {
18232
+ return parent.left.name;
18233
+ }
18234
+ if (parent.type === TSESTree5.AST_NODE_TYPES.ExportDefaultDeclaration && callExpr.arguments.length > 0) {
18235
+ const [firstArg] = callExpr.arguments;
18236
+ if (firstArg && firstArg.type === TSESTree5.AST_NODE_TYPES.FunctionExpression && firstArg.id && isComponentName(firstArg.id.name)) {
18237
+ return firstArg.id.name;
17512
18238
  }
17513
- if (isNode2(childValue) && traverseForThis(childValue, visited2))
17514
- return true;
17515
18239
  }
17516
- return false;
18240
+ return;
17517
18241
  }
17518
- function methodUsesThis(node) {
17519
- const value = node.value;
17520
- if (value === undefined || value.type !== AST_NODE_TYPES2.FunctionExpression)
17521
- return false;
17522
- return traverseForThis(value, new WeakSet);
18242
+ function getHookName(callExpression) {
18243
+ const { callee } = callExpression;
18244
+ if (callee.type === TSESTree5.AST_NODE_TYPES.Identifier)
18245
+ return callee.name;
18246
+ if (callee.type === TSESTree5.AST_NODE_TYPES.MemberExpression && callee.property.type === TSESTree5.AST_NODE_TYPES.Identifier) {
18247
+ return callee.property.name;
18248
+ }
18249
+ return;
17523
18250
  }
17524
- var noInstanceMethodsWithoutThis = {
17525
- create(context) {
17526
- const rawOptions = context.options[0];
17527
- const options3 = normalizeOptions(rawOptions);
17528
- return {
17529
- MethodDefinition(node) {
17530
- if (!shouldCheckMethod(node, options3))
17531
- return;
17532
- if (methodUsesThis(node))
17533
- return;
17534
- const methodName = node.key.type === AST_NODE_TYPES2.Identifier ? node.key.name : "unknown";
17535
- context.report({
18251
+ function countDestructuredProps(node) {
18252
+ const [firstParam] = node.params;
18253
+ if (!firstParam)
18254
+ return;
18255
+ let pattern4;
18256
+ if (firstParam.type === TSESTree5.AST_NODE_TYPES.ObjectPattern)
18257
+ pattern4 = firstParam;
18258
+ if (firstParam.type === TSESTree5.AST_NODE_TYPES.AssignmentPattern && firstParam.left.type === TSESTree5.AST_NODE_TYPES.ObjectPattern) {
18259
+ pattern4 = firstParam.left;
18260
+ }
18261
+ if (!pattern4)
18262
+ return;
18263
+ let count = 0;
18264
+ for (const { type: type3 } of pattern4.properties)
18265
+ if (type3 === TSESTree5.AST_NODE_TYPES.Property)
18266
+ count += 1;
18267
+ return count;
18268
+ }
18269
+ function isTypeOnlyNullLiteral(node) {
18270
+ const { parent } = node;
18271
+ if (parent === null || parent === undefined)
18272
+ return false;
18273
+ if (typeof parent.type === "string" && parent.type.startsWith("TS") && !RUNTIME_TS_WRAPPERS.has(parent.type))
18274
+ return true;
18275
+ if (parent.type === TSESTree5.AST_NODE_TYPES.TSLiteralType)
18276
+ return true;
18277
+ return false;
18278
+ }
18279
+ function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
18280
+ let maxJsxDepth = 0;
18281
+ let stateHookCount = 0;
18282
+ const nullLiterals = new Array;
18283
+ function visit(current, jsxDepth) {
18284
+ if (FUNCTION_BOUNDARIES.has(current.type) && current !== functionNode)
18285
+ return;
18286
+ let nextDepth = jsxDepth;
18287
+ if (current.type === TSESTree5.AST_NODE_TYPES.JSXElement || current.type === TSESTree5.AST_NODE_TYPES.JSXFragment) {
18288
+ nextDepth = jsxDepth + 1;
18289
+ if (nextDepth > maxJsxDepth)
18290
+ maxJsxDepth = nextDepth;
18291
+ }
18292
+ if (current.type === TSESTree5.AST_NODE_TYPES.CallExpression) {
18293
+ const hookName = getHookName(current);
18294
+ if (typeof hookName === "string" && hookName.length > 0 && stateHooks.has(hookName))
18295
+ stateHookCount += 1;
18296
+ }
18297
+ if (current.type === TSESTree5.AST_NODE_TYPES.Literal && current.value === null) {
18298
+ const literalNode = current;
18299
+ if (!isTypeOnlyNullLiteral(literalNode))
18300
+ nullLiterals.push(literalNode);
18301
+ }
18302
+ function getVisitorKeysForNodeType(nodeType) {
18303
+ const visitorKeysUnknown = sourceCode.visitorKeys;
18304
+ if (visitorKeysUnknown === null || visitorKeysUnknown === undefined || typeof visitorKeysUnknown !== "object")
18305
+ return [];
18306
+ const visitorKeysRecord = visitorKeysUnknown;
18307
+ const keysUnknown = visitorKeysRecord[nodeType];
18308
+ if (!Array.isArray(keysUnknown))
18309
+ return [];
18310
+ const keys3 = new Array;
18311
+ for (const key of keysUnknown)
18312
+ if (typeof key === "string")
18313
+ keys3.push(key);
18314
+ return keys3;
18315
+ }
18316
+ const keys2 = getVisitorKeysForNodeType(current.type);
18317
+ const currentRecord = current;
18318
+ for (const key of keys2) {
18319
+ const value = currentRecord[key];
18320
+ if (Array.isArray(value)) {
18321
+ for (const item of value) {
18322
+ if (typeof item === "object" && item !== null && "type" in item) {
18323
+ visit(item, nextDepth);
18324
+ }
18325
+ }
18326
+ continue;
18327
+ }
18328
+ if (typeof value === "object" && value !== null && "type" in value) {
18329
+ visit(value, nextDepth);
18330
+ }
18331
+ }
18332
+ }
18333
+ visit(functionNode.body, 0);
18334
+ return { maxJsxDepth, nullLiterals, stateHookCount };
18335
+ }
18336
+ function parseOptions(options3) {
18337
+ const defaults = {
18338
+ enforceTargetLines: true,
18339
+ ignoreComponents: [],
18340
+ maxDestructuredProps: 5,
18341
+ maxLines: 200,
18342
+ maxStateHooks: 5,
18343
+ maxTsxNesting: 3,
18344
+ stateHooks: ["useState", "useReducer", "useBinding"],
18345
+ targetLines: 120
18346
+ };
18347
+ if (typeof options3 !== "object" || options3 === null)
18348
+ return defaults;
18349
+ const cast = options3;
18350
+ return {
18351
+ enforceTargetLines: typeof cast.enforceTargetLines === "boolean" ? cast.enforceTargetLines : defaults.enforceTargetLines,
18352
+ ignoreComponents: Array.isArray(cast.ignoreComponents) ? cast.ignoreComponents : defaults.ignoreComponents,
18353
+ maxDestructuredProps: typeof cast.maxDestructuredProps === "number" ? cast.maxDestructuredProps : defaults.maxDestructuredProps,
18354
+ maxLines: typeof cast.maxLines === "number" ? cast.maxLines : defaults.maxLines,
18355
+ maxStateHooks: typeof cast.maxStateHooks === "number" ? cast.maxStateHooks : defaults.maxStateHooks,
18356
+ maxTsxNesting: typeof cast.maxTsxNesting === "number" ? cast.maxTsxNesting : defaults.maxTsxNesting,
18357
+ stateHooks: Array.isArray(cast.stateHooks) ? cast.stateHooks : defaults.stateHooks,
18358
+ targetLines: typeof cast.targetLines === "number" ? cast.targetLines : defaults.targetLines
18359
+ };
18360
+ }
18361
+ var noGodComponents = {
18362
+ create(context) {
18363
+ const configuration = parseOptions(context.options[0]);
18364
+ const ignoreSet = new Set(configuration.ignoreComponents);
18365
+ const stateHooks = new Set(configuration.stateHooks);
18366
+ const checked = new WeakSet;
18367
+ const { sourceCode } = context;
18368
+ function checkComponent(node, name) {
18369
+ if (ignoreSet.has(name))
18370
+ return;
18371
+ if (checked.has(node))
18372
+ return;
18373
+ checked.add(node);
18374
+ const location = node.loc;
18375
+ if (location !== null && location !== undefined) {
18376
+ const lines = location.end.line - location.start.line + 1;
18377
+ if (lines > configuration.maxLines) {
18378
+ context.report({
18379
+ data: { lines, max: configuration.maxLines, name, target: configuration.targetLines },
18380
+ messageId: "exceedsMaxLines",
18381
+ node
18382
+ });
18383
+ } else if (configuration.enforceTargetLines && lines > configuration.targetLines) {
18384
+ context.report({
18385
+ data: { lines, max: configuration.maxLines, name, target: configuration.targetLines },
18386
+ messageId: "exceedsTargetLines",
18387
+ node
18388
+ });
18389
+ }
18390
+ }
18391
+ const propsCount = countDestructuredProps(node);
18392
+ if (typeof propsCount === "number" && propsCount > configuration.maxDestructuredProps) {
18393
+ context.report({
18394
+ data: { count: propsCount, max: configuration.maxDestructuredProps, name },
18395
+ messageId: "tooManyProps",
18396
+ node
18397
+ });
18398
+ }
18399
+ const analysis = analyzeComponentBody(node, sourceCode, stateHooks);
18400
+ if (analysis.maxJsxDepth > configuration.maxTsxNesting) {
18401
+ context.report({
18402
+ data: { depth: analysis.maxJsxDepth, max: configuration.maxTsxNesting, name },
18403
+ messageId: "tsxNestingTooDeep",
18404
+ node
18405
+ });
18406
+ }
18407
+ if (analysis.stateHookCount > configuration.maxStateHooks) {
18408
+ context.report({
18409
+ data: {
18410
+ count: analysis.stateHookCount,
18411
+ hooks: configuration.stateHooks.join(", "),
18412
+ max: configuration.maxStateHooks,
18413
+ name
18414
+ },
18415
+ messageId: "tooManyStateHooks",
18416
+ node
18417
+ });
18418
+ }
18419
+ for (const literal2 of analysis.nullLiterals) {
18420
+ context.report({
18421
+ messageId: "nullLiteral",
18422
+ node: literal2
18423
+ });
18424
+ }
18425
+ }
18426
+ function maybeCheckFunction(node) {
18427
+ const name = getComponentNameFromFunction(node);
18428
+ if (typeof name !== "string" || name.length === 0)
18429
+ return;
18430
+ checkComponent(node, name);
18431
+ }
18432
+ return {
18433
+ ArrowFunctionExpression(node) {
18434
+ maybeCheckFunction(node);
18435
+ },
18436
+ CallExpression(node) {
18437
+ const callExpr = node;
18438
+ if (!isReactComponentHOC(callExpr))
18439
+ return;
18440
+ const [firstArg] = callExpr.arguments;
18441
+ if (!firstArg || firstArg.type !== TSESTree5.AST_NODE_TYPES.FunctionExpression && firstArg.type !== TSESTree5.AST_NODE_TYPES.ArrowFunctionExpression) {
18442
+ return;
18443
+ }
18444
+ const nameFromParent = getComponentNameFromCallParent(callExpr);
18445
+ const nameFromArg = getComponentNameFromFunction(firstArg);
18446
+ const name = nameFromParent ?? nameFromArg;
18447
+ if (typeof name !== "string" || name.length === 0)
18448
+ return;
18449
+ checkComponent(firstArg, name);
18450
+ },
18451
+ FunctionDeclaration(node) {
18452
+ maybeCheckFunction(node);
18453
+ },
18454
+ FunctionExpression(node) {
18455
+ maybeCheckFunction(node);
18456
+ }
18457
+ };
18458
+ },
18459
+ meta: {
18460
+ docs: {
18461
+ description: "Enforce React component size and complexity limits inspired by the 'Refactor God Component' checklist.",
18462
+ recommended: false
18463
+ },
18464
+ messages: {
18465
+ exceedsMaxLines: "Component '{{name}}' is {{lines}} lines; max allowed is {{max}}. Split into smaller components/hooks.",
18466
+ exceedsTargetLines: "Component '{{name}}' is {{lines}} lines; target is {{target}} (max {{max}}). Consider extracting hooks/components.",
18467
+ nullLiteral: "Avoid `null` in components; use `undefined` instead.",
18468
+ tooManyProps: "Component '{{name}}' destructures {{count}} props; max allowed is {{max}}. Group props or split the component.",
18469
+ tooManyStateHooks: "Component '{{name}}' has {{count}} state hooks ({{hooks}}); max allowed is {{max}}. Extract cohesive state into a custom hook.",
18470
+ tsxNestingTooDeep: "Component '{{name}}' has TSX nesting depth {{depth}}; max allowed is {{max}}. Extract child components."
18471
+ },
18472
+ schema: [
18473
+ {
18474
+ additionalProperties: false,
18475
+ properties: {
18476
+ enforceTargetLines: {
18477
+ default: true,
18478
+ description: "Whether to report when exceeding targetLines (soft limit).",
18479
+ type: "boolean"
18480
+ },
18481
+ ignoreComponents: {
18482
+ description: "Component names to ignore.",
18483
+ items: { type: "string" },
18484
+ type: "array"
18485
+ },
18486
+ maxDestructuredProps: {
18487
+ default: 5,
18488
+ description: "Maximum number of destructured props in a component parameter.",
18489
+ type: "number"
18490
+ },
18491
+ maxLines: {
18492
+ default: 200,
18493
+ description: "Hard maximum lines for a component.",
18494
+ type: "number"
18495
+ },
18496
+ maxStateHooks: {
18497
+ default: 5,
18498
+ description: "Maximum number of stateful hook calls in a component.",
18499
+ type: "number"
18500
+ },
18501
+ maxTsxNesting: {
18502
+ default: 3,
18503
+ description: "Maximum JSX/TSX nesting depth in a component.",
18504
+ type: "number"
18505
+ },
18506
+ stateHooks: {
18507
+ default: ["useState", "useReducer", "useBinding"],
18508
+ description: "Hook names to count toward state complexity.",
18509
+ items: { type: "string" },
18510
+ type: "array"
18511
+ },
18512
+ targetLines: {
18513
+ default: 120,
18514
+ description: "Soft target lines for a component.",
18515
+ type: "number"
18516
+ }
18517
+ },
18518
+ type: "object"
18519
+ }
18520
+ ],
18521
+ type: "problem"
18522
+ }
18523
+ };
18524
+ var no_god_components_default = noGodComponents;
18525
+
18526
+ // src/rules/no-identity-map.ts
18527
+ var import_scope_manager = __toESM(require_dist2(), 1);
18528
+ import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
18529
+ var DEFAULT_BINDING_PATTERNS = ["binding"];
18530
+ function getParameterName(param) {
18531
+ if (param.type === AST_NODE_TYPES2.Identifier)
18532
+ return param.name;
18533
+ if (param.type === AST_NODE_TYPES2.AssignmentPattern && param.left.type === AST_NODE_TYPES2.Identifier) {
18534
+ return param.left.name;
18535
+ }
18536
+ return;
18537
+ }
18538
+ function isBlockReturningIdentity(body, paramName) {
18539
+ if (body.body.length !== 1)
18540
+ return false;
18541
+ const [statement] = body.body;
18542
+ if (statement?.type !== AST_NODE_TYPES2.ReturnStatement)
18543
+ return false;
18544
+ if (!statement.argument)
18545
+ return false;
18546
+ if (statement.argument.type !== AST_NODE_TYPES2.Identifier)
18547
+ return false;
18548
+ return statement.argument.name === paramName;
18549
+ }
18550
+ function isIdentityCallback(callback) {
18551
+ if (callback.type === AST_NODE_TYPES2.ArrowFunctionExpression) {
18552
+ if (callback.params.length !== 1)
18553
+ return false;
18554
+ const [param] = callback.params;
18555
+ if (param === undefined)
18556
+ return false;
18557
+ const paramName = getParameterName(param);
18558
+ if (paramName === undefined || paramName === "")
18559
+ return false;
18560
+ if (callback.body.type === AST_NODE_TYPES2.Identifier) {
18561
+ return callback.body.name === paramName;
18562
+ }
18563
+ if (callback.body.type === AST_NODE_TYPES2.BlockStatement) {
18564
+ return isBlockReturningIdentity(callback.body, paramName);
18565
+ }
18566
+ return false;
18567
+ }
18568
+ if (callback.type === AST_NODE_TYPES2.FunctionExpression) {
18569
+ if (callback.params.length !== 1)
18570
+ return false;
18571
+ const [param] = callback.params;
18572
+ if (param === undefined)
18573
+ return false;
18574
+ const paramName = getParameterName(param);
18575
+ if (paramName === undefined || paramName === "")
18576
+ return false;
18577
+ return isBlockReturningIdentity(callback.body, paramName);
18578
+ }
18579
+ return false;
18580
+ }
18581
+ function findVariable(context, identifier3) {
18582
+ let scope = context.sourceCode.getScope(identifier3);
18583
+ while (scope) {
18584
+ const variable = scope.set.get(identifier3.name);
18585
+ if (variable)
18586
+ return variable;
18587
+ scope = scope.upper ?? undefined;
18588
+ }
18589
+ return;
18590
+ }
18591
+ function getHookName2(node) {
18592
+ const { callee } = node;
18593
+ if (callee.type === AST_NODE_TYPES2.Identifier) {
18594
+ return callee.name;
18595
+ }
18596
+ if (callee.type === AST_NODE_TYPES2.MemberExpression && callee.property.type === AST_NODE_TYPES2.Identifier) {
18597
+ return callee.property.name;
18598
+ }
18599
+ return;
18600
+ }
18601
+ function isJoinBindingsCall(node) {
18602
+ const { callee } = node;
18603
+ if (callee.type === AST_NODE_TYPES2.Identifier) {
18604
+ return callee.name === "joinBindings";
18605
+ }
18606
+ if (callee.type === AST_NODE_TYPES2.MemberExpression && callee.property.type === AST_NODE_TYPES2.Identifier) {
18607
+ return callee.property.name === "joinBindings";
18608
+ }
18609
+ return false;
18610
+ }
18611
+ function isBindingInitialization(variable) {
18612
+ for (const def of variable.defs) {
18613
+ if (def.type !== import_scope_manager.DefinitionType.Variable)
18614
+ continue;
18615
+ const { init } = def.node;
18616
+ if (!init || init.type !== AST_NODE_TYPES2.CallExpression)
18617
+ continue;
18618
+ const hookName = getHookName2(init);
18619
+ if (hookName === "useBinding")
18620
+ return true;
18621
+ if (isJoinBindingsCall(init))
18622
+ return true;
18623
+ if (init.callee.type === AST_NODE_TYPES2.MemberExpression && init.callee.property.type === AST_NODE_TYPES2.Identifier && init.callee.property.name === "map") {
18624
+ return true;
18625
+ }
18626
+ }
18627
+ return false;
18628
+ }
18629
+ function isLikelyBinding(context, callee, patterns2) {
18630
+ const { object: object3 } = callee;
18631
+ if (object3.type === AST_NODE_TYPES2.Identifier) {
18632
+ const lowerName = object3.name.toLowerCase();
18633
+ for (const pattern4 of patterns2) {
18634
+ if (lowerName.includes(pattern4.toLowerCase()))
18635
+ return true;
18636
+ }
18637
+ const variable = findVariable(context, object3);
18638
+ if (variable && isBindingInitialization(variable))
18639
+ return true;
18640
+ }
18641
+ if (object3.type === AST_NODE_TYPES2.CallExpression && object3.callee.type === AST_NODE_TYPES2.MemberExpression && object3.callee.property.type === AST_NODE_TYPES2.Identifier && object3.callee.property.name === "map") {
18642
+ return true;
18643
+ }
18644
+ if (object3.type === AST_NODE_TYPES2.CallExpression && isJoinBindingsCall(object3)) {
18645
+ return true;
18646
+ }
18647
+ return false;
18648
+ }
18649
+ var noIdentityMap = {
18650
+ create(context) {
18651
+ const [rawOptions] = context.options;
18652
+ const patterns2 = rawOptions?.bindingPatterns ?? DEFAULT_BINDING_PATTERNS;
18653
+ return {
18654
+ CallExpression(node) {
18655
+ const { callee } = node;
18656
+ if (callee.type !== AST_NODE_TYPES2.MemberExpression)
18657
+ return;
18658
+ if (callee.computed)
18659
+ return;
18660
+ if (callee.property.type !== AST_NODE_TYPES2.Identifier)
18661
+ return;
18662
+ if (callee.property.name !== "map")
18663
+ return;
18664
+ if (node.arguments.length !== 1)
18665
+ return;
18666
+ const [callback] = node.arguments;
18667
+ if (!callback || callback.type === AST_NODE_TYPES2.SpreadElement)
18668
+ return;
18669
+ if (!isIdentityCallback(callback))
18670
+ return;
18671
+ const isBinding = isLikelyBinding(context, callee, patterns2);
18672
+ context.report({
18673
+ fix(fixer) {
18674
+ const objectText = context.sourceCode.getText(callee.object);
18675
+ return fixer.replaceText(node, objectText);
18676
+ },
18677
+ messageId: isBinding ? "identityBindingMap" : "identityArrayMap",
18678
+ node
18679
+ });
18680
+ }
18681
+ };
18682
+ },
18683
+ defaultOptions: [{}],
18684
+ meta: {
18685
+ docs: {
18686
+ description: "Disallow pointless identity `.map()` calls that return the parameter unchanged"
18687
+ },
18688
+ fixable: "code",
18689
+ messages: {
18690
+ identityArrayMap: "Pointless identity `.map()` call on Array. Use `table.clone(array)` or `[...array]` instead.",
18691
+ identityBindingMap: "Pointless identity `.map()` call on Binding. Use the original binding directly."
18692
+ },
18693
+ schema: [
18694
+ {
18695
+ additionalProperties: false,
18696
+ properties: {
18697
+ bindingPatterns: {
18698
+ default: [...DEFAULT_BINDING_PATTERNS],
18699
+ description: "Variable name patterns to recognize as Bindings (case insensitive)",
18700
+ items: { type: "string" },
18701
+ type: "array"
18702
+ }
18703
+ },
18704
+ type: "object"
18705
+ }
18706
+ ],
18707
+ type: "suggestion"
18708
+ }
18709
+ };
18710
+ var no_identity_map_default = noIdentityMap;
18711
+
18712
+ // src/rules/no-instance-methods-without-this.ts
18713
+ import { AST_NODE_TYPES as AST_NODE_TYPES3 } from "@typescript-eslint/types";
18714
+ var DEFAULT_OPTIONS = {
18715
+ checkPrivate: true,
18716
+ checkProtected: true,
18717
+ checkPublic: true
18718
+ };
18719
+ function normalizeOptions(rawOptions) {
18720
+ const mergedOptions = { ...DEFAULT_OPTIONS };
18721
+ if (rawOptions?.checkPrivate !== undefined)
18722
+ mergedOptions.checkPrivate = rawOptions.checkPrivate;
18723
+ if (rawOptions?.checkProtected !== undefined)
18724
+ mergedOptions.checkProtected = rawOptions.checkProtected;
18725
+ if (rawOptions?.checkPublic !== undefined)
18726
+ mergedOptions.checkPublic = rawOptions.checkPublic;
18727
+ return mergedOptions;
18728
+ }
18729
+ function shouldCheckMethod(node, options3) {
18730
+ if (node.static)
18731
+ return false;
18732
+ if (node.kind !== "method")
18733
+ return false;
18734
+ const accessibility = node.accessibility ?? "public";
18735
+ if (accessibility === "private" && !options3.checkPrivate)
18736
+ return false;
18737
+ if (accessibility === "protected" && !options3.checkProtected)
18738
+ return false;
18739
+ if (accessibility === "public" && !options3.checkPublic)
18740
+ return false;
18741
+ return true;
18742
+ }
18743
+ function isNode2(value) {
18744
+ return typeof value === "object" && value !== null && "type" in value;
18745
+ }
18746
+ function hasDynamicProperties2(_node) {
18747
+ return true;
18748
+ }
18749
+ function traverseForThis(currentNode, visited2) {
18750
+ if (visited2.has(currentNode))
18751
+ return false;
18752
+ visited2.add(currentNode);
18753
+ if (currentNode.type === AST_NODE_TYPES3.ThisExpression || currentNode.type === AST_NODE_TYPES3.Super)
18754
+ return true;
18755
+ if (!hasDynamicProperties2(currentNode))
18756
+ return false;
18757
+ for (const key in currentNode) {
18758
+ if (!Object.hasOwn(currentNode, key))
18759
+ continue;
18760
+ const childValue = currentNode[key];
18761
+ if (childValue === null || childValue === undefined)
18762
+ continue;
18763
+ if (Array.isArray(childValue)) {
18764
+ for (const item of childValue)
18765
+ if (isNode2(item) && traverseForThis(item, visited2))
18766
+ return true;
18767
+ continue;
18768
+ }
18769
+ if (isNode2(childValue) && traverseForThis(childValue, visited2))
18770
+ return true;
18771
+ }
18772
+ return false;
18773
+ }
18774
+ function methodUsesThis(node) {
18775
+ const { value } = node;
18776
+ if (value === undefined || value.type !== AST_NODE_TYPES3.FunctionExpression)
18777
+ return false;
18778
+ return traverseForThis(value, new WeakSet);
18779
+ }
18780
+ var noInstanceMethodsWithoutThis = {
18781
+ create(context) {
18782
+ const [rawOptions] = context.options;
18783
+ const options3 = normalizeOptions(rawOptions);
18784
+ return {
18785
+ MethodDefinition(node) {
18786
+ if (!shouldCheckMethod(node, options3))
18787
+ return;
18788
+ if (methodUsesThis(node))
18789
+ return;
18790
+ const methodName = node.key.type === AST_NODE_TYPES3.Identifier ? node.key.name : "unknown";
18791
+ context.report({
17536
18792
  data: { methodName },
17537
18793
  messageId: "noInstanceMethodWithoutThis",
17538
18794
  node
@@ -17604,7 +18860,7 @@ var noPrint = {
17604
18860
  var no_print_default = noPrint;
17605
18861
 
17606
18862
  // src/rules/no-shorthand-names.ts
17607
- import { TSESTree as TSESTree5 } from "@typescript-eslint/types";
18863
+ import { TSESTree as TSESTree6 } from "@typescript-eslint/types";
17608
18864
  var isRuleOptions = Compile(build_default.Object({
17609
18865
  allowPropertyAccess: build_default.Optional(build_default.Array(build_default.String())),
17610
18866
  shorthands: build_default.Optional(build_default.Record(build_default.String(), build_default.String()))
@@ -17621,19 +18877,19 @@ var DEFAULT_OPTIONS2 = {
17621
18877
  plr: "player"
17622
18878
  }
17623
18879
  };
17624
- var REGEX_PATTERN_MATCHER = /^\/(.+)\/([gimsuy]*)$/;
18880
+ var REGEX_PATTERN_MATCHER = regex2("^/(?<first>.+)/(?<second>[gimsuy]*)$");
17625
18881
  var WORD_BOUNDARY_REGEX = /(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|(?<=[a-zA-Z])(?=\d)|(?<=\d)(?=[a-zA-Z])/;
17626
18882
  function splitIdentifierIntoWords(identifier3) {
17627
18883
  return identifier3.split(WORD_BOUNDARY_REGEX);
17628
18884
  }
17629
18885
  function createMatcher(key, replacement) {
17630
18886
  if (key.startsWith("/")) {
17631
- const match = key.match(REGEX_PATTERN_MATCHER);
18887
+ const match = REGEX_PATTERN_MATCHER.exec(key);
17632
18888
  if (match) {
17633
18889
  return {
17634
18890
  matcher: {
17635
18891
  original: key,
17636
- pattern: new RegExp(`^${match[1]}$`, match[2]),
18892
+ pattern: new RegExp(`^${match.groups.first}$`, match.groups.second),
17637
18893
  replacement
17638
18894
  },
17639
18895
  type: "pattern"
@@ -17671,8 +18927,8 @@ function matchWord(word, matchers, exactMatchers) {
17671
18927
  const match = word.match(matcher.pattern);
17672
18928
  if (match) {
17673
18929
  let replaced = matcher.replacement;
17674
- for (let i = 1;i < match.length; i++) {
17675
- replaced = replaced.replaceAll(new RegExp(`\\$${i}`, "g"), match[i] ?? "");
18930
+ for (let index2 = 1;index2 < match.length; index2 += 1) {
18931
+ replaced = replaced.replaceAll(new RegExp(`\\$${index2}`, "g"), match[index2] ?? "");
17676
18932
  }
17677
18933
  return {
17678
18934
  replacement: replaced,
@@ -17684,7 +18940,7 @@ function matchWord(word, matchers, exactMatchers) {
17684
18940
  }
17685
18941
  function buildReplacementIdentifier(identifier3, options3) {
17686
18942
  const words = splitIdentifierIntoWords(identifier3);
17687
- const matches = [];
18943
+ const matches = new Array;
17688
18944
  let hasMatch = false;
17689
18945
  const newWords = words.map((word) => {
17690
18946
  const match = matchWord(word, options3.matchers, options3.exactMatchers);
@@ -17701,18 +18957,18 @@ function buildReplacementIdentifier(identifier3, options3) {
17701
18957
  }
17702
18958
  function normalizeOptions2(rawOptions) {
17703
18959
  const mergedShorthands = { ...DEFAULT_OPTIONS2.shorthands };
17704
- if (rawOptions?.shorthands)
18960
+ if (rawOptions?.shorthands) {
17705
18961
  for (const [key, value] of Object.entries(rawOptions.shorthands))
17706
18962
  mergedShorthands[key] = value;
17707
- const matchers = [];
18963
+ }
18964
+ const matchers = new Array;
17708
18965
  const exactMatchers = new Map;
17709
18966
  for (const [key, value] of Object.entries(mergedShorthands)) {
17710
18967
  const result = createMatcher(key, value);
17711
- if (result.type === "exact") {
18968
+ if (result.type === "exact")
17712
18969
  exactMatchers.set(result.original, result.replacement);
17713
- } else {
18970
+ else
17714
18971
  matchers.push(result.matcher);
17715
- }
17716
18972
  }
17717
18973
  const allowPropertyAccessSource = rawOptions?.allowPropertyAccess ?? DEFAULT_OPTIONS2.allowPropertyAccess;
17718
18974
  return {
@@ -17736,11 +18992,12 @@ var noShorthandNames = {
17736
18992
  const { replaced, matches } = result;
17737
18993
  const { parent } = node;
17738
18994
  const [match] = matches;
17739
- if (matches.length === 1 && match !== undefined && allowPropertyAccess.has(match.shorthand) && parent !== undefined && isRecord2(parent) && parent.type === TSESTree5.AST_NODE_TYPES.MemberExpression && parent.property === node)
18995
+ if (matches.length === 1 && match !== undefined && allowPropertyAccess.has(match.shorthand) && parent !== undefined && isRecord2(parent) && parent.type === TSESTree6.AST_NODE_TYPES.MemberExpression && parent.property === node) {
17740
18996
  return;
17741
- if (identifierName === "plr" && parent?.type === TSESTree5.AST_NODE_TYPES.VariableDeclarator && parent.id === node) {
18997
+ }
18998
+ if (identifierName === "plr" && parent?.type === TSESTree6.AST_NODE_TYPES.VariableDeclarator && parent.id === node) {
17742
18999
  const { init } = parent;
17743
- if (init && isRecord2(init) && init.type === TSESTree5.AST_NODE_TYPES.MemberExpression && init.object !== undefined && isRecord2(init.object) && init.object.type === TSESTree5.AST_NODE_TYPES.Identifier && init.object.name === "Players" && init.property !== undefined && isRecord2(init.property) && init.property.type === TSESTree5.AST_NODE_TYPES.Identifier && init.property.name === "LocalPlayer") {
19000
+ if (init && isRecord2(init) && init.type === TSESTree6.AST_NODE_TYPES.MemberExpression && init.object !== undefined && isRecord2(init.object) && init.object.type === TSESTree6.AST_NODE_TYPES.Identifier && init.object.name === "Players" && init.property !== undefined && isRecord2(init.property) && init.property.type === TSESTree6.AST_NODE_TYPES.Identifier && init.property.name === "LocalPlayer") {
17744
19001
  context.report({
17745
19002
  data: { replacement: "localPlayer", shorthand: "plr" },
17746
19003
  messageId: "useReplacement",
@@ -17749,7 +19006,7 @@ var noShorthandNames = {
17749
19006
  return;
17750
19007
  }
17751
19008
  }
17752
- const shorthandList = matches.map((m) => m.shorthand).join(", ");
19009
+ const shorthandList = matches.map(({ shorthand }) => shorthand).join(", ");
17753
19010
  context.report({
17754
19011
  data: { replacement: replaced, shorthand: shorthandList },
17755
19012
  messageId: "useReplacement",
@@ -17790,8 +19047,8 @@ var noShorthandNames = {
17790
19047
  var no_shorthand_names_default = noShorthandNames;
17791
19048
 
17792
19049
  // src/rules/no-useless-use-spring.ts
17793
- var import_scope_manager = __toESM(require_dist2(), 1);
17794
- import { AST_NODE_TYPES as AST_NODE_TYPES3 } from "@typescript-eslint/utils";
19050
+ var import_scope_manager2 = __toESM(require_dist2(), 1);
19051
+ import { AST_NODE_TYPES as AST_NODE_TYPES4 } from "@typescript-eslint/utils";
17795
19052
  var DEFAULT_STATIC_GLOBAL_FACTORIES = [
17796
19053
  "Axes",
17797
19054
  "BrickColor",
@@ -17827,34 +19084,34 @@ var STATIC_UNARY_OPERATORS = new Set(["-", "+", "!", "~", "typeof", "void", "del
17827
19084
  function unwrapExpression(expression) {
17828
19085
  let current = expression;
17829
19086
  while (true) {
17830
- if (current.type === AST_NODE_TYPES3.TSAsExpression) {
19087
+ if (current.type === AST_NODE_TYPES4.TSAsExpression) {
17831
19088
  current = current.expression;
17832
19089
  continue;
17833
19090
  }
17834
- if (current.type === AST_NODE_TYPES3.TSTypeAssertion) {
19091
+ if (current.type === AST_NODE_TYPES4.TSTypeAssertion) {
17835
19092
  current = current.expression;
17836
19093
  continue;
17837
19094
  }
17838
- if (current.type === AST_NODE_TYPES3.TSNonNullExpression) {
19095
+ if (current.type === AST_NODE_TYPES4.TSNonNullExpression) {
17839
19096
  current = current.expression;
17840
19097
  continue;
17841
19098
  }
17842
- if (current.type === AST_NODE_TYPES3.TSSatisfiesExpression) {
19099
+ if (current.type === AST_NODE_TYPES4.TSSatisfiesExpression) {
17843
19100
  current = current.expression;
17844
19101
  continue;
17845
19102
  }
17846
- if (current.type === AST_NODE_TYPES3.TSInstantiationExpression) {
19103
+ if (current.type === AST_NODE_TYPES4.TSInstantiationExpression) {
17847
19104
  current = current.expression;
17848
19105
  continue;
17849
19106
  }
17850
- if (current.type === AST_NODE_TYPES3.ChainExpression) {
19107
+ if (current.type === AST_NODE_TYPES4.ChainExpression) {
17851
19108
  current = current.expression;
17852
19109
  continue;
17853
19110
  }
17854
19111
  return current;
17855
19112
  }
17856
19113
  }
17857
- function findVariable(context, identifier3) {
19114
+ function findVariable2(context, identifier3) {
17858
19115
  let scope = context.sourceCode.getScope(identifier3);
17859
19116
  while (scope) {
17860
19117
  const variable = scope.set.get(identifier3.name);
@@ -17865,29 +19122,29 @@ function findVariable(context, identifier3) {
17865
19122
  return;
17866
19123
  }
17867
19124
  function isModuleLevelScope(scope) {
17868
- return scope.type === import_scope_manager.ScopeType.module || scope.type === import_scope_manager.ScopeType.global;
19125
+ return scope.type === import_scope_manager2.ScopeType.module || scope.type === import_scope_manager2.ScopeType.global;
17869
19126
  }
17870
19127
  function isImport(variable) {
17871
19128
  for (const definition of variable.defs)
17872
- if (definition.type === import_scope_manager.DefinitionType.ImportBinding)
19129
+ if (definition.type === import_scope_manager2.DefinitionType.ImportBinding)
17873
19130
  return true;
17874
19131
  return false;
17875
19132
  }
17876
19133
  function getConstInitializer(definition) {
17877
- if (definition === undefined || definition.type !== import_scope_manager.DefinitionType.Variable)
19134
+ if (definition === undefined || definition.type !== import_scope_manager2.DefinitionType.Variable)
17878
19135
  return;
17879
19136
  const declarator = definition.node;
17880
- if (declarator.type !== AST_NODE_TYPES3.VariableDeclarator)
19137
+ if (declarator.type !== AST_NODE_TYPES4.VariableDeclarator)
17881
19138
  return;
17882
19139
  const declaration = definition.parent;
17883
- if (declaration?.type !== AST_NODE_TYPES3.VariableDeclaration)
19140
+ if (declaration?.type !== AST_NODE_TYPES4.VariableDeclaration)
17884
19141
  return;
17885
19142
  if (declaration.kind !== "const")
17886
19143
  return;
17887
19144
  return declarator.init ?? undefined;
17888
19145
  }
17889
19146
  function isStaticIdentifier(context, identifier3, seen, options3) {
17890
- const variable = findVariable(context, identifier3);
19147
+ const variable = findVariable2(context, identifier3);
17891
19148
  if (variable === undefined)
17892
19149
  return options3.staticGlobalFactories.has(identifier3.name);
17893
19150
  if (!isModuleLevelScope(variable.scope))
@@ -17904,34 +19161,34 @@ function isStaticIdentifier(context, identifier3, seen, options3) {
17904
19161
  return false;
17905
19162
  }
17906
19163
  function isStaticMemberProperty(property, seen, options3) {
17907
- if (property.type === AST_NODE_TYPES3.PrivateIdentifier)
19164
+ if (property.type === AST_NODE_TYPES4.PrivateIdentifier)
17908
19165
  return false;
17909
- if (property.type === AST_NODE_TYPES3.Identifier)
19166
+ if (property.type === AST_NODE_TYPES4.Identifier)
17910
19167
  return true;
17911
19168
  return isStaticExpressionInner(property, seen, options3);
17912
19169
  }
17913
19170
  function isStaticCallCallee(context, callee, seen, options3) {
17914
19171
  const unwrapped = unwrapExpression(callee);
17915
- if (unwrapped.type === AST_NODE_TYPES3.Identifier)
19172
+ if (unwrapped.type === AST_NODE_TYPES4.Identifier)
17916
19173
  return isStaticIdentifier(context, unwrapped, seen, options3);
17917
- if (unwrapped.type === AST_NODE_TYPES3.MemberExpression) {
19174
+ if (unwrapped.type === AST_NODE_TYPES4.MemberExpression) {
17918
19175
  if (!isStaticExpression(context, unwrapped.object, seen, options3))
17919
19176
  return false;
17920
19177
  if (unwrapped.computed)
17921
19178
  return isStaticMemberProperty(unwrapped.property, seen, options3);
17922
- return unwrapped.property.type === AST_NODE_TYPES3.Identifier;
19179
+ return unwrapped.property.type === AST_NODE_TYPES4.Identifier;
17923
19180
  }
17924
19181
  return false;
17925
19182
  }
17926
19183
  function isStaticObjectExpression(context, objectExpr, seen, options3) {
17927
19184
  for (const property of objectExpr.properties) {
17928
- if (property.type !== AST_NODE_TYPES3.Property)
19185
+ if (property.type !== AST_NODE_TYPES4.Property)
17929
19186
  return false;
17930
19187
  if (property.kind !== "init")
17931
19188
  return false;
17932
19189
  if (property.computed && !isStaticExpressionInner(property.key, seen, options3))
17933
19190
  return false;
17934
- const value = property.value;
19191
+ const { value } = property;
17935
19192
  if (!isNonPatternExpression(value))
17936
19193
  return false;
17937
19194
  if (!isStaticExpression(context, value, seen, options3))
@@ -17940,20 +19197,20 @@ function isStaticObjectExpression(context, objectExpr, seen, options3) {
17940
19197
  return true;
17941
19198
  }
17942
19199
  function isNonPatternExpression(value) {
17943
- return value.type !== AST_NODE_TYPES3.PrivateIdentifier && value.type !== AST_NODE_TYPES3.AssignmentPattern && value.type !== AST_NODE_TYPES3.ArrayPattern && value.type !== AST_NODE_TYPES3.ObjectPattern && value.type !== AST_NODE_TYPES3.RestElement && value.type !== AST_NODE_TYPES3.TSEmptyBodyFunctionExpression;
19200
+ return value.type !== AST_NODE_TYPES4.PrivateIdentifier && value.type !== AST_NODE_TYPES4.AssignmentPattern && value.type !== AST_NODE_TYPES4.ArrayPattern && value.type !== AST_NODE_TYPES4.ObjectPattern && value.type !== AST_NODE_TYPES4.RestElement && value.type !== AST_NODE_TYPES4.TSEmptyBodyFunctionExpression;
17944
19201
  }
17945
19202
  function isNonPrivateExpression(value) {
17946
- return value.type !== AST_NODE_TYPES3.PrivateIdentifier;
19203
+ return value.type !== AST_NODE_TYPES4.PrivateIdentifier;
17947
19204
  }
17948
19205
  function objectHasFromAndTo(objectExpr) {
17949
19206
  let hasFrom = false;
17950
19207
  let hasTo = false;
17951
19208
  for (const property of objectExpr.properties) {
17952
- if (property.type !== AST_NODE_TYPES3.Property)
19209
+ if (property.type !== AST_NODE_TYPES4.Property)
17953
19210
  continue;
17954
19211
  if (property.computed)
17955
19212
  continue;
17956
- if (property.key.type !== AST_NODE_TYPES3.Identifier)
19213
+ if (property.key.type !== AST_NODE_TYPES4.Identifier)
17957
19214
  continue;
17958
19215
  if (property.key.name === "from")
17959
19216
  hasFrom = true;
@@ -17966,10 +19223,10 @@ function objectHasFromAndTo(objectExpr) {
17966
19223
  }
17967
19224
  function hasFromAndToProperties(context, expression) {
17968
19225
  const unwrapped = unwrapExpression(expression);
17969
- if (unwrapped.type === AST_NODE_TYPES3.ObjectExpression)
19226
+ if (unwrapped.type === AST_NODE_TYPES4.ObjectExpression)
17970
19227
  return objectHasFromAndTo(unwrapped);
17971
- if (unwrapped.type === AST_NODE_TYPES3.Identifier) {
17972
- const variable = findVariable(context, unwrapped);
19228
+ if (unwrapped.type === AST_NODE_TYPES4.Identifier) {
19229
+ const variable = findVariable2(context, unwrapped);
17973
19230
  if (variable === undefined)
17974
19231
  return false;
17975
19232
  if (!isModuleLevelScope(variable.scope))
@@ -17981,7 +19238,7 @@ function hasFromAndToProperties(context, expression) {
17981
19238
  if (initializer === undefined)
17982
19239
  continue;
17983
19240
  const normalizedInitializer = unwrapExpression(initializer);
17984
- if (normalizedInitializer.type !== AST_NODE_TYPES3.ObjectExpression)
19241
+ if (normalizedInitializer.type !== AST_NODE_TYPES4.ObjectExpression)
17985
19242
  continue;
17986
19243
  if (objectHasFromAndTo(normalizedInitializer))
17987
19244
  return true;
@@ -17991,10 +19248,10 @@ function hasFromAndToProperties(context, expression) {
17991
19248
  }
17992
19249
  function isStaticObjectLikeConfig(context, expression, seen, options3) {
17993
19250
  const unwrapped = unwrapExpression(expression);
17994
- if (unwrapped.type === AST_NODE_TYPES3.ObjectExpression)
19251
+ if (unwrapped.type === AST_NODE_TYPES4.ObjectExpression)
17995
19252
  return isStaticObjectExpression(context, unwrapped, seen, options3);
17996
- if (unwrapped.type === AST_NODE_TYPES3.Identifier) {
17997
- const variable = findVariable(context, unwrapped);
19253
+ if (unwrapped.type === AST_NODE_TYPES4.Identifier) {
19254
+ const variable = findVariable2(context, unwrapped);
17998
19255
  if (variable === undefined)
17999
19256
  return false;
18000
19257
  if (!isModuleLevelScope(variable.scope))
@@ -18006,7 +19263,7 @@ function isStaticObjectLikeConfig(context, expression, seen, options3) {
18006
19263
  if (initializer === undefined)
18007
19264
  continue;
18008
19265
  const normalizedInitializer = unwrapExpression(initializer);
18009
- if (normalizedInitializer.type !== AST_NODE_TYPES3.ObjectExpression)
19266
+ if (normalizedInitializer.type !== AST_NODE_TYPES4.ObjectExpression)
18010
19267
  continue;
18011
19268
  if (isStaticObjectExpression(context, normalizedInitializer, seen, options3))
18012
19269
  return true;
@@ -18018,7 +19275,7 @@ function isStaticArrayExpression(context, arrayExpr, seen, options3) {
18018
19275
  for (const element of arrayExpr.elements) {
18019
19276
  if (!element)
18020
19277
  continue;
18021
- if (element.type === AST_NODE_TYPES3.SpreadElement)
19278
+ if (element.type === AST_NODE_TYPES4.SpreadElement)
18022
19279
  return false;
18023
19280
  if (!isStaticExpression(context, element, seen, options3))
18024
19281
  return false;
@@ -18034,520 +19291,179 @@ function isStaticExpression(context, expression, seen, options3) {
18034
19291
  return true;
18035
19292
  seen.add(unwrapped);
18036
19293
  switch (unwrapped.type) {
18037
- case AST_NODE_TYPES3.Literal:
19294
+ case AST_NODE_TYPES4.Literal:
18038
19295
  return true;
18039
- case AST_NODE_TYPES3.TemplateLiteral:
19296
+ case AST_NODE_TYPES4.TemplateLiteral:
18040
19297
  return unwrapped.expressions.length === 0;
18041
- case AST_NODE_TYPES3.UnaryExpression:
19298
+ case AST_NODE_TYPES4.UnaryExpression:
18042
19299
  return STATIC_UNARY_OPERATORS.has(unwrapped.operator) && isStaticExpression(context, unwrapped.argument, seen, options3);
18043
- case AST_NODE_TYPES3.BinaryExpression:
18044
- case AST_NODE_TYPES3.LogicalExpression:
18045
- if (!isNonPrivateExpression(unwrapped.left) || !isNonPrivateExpression(unwrapped.right))
19300
+ case AST_NODE_TYPES4.BinaryExpression:
19301
+ case AST_NODE_TYPES4.LogicalExpression:
19302
+ if (!(isNonPrivateExpression(unwrapped.left) && isNonPrivateExpression(unwrapped.right)))
18046
19303
  return false;
18047
19304
  return isStaticExpression(context, unwrapped.left, seen, options3) && isStaticExpression(context, unwrapped.right, seen, options3);
18048
- case AST_NODE_TYPES3.ConditionalExpression:
19305
+ case AST_NODE_TYPES4.ConditionalExpression:
18049
19306
  return isStaticExpression(context, unwrapped.test, seen, options3) && isStaticExpression(context, unwrapped.consequent, seen, options3) && isStaticExpression(context, unwrapped.alternate, seen, options3);
18050
- case AST_NODE_TYPES3.ArrayExpression:
19307
+ case AST_NODE_TYPES4.ArrayExpression:
18051
19308
  return context !== undefined && isStaticArrayExpression(context, unwrapped, seen, options3);
18052
- case AST_NODE_TYPES3.ObjectExpression:
19309
+ case AST_NODE_TYPES4.ObjectExpression:
18053
19310
  return context !== undefined && isStaticObjectExpression(context, unwrapped, seen, options3);
18054
- case AST_NODE_TYPES3.Identifier:
19311
+ case AST_NODE_TYPES4.Identifier:
18055
19312
  return context !== undefined && isStaticIdentifier(context, unwrapped, seen, options3);
18056
- case AST_NODE_TYPES3.MemberExpression:
19313
+ case AST_NODE_TYPES4.MemberExpression:
18057
19314
  return isStaticExpression(context, unwrapped.object, seen, options3) && (!unwrapped.computed || isStaticMemberProperty(unwrapped.property, seen, options3));
18058
- case AST_NODE_TYPES3.ChainExpression:
19315
+ case AST_NODE_TYPES4.ChainExpression:
18059
19316
  return isStaticExpression(context, unwrapped.expression, seen, options3);
18060
- case AST_NODE_TYPES3.CallExpression:
18061
- return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && unwrapped.arguments.every((arg) => arg.type !== AST_NODE_TYPES3.SpreadElement && isStaticExpression(context, arg, seen, options3));
18062
- case AST_NODE_TYPES3.NewExpression:
18063
- return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && (unwrapped.arguments ?? []).every((arg) => arg.type !== AST_NODE_TYPES3.SpreadElement && isStaticExpression(context, arg, seen, options3));
18064
- case AST_NODE_TYPES3.SequenceExpression:
19317
+ case AST_NODE_TYPES4.CallExpression:
19318
+ return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && unwrapped.arguments.every((arg) => arg.type !== AST_NODE_TYPES4.SpreadElement && isStaticExpression(context, arg, seen, options3));
19319
+ case AST_NODE_TYPES4.NewExpression:
19320
+ return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && (unwrapped.arguments ?? []).every((arg) => arg.type !== AST_NODE_TYPES4.SpreadElement && isStaticExpression(context, arg, seen, options3));
19321
+ case AST_NODE_TYPES4.SequenceExpression:
18065
19322
  return unwrapped.expressions.length > 0 && unwrapped.expressions.every((expr) => isStaticExpression(context, expr, seen, options3));
18066
- case AST_NODE_TYPES3.AssignmentExpression:
19323
+ case AST_NODE_TYPES4.AssignmentExpression:
18067
19324
  return isStaticExpression(context, unwrapped.right, seen, options3);
18068
- default:
18069
- return false;
18070
- }
18071
- }
18072
- function classifyDependencies(context, argument, seen, options3) {
18073
- if (argument === undefined)
18074
- return 0 /* MissingOrOmitted */;
18075
- if (argument.type === AST_NODE_TYPES3.SpreadElement)
18076
- return 3 /* DynamicOrUnknown */;
18077
- const expr = unwrapExpression(argument);
18078
- if (expr.type !== AST_NODE_TYPES3.ArrayExpression)
18079
- return 3 /* DynamicOrUnknown */;
18080
- if (expr.elements.length === 0)
18081
- return 1 /* EmptyArray */;
18082
- if (isStaticArrayExpression(context, expr, seen, options3))
18083
- return 2 /* StaticArray */;
18084
- return 3 /* DynamicOrUnknown */;
18085
- }
18086
- function depsAreNonUpdating(kind, options3) {
18087
- if (kind === 0 /* MissingOrOmitted */ || kind === 2 /* StaticArray */)
18088
- return true;
18089
- if (kind === 1 /* EmptyArray */)
18090
- return options3.treatEmptyDepsAsViolation;
18091
- return false;
18092
- }
18093
- function isSpringHookCall(node, options3) {
18094
- const { callee } = node;
18095
- if (callee.type === AST_NODE_TYPES3.Identifier)
18096
- return options3.springHooks.has(callee.name);
18097
- if (callee.type === AST_NODE_TYPES3.MemberExpression && !callee.computed) {
18098
- const { property } = callee;
18099
- if (property.type === AST_NODE_TYPES3.Identifier)
18100
- return options3.springHooks.has(property.name);
18101
- }
18102
- return false;
18103
- }
18104
- var noUselessUseSpring = {
18105
- create(context) {
18106
- const rawOptions = context.options[0];
18107
- const normalized = {
18108
- ...DEFAULT_OPTION_VALUES,
18109
- ...rawOptions,
18110
- springHooks: new Set(rawOptions?.springHooks ?? DEFAULT_OPTION_VALUES.springHooks),
18111
- staticGlobalFactories: new Set(rawOptions?.staticGlobalFactories ?? DEFAULT_OPTION_VALUES.staticGlobalFactories)
18112
- };
18113
- return {
18114
- CallExpression(node) {
18115
- if (!isSpringHookCall(node, normalized))
18116
- return;
18117
- if (node.arguments.length === 0)
18118
- return;
18119
- const configArgument = node.arguments[0];
18120
- if (!configArgument)
18121
- return;
18122
- if (configArgument.type === AST_NODE_TYPES3.SpreadElement)
18123
- return;
18124
- const seen = new Set;
18125
- if (!isStaticObjectLikeConfig(context, configArgument, seen, normalized))
18126
- return;
18127
- if (hasFromAndToProperties(context, configArgument))
18128
- return;
18129
- const depsKind = classifyDependencies(context, node.arguments[1], seen, normalized);
18130
- if (!depsAreNonUpdating(depsKind, normalized))
18131
- return;
18132
- context.report({
18133
- messageId: "uselessSpring",
18134
- node
18135
- });
18136
- }
18137
- };
18138
- },
18139
- defaultOptions: [DEFAULT_OPTION_VALUES],
18140
- meta: {
18141
- docs: {
18142
- description: "Disallow useSpring hooks whose config and dependencies are entirely static"
18143
- },
18144
- messages: {
18145
- uselessSpring: "useSpring call has only static inputs and non-updating dependencies; replace it with a constant or remove the hook."
18146
- },
18147
- schema: [
18148
- {
18149
- additionalProperties: false,
18150
- properties: {
18151
- springHooks: {
18152
- description: "Hook identifiers that should be treated as spring hooks",
18153
- items: { type: "string" },
18154
- type: "array"
18155
- },
18156
- staticGlobalFactories: {
18157
- default: [...DEFAULT_STATIC_GLOBAL_FACTORIES],
18158
- description: "Global factory identifiers that are treated as static constructors",
18159
- items: { type: "string" },
18160
- type: "array"
18161
- },
18162
- treatEmptyDepsAsViolation: {
18163
- default: true,
18164
- description: "Treat static config with an empty dependency array as a violation",
18165
- type: "boolean"
18166
- }
18167
- },
18168
- type: "object"
18169
- }
18170
- ],
18171
- type: "suggestion"
18172
- }
18173
- };
18174
- var no_useless_use_spring_default = noUselessUseSpring;
18175
-
18176
- // src/rules/no-warn.ts
18177
- var noWarn = {
18178
- create(context) {
18179
- return {
18180
- 'CallExpression[callee.type="Identifier"][callee.name="warn"]'(node) {
18181
- context.report({
18182
- messageId: "useLog",
18183
- node
18184
- });
18185
- }
18186
- };
18187
- },
18188
- meta: {
18189
- docs: {
18190
- description: "Ban warn() function calls. Use Log instead.",
18191
- recommended: false
18192
- },
18193
- messages: {
18194
- useLog: "Use Log instead of warn()"
18195
- },
18196
- schema: [],
18197
- type: "problem"
18198
- }
18199
- };
18200
- var no_warn_default = noWarn;
18201
-
18202
- // src/rules/no-god-components.ts
18203
- import { TSESTree as TSESTree6 } from "@typescript-eslint/types";
18204
- var COMPONENT_NAME_PATTERN = /^[A-Z]/;
18205
- var FUNCTION_BOUNDARIES = new Set([
18206
- TSESTree6.AST_NODE_TYPES.FunctionDeclaration,
18207
- TSESTree6.AST_NODE_TYPES.FunctionExpression,
18208
- TSESTree6.AST_NODE_TYPES.ArrowFunctionExpression
18209
- ]);
18210
- var RUNTIME_TS_WRAPPERS = new Set([
18211
- "ParenthesizedExpression",
18212
- "TSAsExpression",
18213
- "TSSatisfiesExpression",
18214
- "TSTypeAssertion",
18215
- "TSNonNullExpression",
18216
- "TSInstantiationExpression",
18217
- "ChainExpression"
18218
- ]);
18219
- function isComponentName(name) {
18220
- return COMPONENT_NAME_PATTERN.test(name);
18221
- }
18222
- function isReactComponentHOC(callExpr) {
18223
- const { callee } = callExpr;
18224
- if (callee.type === TSESTree6.AST_NODE_TYPES.Identifier)
18225
- return callee.name === "forwardRef" || callee.name === "memo";
18226
- if (callee.type === TSESTree6.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree6.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === TSESTree6.AST_NODE_TYPES.Identifier)
18227
- return callee.property.name === "forwardRef" || callee.property.name === "memo";
18228
- return false;
18229
- }
18230
- function getComponentNameFromFunction(node) {
18231
- if (node.type === TSESTree6.AST_NODE_TYPES.FunctionDeclaration && node.id && isComponentName(node.id.name))
18232
- return node.id.name;
18233
- if (node.type === TSESTree6.AST_NODE_TYPES.FunctionExpression || node.type === TSESTree6.AST_NODE_TYPES.ArrowFunctionExpression) {
18234
- const { parent } = node;
18235
- if (parent === null || parent === undefined)
18236
- return;
18237
- if (parent.type === TSESTree6.AST_NODE_TYPES.VariableDeclarator && parent.id.type === TSESTree6.AST_NODE_TYPES.Identifier && isComponentName(parent.id.name))
18238
- return parent.id.name;
18239
- if (parent.type === TSESTree6.AST_NODE_TYPES.Property && parent.key.type === TSESTree6.AST_NODE_TYPES.Identifier && isComponentName(parent.key.name))
18240
- return parent.key.name;
18241
- if (parent.type === TSESTree6.AST_NODE_TYPES.MethodDefinition && parent.key.type === TSESTree6.AST_NODE_TYPES.Identifier && isComponentName(parent.key.name))
18242
- return parent.key.name;
18243
- }
18244
- return;
18245
- }
18246
- function getComponentNameFromCallParent(callExpr) {
18247
- const { parent } = callExpr;
18248
- if (parent === null || parent === undefined)
18249
- return;
18250
- if (parent.type === TSESTree6.AST_NODE_TYPES.VariableDeclarator && parent.id.type === TSESTree6.AST_NODE_TYPES.Identifier && isComponentName(parent.id.name))
18251
- return parent.id.name;
18252
- if (parent.type === TSESTree6.AST_NODE_TYPES.AssignmentExpression && parent.left.type === TSESTree6.AST_NODE_TYPES.Identifier && isComponentName(parent.left.name))
18253
- return parent.left.name;
18254
- if (parent.type === TSESTree6.AST_NODE_TYPES.ExportDefaultDeclaration && callExpr.arguments.length > 0) {
18255
- const firstArg = callExpr.arguments[0];
18256
- if (firstArg && firstArg.type === TSESTree6.AST_NODE_TYPES.FunctionExpression && firstArg.id && isComponentName(firstArg.id.name))
18257
- return firstArg.id.name;
18258
- }
18259
- return;
18260
- }
18261
- function getHookName(callExpression) {
18262
- const { callee } = callExpression;
18263
- if (callee.type === TSESTree6.AST_NODE_TYPES.Identifier)
18264
- return callee.name;
18265
- if (callee.type === TSESTree6.AST_NODE_TYPES.MemberExpression && callee.property.type === TSESTree6.AST_NODE_TYPES.Identifier)
18266
- return callee.property.name;
18267
- return;
18268
- }
18269
- function countDestructuredProps(node) {
18270
- const firstParam = node.params[0];
18271
- if (!firstParam)
18272
- return;
18273
- let pattern4;
18274
- if (firstParam.type === TSESTree6.AST_NODE_TYPES.ObjectPattern)
18275
- pattern4 = firstParam;
18276
- if (firstParam.type === TSESTree6.AST_NODE_TYPES.AssignmentPattern && firstParam.left.type === TSESTree6.AST_NODE_TYPES.ObjectPattern)
18277
- pattern4 = firstParam.left;
18278
- if (!pattern4)
18279
- return;
18280
- let count = 0;
18281
- for (const prop of pattern4.properties) {
18282
- if (prop.type === TSESTree6.AST_NODE_TYPES.Property)
18283
- count += 1;
18284
- }
18285
- return count;
18286
- }
18287
- function isTypeOnlyNullLiteral(node) {
18288
- const parent = node.parent;
18289
- if (parent === null || parent === undefined)
18290
- return false;
18291
- if (typeof parent.type === "string" && parent.type.startsWith("TS") && !RUNTIME_TS_WRAPPERS.has(parent.type))
18292
- return true;
18293
- if (parent.type === TSESTree6.AST_NODE_TYPES.TSLiteralType)
18294
- return true;
18295
- return false;
18296
- }
18297
- function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
18298
- let maxJsxDepth = 0;
18299
- let stateHookCount = 0;
18300
- const nullLiterals = new Array;
18301
- function visit(current, jsxDepth) {
18302
- if (FUNCTION_BOUNDARIES.has(current.type) && current !== functionNode)
18303
- return;
18304
- let nextDepth = jsxDepth;
18305
- if (current.type === TSESTree6.AST_NODE_TYPES.JSXElement || current.type === TSESTree6.AST_NODE_TYPES.JSXFragment) {
18306
- nextDepth = jsxDepth + 1;
18307
- if (nextDepth > maxJsxDepth)
18308
- maxJsxDepth = nextDepth;
18309
- }
18310
- if (current.type === TSESTree6.AST_NODE_TYPES.CallExpression) {
18311
- const hookName = getHookName(current);
18312
- if (typeof hookName === "string" && hookName.length > 0 && stateHooks.has(hookName))
18313
- stateHookCount += 1;
18314
- }
18315
- if (current.type === TSESTree6.AST_NODE_TYPES.Literal && current.value === null) {
18316
- const literalNode = current;
18317
- if (!isTypeOnlyNullLiteral(literalNode))
18318
- nullLiterals.push(literalNode);
18319
- }
18320
- function getVisitorKeysForNodeType(nodeType) {
18321
- const visitorKeysUnknown = sourceCode.visitorKeys;
18322
- if (visitorKeysUnknown === null || visitorKeysUnknown === undefined || typeof visitorKeysUnknown !== "object")
18323
- return [];
18324
- const visitorKeysRecord = visitorKeysUnknown;
18325
- const keysUnknown = visitorKeysRecord[nodeType];
18326
- if (!Array.isArray(keysUnknown))
18327
- return [];
18328
- const keys3 = new Array;
18329
- for (const key of keysUnknown)
18330
- if (typeof key === "string")
18331
- keys3.push(key);
18332
- return keys3;
18333
- }
18334
- const keys2 = getVisitorKeysForNodeType(current.type);
18335
- const currentRecord = current;
18336
- for (const key of keys2) {
18337
- const value = currentRecord[key];
18338
- if (Array.isArray(value)) {
18339
- for (const item of value) {
18340
- if (typeof item === "object" && item !== null && "type" in item) {
18341
- visit(item, nextDepth);
18342
- }
18343
- }
18344
- continue;
18345
- }
18346
- if (typeof value === "object" && value !== null && "type" in value) {
18347
- visit(value, nextDepth);
18348
- }
18349
- }
19325
+ default:
19326
+ return false;
18350
19327
  }
18351
- visit(functionNode.body, 0);
18352
- return { maxJsxDepth, nullLiterals, stateHookCount };
18353
19328
  }
18354
- function parseOptions(options3) {
18355
- const defaults = {
18356
- enforceTargetLines: true,
18357
- ignoreComponents: [],
18358
- maxDestructuredProps: 5,
18359
- maxLines: 200,
18360
- maxStateHooks: 5,
18361
- maxTsxNesting: 3,
18362
- stateHooks: ["useState", "useReducer", "useBinding"],
18363
- targetLines: 120
18364
- };
18365
- if (typeof options3 !== "object" || options3 === null)
18366
- return defaults;
18367
- const cast = options3;
18368
- return {
18369
- enforceTargetLines: typeof cast.enforceTargetLines === "boolean" ? cast.enforceTargetLines : defaults.enforceTargetLines,
18370
- ignoreComponents: Array.isArray(cast.ignoreComponents) ? cast.ignoreComponents : defaults.ignoreComponents,
18371
- maxDestructuredProps: typeof cast.maxDestructuredProps === "number" ? cast.maxDestructuredProps : defaults.maxDestructuredProps,
18372
- maxLines: typeof cast.maxLines === "number" ? cast.maxLines : defaults.maxLines,
18373
- maxStateHooks: typeof cast.maxStateHooks === "number" ? cast.maxStateHooks : defaults.maxStateHooks,
18374
- maxTsxNesting: typeof cast.maxTsxNesting === "number" ? cast.maxTsxNesting : defaults.maxTsxNesting,
18375
- stateHooks: Array.isArray(cast.stateHooks) ? cast.stateHooks : defaults.stateHooks,
18376
- targetLines: typeof cast.targetLines === "number" ? cast.targetLines : defaults.targetLines
18377
- };
19329
+ function classifyDependencies(context, argument, seen, options3) {
19330
+ if (argument === undefined)
19331
+ return 0 /* MissingOrOmitted */;
19332
+ if (argument.type === AST_NODE_TYPES4.SpreadElement)
19333
+ return 3 /* DynamicOrUnknown */;
19334
+ const expr = unwrapExpression(argument);
19335
+ if (expr.type !== AST_NODE_TYPES4.ArrayExpression)
19336
+ return 3 /* DynamicOrUnknown */;
19337
+ if (expr.elements.length === 0)
19338
+ return 1 /* EmptyArray */;
19339
+ if (isStaticArrayExpression(context, expr, seen, options3))
19340
+ return 2 /* StaticArray */;
19341
+ return 3 /* DynamicOrUnknown */;
18378
19342
  }
18379
- var noGodComponents = {
19343
+ function depsAreNonUpdating(kind, options3) {
19344
+ if (kind === 0 /* MissingOrOmitted */ || kind === 2 /* StaticArray */)
19345
+ return true;
19346
+ if (kind === 1 /* EmptyArray */)
19347
+ return options3.treatEmptyDepsAsViolation;
19348
+ return false;
19349
+ }
19350
+ function isSpringHookCall(node, options3) {
19351
+ const { callee } = node;
19352
+ if (callee.type === AST_NODE_TYPES4.Identifier)
19353
+ return options3.springHooks.has(callee.name);
19354
+ if (callee.type === AST_NODE_TYPES4.MemberExpression && !callee.computed) {
19355
+ const { property } = callee;
19356
+ if (property.type === AST_NODE_TYPES4.Identifier)
19357
+ return options3.springHooks.has(property.name);
19358
+ }
19359
+ return false;
19360
+ }
19361
+ var noUselessUseSpring = {
18380
19362
  create(context) {
18381
- const configuration = parseOptions(context.options[0]);
18382
- const ignoreSet = new Set(configuration.ignoreComponents);
18383
- const stateHooks = new Set(configuration.stateHooks);
18384
- const checked = new WeakSet;
18385
- const sourceCode = context.sourceCode;
18386
- function checkComponent(node, name) {
18387
- if (ignoreSet.has(name))
18388
- return;
18389
- if (checked.has(node))
18390
- return;
18391
- checked.add(node);
18392
- const location = node.loc;
18393
- if (location !== null && location !== undefined) {
18394
- const lines = location.end.line - location.start.line + 1;
18395
- if (lines > configuration.maxLines) {
18396
- context.report({
18397
- data: { lines, max: configuration.maxLines, name, target: configuration.targetLines },
18398
- messageId: "exceedsMaxLines",
18399
- node
18400
- });
18401
- } else if (configuration.enforceTargetLines && lines > configuration.targetLines) {
18402
- context.report({
18403
- data: { lines, max: configuration.maxLines, name, target: configuration.targetLines },
18404
- messageId: "exceedsTargetLines",
18405
- node
18406
- });
18407
- }
18408
- }
18409
- const propsCount = countDestructuredProps(node);
18410
- if (typeof propsCount === "number" && propsCount > configuration.maxDestructuredProps) {
18411
- context.report({
18412
- data: { count: propsCount, max: configuration.maxDestructuredProps, name },
18413
- messageId: "tooManyProps",
18414
- node
18415
- });
18416
- }
18417
- const analysis = analyzeComponentBody(node, sourceCode, stateHooks);
18418
- if (analysis.maxJsxDepth > configuration.maxTsxNesting) {
18419
- context.report({
18420
- data: { depth: analysis.maxJsxDepth, max: configuration.maxTsxNesting, name },
18421
- messageId: "tsxNestingTooDeep",
18422
- node
18423
- });
18424
- }
18425
- if (analysis.stateHookCount > configuration.maxStateHooks) {
18426
- context.report({
18427
- data: {
18428
- count: analysis.stateHookCount,
18429
- hooks: configuration.stateHooks.join(", "),
18430
- max: configuration.maxStateHooks,
18431
- name
18432
- },
18433
- messageId: "tooManyStateHooks",
18434
- node
18435
- });
18436
- }
18437
- for (const literal2 of analysis.nullLiterals) {
18438
- context.report({
18439
- messageId: "nullLiteral",
18440
- node: literal2
18441
- });
18442
- }
18443
- }
18444
- function maybeCheckFunction(node) {
18445
- const name = getComponentNameFromFunction(node);
18446
- if (typeof name !== "string" || name.length === 0)
18447
- return;
18448
- checkComponent(node, name);
18449
- }
19363
+ const [rawOptions] = context.options;
19364
+ const normalized = {
19365
+ ...DEFAULT_OPTION_VALUES,
19366
+ ...rawOptions,
19367
+ springHooks: new Set(rawOptions?.springHooks ?? DEFAULT_OPTION_VALUES.springHooks),
19368
+ staticGlobalFactories: new Set(rawOptions?.staticGlobalFactories ?? DEFAULT_OPTION_VALUES.staticGlobalFactories)
19369
+ };
18450
19370
  return {
18451
- FunctionDeclaration(node) {
18452
- maybeCheckFunction(node);
18453
- },
18454
- FunctionExpression(node) {
18455
- maybeCheckFunction(node);
18456
- },
18457
- ArrowFunctionExpression(node) {
18458
- maybeCheckFunction(node);
18459
- },
18460
19371
  CallExpression(node) {
18461
- const callExpr = node;
18462
- if (!isReactComponentHOC(callExpr))
19372
+ if (!isSpringHookCall(node, normalized))
18463
19373
  return;
18464
- const firstArg = callExpr.arguments[0];
18465
- if (!firstArg || firstArg.type !== TSESTree6.AST_NODE_TYPES.FunctionExpression && firstArg.type !== TSESTree6.AST_NODE_TYPES.ArrowFunctionExpression)
19374
+ if (node.arguments.length === 0)
18466
19375
  return;
18467
- const nameFromParent = getComponentNameFromCallParent(callExpr);
18468
- const nameFromArg = getComponentNameFromFunction(firstArg);
18469
- const name = nameFromParent ?? nameFromArg;
18470
- if (typeof name !== "string" || name.length === 0)
19376
+ const [configArgument] = node.arguments;
19377
+ if (!configArgument)
18471
19378
  return;
18472
- checkComponent(firstArg, name);
19379
+ if (configArgument.type === AST_NODE_TYPES4.SpreadElement)
19380
+ return;
19381
+ const seen = new Set;
19382
+ if (!isStaticObjectLikeConfig(context, configArgument, seen, normalized))
19383
+ return;
19384
+ if (hasFromAndToProperties(context, configArgument))
19385
+ return;
19386
+ const depsKind = classifyDependencies(context, node.arguments[1], seen, normalized);
19387
+ if (!depsAreNonUpdating(depsKind, normalized))
19388
+ return;
19389
+ context.report({
19390
+ messageId: "uselessSpring",
19391
+ node
19392
+ });
18473
19393
  }
18474
19394
  };
18475
19395
  },
19396
+ defaultOptions: [DEFAULT_OPTION_VALUES],
18476
19397
  meta: {
18477
19398
  docs: {
18478
- description: "Enforce React component size and complexity limits inspired by the 'Refactor God Component' checklist.",
18479
- recommended: false
19399
+ description: "Disallow useSpring hooks whose config and dependencies are entirely static"
18480
19400
  },
18481
19401
  messages: {
18482
- exceedsTargetLines: "Component '{{name}}' is {{lines}} lines; target is {{target}} (max {{max}}). Consider extracting hooks/components.",
18483
- exceedsMaxLines: "Component '{{name}}' is {{lines}} lines; max allowed is {{max}}. Split into smaller components/hooks.",
18484
- tsxNestingTooDeep: "Component '{{name}}' has TSX nesting depth {{depth}}; max allowed is {{max}}. Extract child components.",
18485
- tooManyStateHooks: "Component '{{name}}' has {{count}} state hooks ({{hooks}}); max allowed is {{max}}. Extract cohesive state into a custom hook.",
18486
- tooManyProps: "Component '{{name}}' destructures {{count}} props; max allowed is {{max}}. Group props or split the component.",
18487
- nullLiteral: "Avoid `null` in components; use `undefined` instead."
19402
+ uselessSpring: "useSpring call has only static inputs and non-updating dependencies; replace it with a constant or remove the hook."
18488
19403
  },
18489
19404
  schema: [
18490
19405
  {
18491
19406
  additionalProperties: false,
18492
19407
  properties: {
18493
- enforceTargetLines: {
18494
- default: true,
18495
- description: "Whether to report when exceeding targetLines (soft limit).",
18496
- type: "boolean"
18497
- },
18498
- ignoreComponents: {
18499
- description: "Component names to ignore.",
19408
+ springHooks: {
19409
+ description: "Hook identifiers that should be treated as spring hooks",
18500
19410
  items: { type: "string" },
18501
19411
  type: "array"
18502
19412
  },
18503
- maxDestructuredProps: {
18504
- default: 5,
18505
- description: "Maximum number of destructured props in a component parameter.",
18506
- type: "number"
18507
- },
18508
- maxLines: {
18509
- default: 200,
18510
- description: "Hard maximum lines for a component.",
18511
- type: "number"
18512
- },
18513
- maxStateHooks: {
18514
- default: 5,
18515
- description: "Maximum number of stateful hook calls in a component.",
18516
- type: "number"
18517
- },
18518
- maxTsxNesting: {
18519
- default: 3,
18520
- description: "Maximum JSX/TSX nesting depth in a component.",
18521
- type: "number"
18522
- },
18523
- stateHooks: {
18524
- default: ["useState", "useReducer", "useBinding"],
18525
- description: "Hook names to count toward state complexity.",
19413
+ staticGlobalFactories: {
19414
+ default: [...DEFAULT_STATIC_GLOBAL_FACTORIES],
19415
+ description: "Global factory identifiers that are treated as static constructors",
18526
19416
  items: { type: "string" },
18527
19417
  type: "array"
18528
19418
  },
18529
- targetLines: {
18530
- default: 120,
18531
- description: "Soft target lines for a component.",
18532
- type: "number"
19419
+ treatEmptyDepsAsViolation: {
19420
+ default: true,
19421
+ description: "Treat static config with an empty dependency array as a violation",
19422
+ type: "boolean"
18533
19423
  }
18534
19424
  },
18535
19425
  type: "object"
18536
19426
  }
18537
19427
  ],
19428
+ type: "suggestion"
19429
+ }
19430
+ };
19431
+ var no_useless_use_spring_default = noUselessUseSpring;
19432
+
19433
+ // src/rules/no-warn.ts
19434
+ var noWarn = {
19435
+ create(context) {
19436
+ return {
19437
+ 'CallExpression[callee.type="Identifier"][callee.name="warn"]'(node) {
19438
+ context.report({
19439
+ messageId: "useLog",
19440
+ node
19441
+ });
19442
+ }
19443
+ };
19444
+ },
19445
+ meta: {
19446
+ docs: {
19447
+ description: "Ban warn() function calls. Use Log instead.",
19448
+ recommended: false
19449
+ },
19450
+ messages: {
19451
+ useLog: "Use Log instead of warn()"
19452
+ },
19453
+ schema: [],
18538
19454
  type: "problem"
18539
19455
  }
18540
19456
  };
18541
- var no_god_components_default = noGodComponents;
19457
+ var no_warn_default = noWarn;
18542
19458
 
18543
19459
  // src/rules/prefer-sequence-overloads.ts
18544
- import { AST_NODE_TYPES as AST_NODE_TYPES4 } from "@typescript-eslint/types";
19460
+ import { AST_NODE_TYPES as AST_NODE_TYPES5 } from "@typescript-eslint/types";
18545
19461
  var sequenceDescriptors = [
18546
19462
  { keypointName: "ColorSequenceKeypoint", sequenceName: "ColorSequence" },
18547
19463
  { keypointName: "NumberSequenceKeypoint", sequenceName: "NumberSequence" }
18548
19464
  ];
18549
19465
  function isSequenceIdentifier(node) {
18550
- if (node.type !== AST_NODE_TYPES4.Identifier)
19466
+ if (node.type !== AST_NODE_TYPES5.Identifier)
18551
19467
  return false;
18552
19468
  for (const { sequenceName } of sequenceDescriptors)
18553
19469
  if (sequenceName === node.name)
@@ -18561,16 +19477,16 @@ function findDescriptor(sequenceName) {
18561
19477
  return;
18562
19478
  }
18563
19479
  var isNumericLiteral = Compile(build_default.Object({
18564
- type: build_default.Literal(AST_NODE_TYPES4.Literal),
19480
+ type: build_default.Literal(AST_NODE_TYPES5.Literal),
18565
19481
  value: build_default.Number()
18566
19482
  }));
18567
19483
  function isExpressionArgument(argument) {
18568
- return argument !== undefined && argument.type !== AST_NODE_TYPES4.SpreadElement;
19484
+ return argument !== undefined && argument.type !== AST_NODE_TYPES5.SpreadElement;
18569
19485
  }
18570
19486
  function extractKeypoint(element, descriptor) {
18571
- if (element === undefined || element.type !== AST_NODE_TYPES4.NewExpression)
19487
+ if (element === undefined || element.type !== AST_NODE_TYPES5.NewExpression)
18572
19488
  return;
18573
- if (element.callee.type !== AST_NODE_TYPES4.Identifier || element.callee.name !== descriptor.keypointName)
19489
+ if (element.callee.type !== AST_NODE_TYPES5.Identifier || element.callee.name !== descriptor.keypointName)
18574
19490
  return;
18575
19491
  if (element.arguments.length !== 2)
18576
19492
  return;
@@ -18600,7 +19516,7 @@ var preferSequenceOverloads = {
18600
19516
  if (descriptor === undefined || node.arguments.length !== 1)
18601
19517
  return;
18602
19518
  const [argument] = node.arguments;
18603
- if (argument === undefined || argument.type !== AST_NODE_TYPES4.ArrayExpression || argument.elements.length !== 2)
19519
+ if (argument === undefined || argument.type !== AST_NODE_TYPES5.ArrayExpression || argument.elements.length !== 2)
18604
19520
  return;
18605
19521
  const firstElement = argument.elements[0] ?? undefined;
18606
19522
  const secondElement = argument.elements[1] ?? undefined;
@@ -18683,7 +19599,7 @@ function reconstructText(node) {
18683
19599
  if (typeof operator !== "string" || !OPERATORS2.has(operator))
18684
19600
  return;
18685
19601
  const { left, right } = node;
18686
- if (!isRecord3(left) || !isRecord3(right))
19602
+ if (!(isRecord3(left) && isRecord3(right)))
18687
19603
  return;
18688
19604
  const leftText = reconstructText(left);
18689
19605
  const rightText = reconstructText(right);
@@ -18744,7 +19660,7 @@ function collectArguments(_context2, parameters3) {
18744
19660
  const texts = [undefined, undefined, undefined, undefined];
18745
19661
  for (let index2 = 0;index2 < 4; index2++) {
18746
19662
  const parameter2 = parameters3[index2];
18747
- if (!isRecord3(parameter2) || !hasTypeProperty(parameter2))
19663
+ if (!(isRecord3(parameter2) && hasTypeProperty(parameter2)))
18748
19664
  return;
18749
19665
  if (parameter2.type === TSESTree7.AST_NODE_TYPES.SpreadElement)
18750
19666
  return;
@@ -18842,12 +19758,14 @@ function parseOptions2(options3) {
18842
19758
  hooks: options3.hooks
18843
19759
  };
18844
19760
  }
18845
- function getHookName2(callExpression) {
19761
+ function getHookName3(callExpression) {
18846
19762
  const { callee } = callExpression;
18847
- if (callee.type === TSESTree8.AST_NODE_TYPES.Identifier && typeof callee.name === "string" && callee.name.length > 0)
19763
+ if (callee.type === TSESTree8.AST_NODE_TYPES.Identifier && typeof callee.name === "string" && callee.name.length > 0) {
18848
19764
  return callee.name;
18849
- if (callee.type === TSESTree8.AST_NODE_TYPES.MemberExpression && callee.property?.type === TSESTree8.AST_NODE_TYPES.Identifier && typeof callee.property.name === "string" && callee.property.name.length > 0)
19765
+ }
19766
+ if (callee.type === TSESTree8.AST_NODE_TYPES.MemberExpression && callee.property?.type === TSESTree8.AST_NODE_TYPES.Identifier && typeof callee.property.name === "string" && callee.property.name.length > 0) {
18850
19767
  return callee.property.name;
19768
+ }
18851
19769
  return;
18852
19770
  }
18853
19771
  function resolveIdentifierToFunction(identifier3, context) {
@@ -18877,7 +19795,7 @@ function resolveIdentifierToFunction(identifier3, context) {
18877
19795
  if (typeof definition !== "object" || definition === null)
18878
19796
  continue;
18879
19797
  const castDefinition = definition;
18880
- const node = castDefinition.node;
19798
+ const { node } = castDefinition;
18881
19799
  if (typeof node !== "object" || node === null)
18882
19800
  continue;
18883
19801
  const castNode = node;
@@ -18940,7 +19858,7 @@ function isCallbackHookResult(identifier3, context) {
18940
19858
  if (typeof definition !== "object" || definition === null)
18941
19859
  continue;
18942
19860
  const castDefinition = definition;
18943
- const node = castDefinition.node;
19861
+ const { node } = castDefinition;
18944
19862
  if (typeof node !== "object" || node === null)
18945
19863
  continue;
18946
19864
  const castNode = node;
@@ -18951,7 +19869,7 @@ function isCallbackHookResult(identifier3, context) {
18951
19869
  const init = castNode.init;
18952
19870
  if (init.type !== TSESTree8.AST_NODE_TYPES.CallExpression)
18953
19871
  continue;
18954
- const calleeHookName = getHookName2(init);
19872
+ const calleeHookName = getHookName3(init);
18955
19873
  if (calleeHookName === "useCallback" || calleeHookName === "useMemo")
18956
19874
  return true;
18957
19875
  }
@@ -18973,7 +19891,7 @@ var requireNamedEffectFunctions = {
18973
19891
  return {
18974
19892
  CallExpression(node) {
18975
19893
  const callExpression = node;
18976
- const hookName = getHookName2(callExpression);
19894
+ const hookName = getHookName3(callExpression);
18977
19895
  if (typeof hookName !== "string" || !effectHooks.has(hookName))
18978
19896
  return;
18979
19897
  const firstArgument = callExpression.arguments?.[0];
@@ -19139,7 +20057,7 @@ var requireNamedEffectFunctions = {
19139
20057
  var require_named_effect_functions_default = requireNamedEffectFunctions;
19140
20058
 
19141
20059
  // src/rules/require-paired-calls.ts
19142
- import { AST_NODE_TYPES as AST_NODE_TYPES5 } from "@typescript-eslint/types";
20060
+ import { AST_NODE_TYPES as AST_NODE_TYPES6 } from "@typescript-eslint/types";
19143
20061
  var isStringArray = Compile(build_default.Readonly(build_default.Array(build_default.String())));
19144
20062
  var isPairConfiguration = Compile(build_default.Readonly(build_default.Object({
19145
20063
  alternatives: build_default.Optional(isStringArray),
@@ -19157,20 +20075,20 @@ var isRuleOptions3 = Compile(build_default.Partial(build_default.Readonly(build_
19157
20075
  pairs: build_default.Readonly(build_default.Array(isPairConfiguration))
19158
20076
  }))));
19159
20077
  var LOOP_NODE_TYPES = new Set([
19160
- AST_NODE_TYPES5.DoWhileStatement,
19161
- AST_NODE_TYPES5.ForInStatement,
19162
- AST_NODE_TYPES5.ForOfStatement,
19163
- AST_NODE_TYPES5.ForStatement,
19164
- AST_NODE_TYPES5.WhileStatement
20078
+ AST_NODE_TYPES6.DoWhileStatement,
20079
+ AST_NODE_TYPES6.ForInStatement,
20080
+ AST_NODE_TYPES6.ForOfStatement,
20081
+ AST_NODE_TYPES6.ForStatement,
20082
+ AST_NODE_TYPES6.WhileStatement
19165
20083
  ]);
19166
20084
  var DEFAULT_ROBLOX_YIELDING_FUNCTIONS = ["task.wait", "wait", "*.WaitForChild", "*.*Async"];
19167
20085
  function getCallName(node) {
19168
20086
  const { callee } = node;
19169
- if (callee.type === AST_NODE_TYPES5.Identifier)
20087
+ if (callee.type === AST_NODE_TYPES6.Identifier)
19170
20088
  return callee.name;
19171
- if (callee.type === AST_NODE_TYPES5.MemberExpression) {
19172
- const object3 = callee.object.type === AST_NODE_TYPES5.Identifier ? callee.object.name : undefined;
19173
- const property = callee.property.type === AST_NODE_TYPES5.Identifier ? callee.property.name : undefined;
20089
+ if (callee.type === AST_NODE_TYPES6.MemberExpression) {
20090
+ const object3 = callee.object.type === AST_NODE_TYPES6.Identifier ? callee.object.name : undefined;
20091
+ const property = callee.property.type === AST_NODE_TYPES6.Identifier ? callee.property.name : undefined;
19174
20092
  if (object3 !== undefined && property !== undefined)
19175
20093
  return `${object3}.${property}`;
19176
20094
  }
@@ -19206,12 +20124,12 @@ function isLoopLikeStatement(node) {
19206
20124
  return LOOP_NODE_TYPES.has(node.type);
19207
20125
  }
19208
20126
  function isSwitchStatement(node) {
19209
- return node?.type === AST_NODE_TYPES5.SwitchStatement;
20127
+ return node?.type === AST_NODE_TYPES6.SwitchStatement;
19210
20128
  }
19211
20129
  function findLabeledStatementBody(label, startingNode) {
19212
20130
  let current = startingNode;
19213
20131
  while (current) {
19214
- if (current.type === AST_NODE_TYPES5.LabeledStatement && current.label.name === label.name)
20132
+ if (current.type === AST_NODE_TYPES6.LabeledStatement && current.label.name === label.name)
19215
20133
  return current.body;
19216
20134
  current = current.parent ?? undefined;
19217
20135
  }
@@ -19248,7 +20166,7 @@ function cloneEntry(value) {
19248
20166
  }
19249
20167
  var rule = {
19250
20168
  create(context) {
19251
- const rawOptions = context.options[0];
20169
+ const [rawOptions] = context.options;
19252
20170
  const baseOptions = isRuleOptions3.Check(rawOptions) ? rawOptions : {};
19253
20171
  const options3 = {
19254
20172
  allowConditionalClosers: baseOptions.allowConditionalClosers ?? false,
@@ -19414,7 +20332,7 @@ var rule = {
19414
20332
  const hasCompleteElse = ifNode.alternate !== undefined && ifNode.alternate !== null;
19415
20333
  for (const branchStack of branches) {
19416
20334
  for (const entry of branchStack) {
19417
- const wasInOriginal = originalStack.some((o) => o.index === entry.index);
20335
+ const wasInOriginal = originalStack.some(({ index: index2 }) => index2 === entry.index);
19418
20336
  if (!wasInOriginal) {
19419
20337
  const validClosers = getValidClosers(entry.config);
19420
20338
  const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
@@ -19463,8 +20381,8 @@ var rule = {
19463
20381
  }
19464
20382
  function onIfConsequentExit(node) {
19465
20383
  const consequentNode = node;
19466
- const parent = consequentNode.parent;
19467
- if (parent?.type === AST_NODE_TYPES5.IfStatement) {
20384
+ const { parent } = consequentNode;
20385
+ if (parent?.type === AST_NODE_TYPES6.IfStatement) {
19468
20386
  const branches = branchStacks.get(parent) ?? [];
19469
20387
  branches.push(cloneStack());
19470
20388
  branchStacks.set(parent, branches);
@@ -19478,8 +20396,8 @@ var rule = {
19478
20396
  }
19479
20397
  function onIfAlternateExit(node) {
19480
20398
  const alternateNode = node;
19481
- const parent = alternateNode.parent;
19482
- if (parent?.type === AST_NODE_TYPES5.IfStatement) {
20399
+ const { parent } = alternateNode;
20400
+ if (parent?.type === AST_NODE_TYPES6.IfStatement) {
19483
20401
  const branches = branchStacks.get(parent) ?? [];
19484
20402
  branches.push(cloneStack());
19485
20403
  branchStacks.set(parent, branches);
@@ -19528,7 +20446,7 @@ var rule = {
19528
20446
  function onTryBlockExit(node) {
19529
20447
  const blockNode = node;
19530
20448
  const { parent } = blockNode;
19531
- if (parent?.type === AST_NODE_TYPES5.TryStatement) {
20449
+ if (parent?.type === AST_NODE_TYPES6.TryStatement) {
19532
20450
  const branches = branchStacks.get(parent) ?? [];
19533
20451
  branches.push(cloneStack());
19534
20452
  branchStacks.set(parent, branches);
@@ -19547,7 +20465,7 @@ var rule = {
19547
20465
  function onCatchClauseExit(node) {
19548
20466
  const catchNode = node;
19549
20467
  const { parent } = catchNode;
19550
- if (parent?.type === AST_NODE_TYPES5.TryStatement) {
20468
+ if (parent?.type === AST_NODE_TYPES6.TryStatement) {
19551
20469
  const branches = branchStacks.get(parent) ?? [];
19552
20470
  branches.push(cloneStack());
19553
20471
  branchStacks.set(parent, branches);
@@ -19610,7 +20528,7 @@ var rule = {
19610
20528
  function onSwitchCaseExit(node) {
19611
20529
  const caseNode = node;
19612
20530
  const { parent } = caseNode;
19613
- if (parent?.type === AST_NODE_TYPES5.SwitchStatement) {
20531
+ if (parent?.type === AST_NODE_TYPES6.SwitchStatement) {
19614
20532
  const branches = branchStacks.get(parent) ?? [];
19615
20533
  branches.push(cloneStack());
19616
20534
  branchStacks.set(parent, branches);
@@ -19641,7 +20559,7 @@ var rule = {
19641
20559
  for (const { opener, config, node: node2 } of openerStack) {
19642
20560
  const validClosers = getValidClosers(config);
19643
20561
  const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
19644
- const statementType = statementNode.type === AST_NODE_TYPES5.ReturnStatement ? "return" : "throw";
20562
+ const statementType = statementNode.type === AST_NODE_TYPES6.ReturnStatement ? "return" : "throw";
19645
20563
  const lineNumber = statementNode.loc?.start.line ?? 0;
19646
20564
  context.report({
19647
20565
  data: {
@@ -19658,7 +20576,7 @@ var rule = {
19658
20576
  const statementNode = node;
19659
20577
  if (openerStack.length === 0)
19660
20578
  return;
19661
- const targetLoop = statementNode.type === AST_NODE_TYPES5.ContinueStatement ? resolveContinueTargetLoop(statementNode) : resolveBreakTargetLoop(statementNode);
20579
+ const targetLoop = statementNode.type === AST_NODE_TYPES6.ContinueStatement ? resolveContinueTargetLoop(statementNode) : resolveBreakTargetLoop(statementNode);
19662
20580
  if (!targetLoop)
19663
20581
  return;
19664
20582
  for (const { node: openerNode, config, opener, loopAncestors } of openerStack) {
@@ -19666,7 +20584,7 @@ var rule = {
19666
20584
  continue;
19667
20585
  const validClosers = getValidClosers(config);
19668
20586
  const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
19669
- const statementType = statementNode.type === AST_NODE_TYPES5.BreakStatement ? "break" : "continue";
20587
+ const statementType = statementNode.type === AST_NODE_TYPES6.BreakStatement ? "break" : "continue";
19670
20588
  const lineNumber = statementNode.loc?.start.line ?? 0;
19671
20589
  context.report({
19672
20590
  data: {
@@ -19804,7 +20722,7 @@ var rule = {
19804
20722
  continue;
19805
20723
  const validClosers = getValidClosers(config);
19806
20724
  const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
19807
- const asyncType = asyncNode.type === AST_NODE_TYPES5.AwaitExpression ? "await" : "yield";
20725
+ const asyncType = asyncNode.type === AST_NODE_TYPES6.AwaitExpression ? "await" : "yield";
19808
20726
  context.report({
19809
20727
  data: { asyncType, closer, opener },
19810
20728
  messageId: "asyncViolation",
@@ -20021,10 +20939,12 @@ function isIterationOrMemoCallback(callExpr, iterationMethods, memoizationHooks)
20021
20939
  const methodName = callee.property.name;
20022
20940
  if (iterationMethods.has(methodName))
20023
20941
  return true;
20024
- if (methodName === "from" && callee.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.type === TSESTree9.AST_NODE_TYPES.Identifier && callee.object.object.name === "Array" && callExpr.arguments.length >= 2)
20942
+ if (methodName === "from" && callee.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.type === TSESTree9.AST_NODE_TYPES.Identifier && callee.object.object.name === "Array" && callExpr.arguments.length >= 2) {
20025
20943
  return true;
20026
- if (methodName === "call" && callee.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.property.type === TSESTree9.AST_NODE_TYPES.Identifier && iterationMethods.has(callee.object.object.property.name))
20944
+ }
20945
+ if (methodName === "call" && callee.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.property.type === TSESTree9.AST_NODE_TYPES.Identifier && iterationMethods.has(callee.object.object.property.name)) {
20027
20946
  return true;
20947
+ }
20028
20948
  }
20029
20949
  return false;
20030
20950
  }
@@ -20036,14 +20956,15 @@ function findEnclosingCallExpression(node) {
20036
20956
  for (const argument of parent.arguments) {
20037
20957
  if (argument === current)
20038
20958
  return parent;
20039
- if (argument.type === TSESTree9.AST_NODE_TYPES.SpreadElement && argument.argument === current)
20959
+ if (argument.type === TSESTree9.AST_NODE_TYPES.SpreadElement && argument.argument === current) {
20040
20960
  return parent;
20961
+ }
20041
20962
  }
20042
20963
  return;
20043
20964
  }
20044
20965
  if (ARGUMENT_WRAPPER_TYPES.has(parent.type)) {
20045
20966
  current = parent;
20046
- parent = parent.parent;
20967
+ ({ parent } = parent);
20047
20968
  continue;
20048
20969
  }
20049
20970
  break;
@@ -20133,14 +21054,16 @@ function isTopLevelReturn(node) {
20133
21054
  return false;
20134
21055
  if (parent.type === TSESTree9.AST_NODE_TYPES.ReturnStatement) {
20135
21056
  let currentNode = ascendPastWrappers(parent.parent);
20136
- while (currentNode && CONTROL_FLOW_TYPES.has(currentNode.type))
21057
+ while (currentNode && CONTROL_FLOW_TYPES.has(currentNode.type)) {
20137
21058
  currentNode = ascendPastWrappers(currentNode.parent);
21059
+ }
20138
21060
  if (!currentNode)
20139
21061
  return false;
20140
21062
  if (IS_FUNCTION_EXPRESSION.has(currentNode.type)) {
20141
21063
  const functionParent = ascendPastWrappers(currentNode.parent);
20142
- if (functionParent?.type === TSESTree9.AST_NODE_TYPES.CallExpression)
21064
+ if (functionParent?.type === TSESTree9.AST_NODE_TYPES.CallExpression) {
20143
21065
  return isReactComponentHOC2(functionParent);
21066
+ }
20144
21067
  return true;
20145
21068
  }
20146
21069
  return currentNode.type === TSESTree9.AST_NODE_TYPES.FunctionDeclaration;
@@ -20158,7 +21081,7 @@ function isIgnoredCallExpression(node, ignoreList) {
20158
21081
  if (!parent)
20159
21082
  return false;
20160
21083
  if (parent.type === TSESTree9.AST_NODE_TYPES.JSXExpressionContainer) {
20161
- parent = parent.parent;
21084
+ ({ parent } = parent);
20162
21085
  if (!parent)
20163
21086
  return false;
20164
21087
  }
@@ -20169,11 +21092,12 @@ function isIgnoredCallExpression(node, ignoreList) {
20169
21092
  const { callee } = parent;
20170
21093
  if (callee.type === TSESTree9.AST_NODE_TYPES.Identifier)
20171
21094
  return ignoreList.includes(callee.name);
20172
- if (callee.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree9.AST_NODE_TYPES.Identifier && callee.property.type === TSESTree9.AST_NODE_TYPES.Identifier)
21095
+ if (callee.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree9.AST_NODE_TYPES.Identifier && callee.property.type === TSESTree9.AST_NODE_TYPES.Identifier) {
20173
21096
  return ignoreList.includes(`${callee.object.name}.${callee.property.name}`);
21097
+ }
20174
21098
  return false;
20175
21099
  }
20176
- parent = parent.parent;
21100
+ ({ parent } = parent);
20177
21101
  }
20178
21102
  return false;
20179
21103
  }
@@ -20181,12 +21105,13 @@ function isJSXPropValue(node) {
20181
21105
  let { parent } = node;
20182
21106
  if (!parent)
20183
21107
  return false;
20184
- while (parent && (parent.type === TSESTree9.AST_NODE_TYPES.ConditionalExpression || parent.type === TSESTree9.AST_NODE_TYPES.LogicalExpression))
20185
- parent = parent.parent;
21108
+ while (parent && (parent.type === TSESTree9.AST_NODE_TYPES.ConditionalExpression || parent.type === TSESTree9.AST_NODE_TYPES.LogicalExpression)) {
21109
+ ({ parent } = parent);
21110
+ }
20186
21111
  if (!parent)
20187
21112
  return false;
20188
21113
  if (parent.type === TSESTree9.AST_NODE_TYPES.JSXExpressionContainer) {
20189
- parent = parent.parent;
21114
+ ({ parent } = parent);
20190
21115
  if (!parent)
20191
21116
  return false;
20192
21117
  }
@@ -20202,7 +21127,7 @@ function isTernaryJSXChild(node) {
20202
21127
  foundTernary = true;
20203
21128
  current = current.parent;
20204
21129
  }
20205
- if (!foundTernary || !current)
21130
+ if (!(foundTernary && current))
20206
21131
  return false;
20207
21132
  if (current.type !== TSESTree9.AST_NODE_TYPES.JSXExpressionContainer)
20208
21133
  return false;
@@ -20411,7 +21336,7 @@ var GLOBAL_BUILTINS = new Set([
20411
21336
  "Window",
20412
21337
  "Event"
20413
21338
  ]);
20414
- function getHookName3(node) {
21339
+ function getHookName4(node) {
20415
21340
  const { callee } = node;
20416
21341
  if (callee.type === TSESTree10.AST_NODE_TYPES.Identifier)
20417
21342
  return callee.name;
@@ -20474,7 +21399,7 @@ function isStableArrayIndex(stableResult, node, identifierName) {
20474
21399
  if (!(stableResult instanceof Set) || node.type !== TSESTree10.AST_NODE_TYPES.VariableDeclarator || node.id.type !== TSESTree10.AST_NODE_TYPES.ArrayPattern) {
20475
21400
  return false;
20476
21401
  }
20477
- const elements = node.id.elements;
21402
+ const { elements } = node.id;
20478
21403
  let index2 = 0;
20479
21404
  for (const element of elements) {
20480
21405
  if (element.type === TSESTree10.AST_NODE_TYPES.Identifier && element.name === identifierName) {
@@ -20488,7 +21413,7 @@ function isStableHookValue(init, node, identifierName, stableHooks) {
20488
21413
  const castInit = init;
20489
21414
  if (castInit.type !== TSESTree10.AST_NODE_TYPES.CallExpression)
20490
21415
  return false;
20491
- const hookName = getHookName3(castInit);
21416
+ const hookName = getHookName4(castInit);
20492
21417
  if (!hookName)
20493
21418
  return false;
20494
21419
  const stableResult = stableHooks.get(hookName);
@@ -20507,7 +21432,7 @@ function isStableValue(variable, identifierName, stableHooks) {
20507
21432
  if (STABLE_VALUE_TYPES.has(type3))
20508
21433
  return true;
20509
21434
  if (type3 === "Variable" && node.type === TSESTree10.AST_NODE_TYPES.VariableDeclarator) {
20510
- const parent = node.parent;
21435
+ const { parent } = node;
20511
21436
  if (!parent || parent.type !== TSESTree10.AST_NODE_TYPES.VariableDeclaration || parent.kind !== "const")
20512
21437
  continue;
20513
21438
  const init = node.init;
@@ -20554,10 +21479,10 @@ function findTopmostMemberExpression(node) {
20554
21479
  const isMemberParent = parent.type === TSESTree10.AST_NODE_TYPES.MemberExpression && parent.object === current;
20555
21480
  const isChainParent = parent.type === TSESTree10.AST_NODE_TYPES.ChainExpression;
20556
21481
  const isNonNullParent = parent.type === TSESTree10.AST_NODE_TYPES.TSNonNullExpression;
20557
- if (!isMemberParent && !isChainParent && !isNonNullParent)
21482
+ if (!(isMemberParent || isChainParent || isNonNullParent))
20558
21483
  break;
20559
21484
  current = parent;
20560
- parent = parent.parent;
21485
+ ({ parent } = parent);
20561
21486
  }
20562
21487
  return current;
20563
21488
  }
@@ -20575,21 +21500,21 @@ var TS_RUNTIME_EXPRESSIONS = new Set([
20575
21500
  TSESTree10.AST_NODE_TYPES.TSInstantiationExpression
20576
21501
  ]);
20577
21502
  function isComputedPropertyIdentifier(identifier3) {
20578
- const parent = identifier3.parent;
21503
+ const { parent } = identifier3;
20579
21504
  return parent?.type === TSESTree10.AST_NODE_TYPES.Property && parent.computed && parent.key === identifier3;
20580
21505
  }
20581
21506
  function isInTypePosition(identifier3) {
20582
21507
  let parent = identifier3.parent;
20583
21508
  while (parent) {
20584
21509
  if (TS_RUNTIME_EXPRESSIONS.has(parent.type)) {
20585
- parent = parent.parent;
21510
+ ({ parent } = parent);
20586
21511
  continue;
20587
21512
  }
20588
21513
  if (parent.type.startsWith("TS"))
20589
21514
  return true;
20590
21515
  if (IS_CEASE_BOUNDARY.has(parent.type))
20591
21516
  return false;
20592
- parent = parent.parent;
21517
+ ({ parent } = parent);
20593
21518
  }
20594
21519
  return false;
20595
21520
  }
@@ -20613,7 +21538,7 @@ function isDeclaredInComponentBody(variable, closureNode) {
20613
21538
  return node === functionParent;
20614
21539
  });
20615
21540
  }
20616
- parent = parent.parent;
21541
+ ({ parent } = parent);
20617
21542
  }
20618
21543
  return false;
20619
21544
  }
@@ -20789,7 +21714,7 @@ var useExhaustiveDependencies = {
20789
21714
  return {
20790
21715
  CallExpression(node) {
20791
21716
  const callNode = node;
20792
- const hookName = getHookName3(callNode);
21717
+ const hookName = getHookName4(callNode);
20793
21718
  if (hookName === undefined || hookName === "")
20794
21719
  return;
20795
21720
  const hookConfig = hookConfigs.get(hookName);
@@ -21213,7 +22138,7 @@ var useHookAtTopLevel = {
21213
22138
  const current = getCurrentContext();
21214
22139
  if (!current)
21215
22140
  return;
21216
- if (!current.isComponentOrHook && !current.inNestedFunction)
22141
+ if (!(current.isComponentOrHook || current.inNestedFunction))
21217
22142
  return;
21218
22143
  if (isInFinallyBlock(callNode))
21219
22144
  return;
@@ -21385,7 +22310,7 @@ var useHookAtTopLevel = {
21385
22310
  };
21386
22311
  var use_hook_at_top_level_default = useHookAtTopLevel;
21387
22312
 
21388
- // src/configure-utilities.ts
22313
+ // src/utilities/configure-utilities.ts
21389
22314
  function createPairConfiguration(opener, closer, options3 = {}) {
21390
22315
  return { closer, opener, ...options3 };
21391
22316
  }
@@ -21487,10 +22412,12 @@ var rules = {
21487
22412
  "ban-instances": ban_instances_default,
21488
22413
  "ban-react-fc": ban_react_fc_default,
21489
22414
  "enforce-ianitor-check-type": enforce_ianitor_check_type_default,
22415
+ "fast-format": fast_format_default,
21490
22416
  "no-async-constructor": no_async_constructor_default,
21491
22417
  "no-color3-constructor": no_color3_constructor_default,
21492
22418
  "no-commented-code": no_commented_code_default,
21493
22419
  "no-god-components": no_god_components_default,
22420
+ "no-identity-map": no_identity_map_default,
21494
22421
  "no-instance-methods-without-this": no_instance_methods_without_this_default,
21495
22422
  "no-print": no_print_default,
21496
22423
  "no-shorthand-names": no_shorthand_names_default,
@@ -21506,17 +22433,17 @@ var rules = {
21506
22433
  };
21507
22434
  var recommended = {
21508
22435
  plugins: {
21509
- "cease-nonsense": {
21510
- rules
21511
- }
22436
+ "cease-nonsense": { rules }
21512
22437
  },
21513
22438
  rules: {
21514
22439
  "cease-nonsense/ban-react-fc": "error",
21515
22440
  "cease-nonsense/enforce-ianitor-check-type": "error",
22441
+ "cease-nonsense/fast-format": "error",
21516
22442
  "cease-nonsense/no-async-constructor": "error",
21517
22443
  "cease-nonsense/no-color3-constructor": "error",
21518
- "cease-nonsense/no-instance-methods-without-this": "error",
21519
22444
  "cease-nonsense/no-god-components": "error",
22445
+ "cease-nonsense/no-identity-map": "error",
22446
+ "cease-nonsense/no-instance-methods-without-this": "error",
21520
22447
  "cease-nonsense/no-print": "error",
21521
22448
  "cease-nonsense/no-shorthand-names": "error",
21522
22449
  "cease-nonsense/no-warn": "error",
@@ -21551,4 +22478,4 @@ export {
21551
22478
  createBanInstancesOptions
21552
22479
  };
21553
22480
 
21554
- //# debugId=BE95AD3504B774A764756E2164756E21
22481
+ //# debugId=7DA0BA55D13FFCAD64756E2164756E21