eslint-plugin-nextfriday 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "eslint-plugin-nextfriday",
4
- version: "4.2.0",
4
+ version: "4.3.0",
5
5
  description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
6
6
  keywords: [
7
7
  "eslint",
@@ -486,13 +486,64 @@ var enforceConstantCase = createRule3({
486
486
  });
487
487
  var enforce_constant_case_default = enforceConstantCase;
488
488
 
489
- // src/rules/enforce-hook-naming.ts
489
+ // src/rules/enforce-hook-filename.ts
490
490
  import path from "path";
491
491
  import { AST_NODE_TYPES as AST_NODE_TYPES5, ESLintUtils as ESLintUtils4 } from "@typescript-eslint/utils";
492
492
  var createRule4 = ESLintUtils4.RuleCreator(
493
493
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
494
494
  );
495
- var enforceHookNaming = createRule4({
495
+ var enforceHookFilename = createRule4({
496
+ name: "enforce-hook-filename",
497
+ meta: {
498
+ type: "suggestion",
499
+ docs: {
500
+ description: "Enforce that files exporting custom hooks are named *.hook.ts or *.hooks.ts"
501
+ },
502
+ messages: {
503
+ requireHookFilename: "'{{ name }}' is a custom hook and must be exported from a *.hook.ts or *.hooks.ts file."
504
+ },
505
+ schema: []
506
+ },
507
+ defaultOptions: [],
508
+ create(context) {
509
+ const basename2 = path.basename(context.filename);
510
+ const isHookFile = basename2.endsWith(".hook.ts") || basename2.endsWith(".hooks.ts");
511
+ if (isHookFile) return {};
512
+ function reportIfHook(name, node) {
513
+ if (name.startsWith("use") && name.length > 3 && /^use[A-Z]/.test(name)) {
514
+ context.report({ node, messageId: "requireHookFilename", data: { name } });
515
+ }
516
+ }
517
+ return {
518
+ ExportNamedDeclaration(node) {
519
+ if (node.declaration?.type === AST_NODE_TYPES5.FunctionDeclaration && node.declaration.id) {
520
+ reportIfHook(node.declaration.id.name, node.declaration.id);
521
+ }
522
+ if (node.declaration?.type === AST_NODE_TYPES5.VariableDeclaration) {
523
+ for (const declarator of node.declaration.declarations) {
524
+ if (declarator.id.type === AST_NODE_TYPES5.Identifier && declarator.init !== null && (declarator.init.type === AST_NODE_TYPES5.ArrowFunctionExpression || declarator.init.type === AST_NODE_TYPES5.FunctionExpression)) {
525
+ reportIfHook(declarator.id.name, declarator.id);
526
+ }
527
+ }
528
+ }
529
+ },
530
+ ExportDefaultDeclaration(node) {
531
+ if (node.declaration.type === AST_NODE_TYPES5.FunctionDeclaration && node.declaration.id !== null) {
532
+ reportIfHook(node.declaration.id.name, node.declaration.id);
533
+ }
534
+ }
535
+ };
536
+ }
537
+ });
538
+ var enforce_hook_filename_default = enforceHookFilename;
539
+
540
+ // src/rules/enforce-hook-naming.ts
541
+ import path2 from "path";
542
+ import { AST_NODE_TYPES as AST_NODE_TYPES6, ESLintUtils as ESLintUtils5 } from "@typescript-eslint/utils";
543
+ var createRule5 = ESLintUtils5.RuleCreator(
544
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
545
+ );
546
+ var enforceHookNaming = createRule5({
496
547
  name: "enforce-hook-naming",
497
548
  meta: {
498
549
  type: "suggestion",
@@ -508,7 +559,7 @@ var enforceHookNaming = createRule4({
508
559
  defaultOptions: [],
509
560
  create(context) {
510
561
  const { filename } = context;
511
- const basename2 = path.basename(filename);
562
+ const basename2 = path2.basename(filename);
512
563
  const isHookFile = basename2.endsWith(".hook.ts") || basename2.endsWith(".hooks.ts");
513
564
  if (!isHookFile) {
514
565
  return {};
@@ -531,22 +582,22 @@ var enforceHookNaming = createRule4({
531
582
  };
532
583
  return {
533
584
  ExportNamedDeclaration(node) {
534
- if (node.declaration?.type === AST_NODE_TYPES5.FunctionDeclaration && node.declaration.id) {
585
+ if (node.declaration?.type === AST_NODE_TYPES6.FunctionDeclaration && node.declaration.id) {
535
586
  checkFunctionName(node.declaration.id.name, node.declaration.id, "missingUsePrefix");
536
587
  }
537
- if (node.declaration?.type === AST_NODE_TYPES5.VariableDeclaration) {
588
+ if (node.declaration?.type === AST_NODE_TYPES6.VariableDeclaration) {
538
589
  node.declaration.declarations.forEach((declarator) => {
539
- if (declarator.id.type === AST_NODE_TYPES5.Identifier) {
590
+ if (declarator.id.type === AST_NODE_TYPES6.Identifier) {
540
591
  checkFunctionName(declarator.id.name, declarator.id, "missingUsePrefix");
541
592
  }
542
593
  });
543
594
  }
544
595
  },
545
596
  ExportDefaultDeclaration(node) {
546
- if (node.declaration.type === AST_NODE_TYPES5.Identifier) {
597
+ if (node.declaration.type === AST_NODE_TYPES6.Identifier) {
547
598
  checkFunctionName(node.declaration.name, node.declaration, "defaultExportMissingUsePrefix");
548
599
  }
549
- if (node.declaration.type === AST_NODE_TYPES5.FunctionDeclaration && node.declaration.id) {
600
+ if (node.declaration.type === AST_NODE_TYPES6.FunctionDeclaration && node.declaration.id) {
550
601
  checkFunctionName(node.declaration.id.name, node.declaration.id, "defaultExportMissingUsePrefix");
551
602
  }
552
603
  }
@@ -556,26 +607,26 @@ var enforceHookNaming = createRule4({
556
607
  var enforce_hook_naming_default = enforceHookNaming;
557
608
 
558
609
  // src/rules/enforce-property-case.ts
559
- import { AST_NODE_TYPES as AST_NODE_TYPES6, ESLintUtils as ESLintUtils5 } from "@typescript-eslint/utils";
560
- var createRule5 = ESLintUtils5.RuleCreator(
610
+ import { AST_NODE_TYPES as AST_NODE_TYPES7, ESLintUtils as ESLintUtils6 } from "@typescript-eslint/utils";
611
+ var createRule6 = ESLintUtils6.RuleCreator(
561
612
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
562
613
  );
563
614
  var SNAKE_CASE_REGEX3 = /^[a-z]+_[a-z0-9_]*$/;
564
615
  var SCREAMING_SNAKE_CASE_REGEX2 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
565
616
  var isInsideAsConst = (node) => {
566
617
  const { parent } = node;
567
- if (parent.type === AST_NODE_TYPES6.TSAsExpression && parent.typeAnnotation.type === AST_NODE_TYPES6.TSTypeReference && parent.typeAnnotation.typeName.type === AST_NODE_TYPES6.Identifier && parent.typeAnnotation.typeName.name === "const") {
618
+ if (parent.type === AST_NODE_TYPES7.TSAsExpression && parent.typeAnnotation.type === AST_NODE_TYPES7.TSTypeReference && parent.typeAnnotation.typeName.type === AST_NODE_TYPES7.Identifier && parent.typeAnnotation.typeName.name === "const") {
568
619
  return true;
569
620
  }
570
- if (parent.type === AST_NODE_TYPES6.ArrayExpression) {
621
+ if (parent.type === AST_NODE_TYPES7.ArrayExpression) {
571
622
  const grandparent = parent.parent;
572
- if (grandparent?.type === AST_NODE_TYPES6.TSAsExpression && grandparent.typeAnnotation.type === AST_NODE_TYPES6.TSTypeReference && grandparent.typeAnnotation.typeName.type === AST_NODE_TYPES6.Identifier && grandparent.typeAnnotation.typeName.name === "const") {
623
+ if (grandparent?.type === AST_NODE_TYPES7.TSAsExpression && grandparent.typeAnnotation.type === AST_NODE_TYPES7.TSTypeReference && grandparent.typeAnnotation.typeName.type === AST_NODE_TYPES7.Identifier && grandparent.typeAnnotation.typeName.name === "const") {
573
624
  return true;
574
625
  }
575
626
  }
576
627
  return false;
577
628
  };
578
- var enforcePropertyCase = createRule5({
629
+ var enforcePropertyCase = createRule6({
579
630
  name: "enforce-property-case",
580
631
  meta: {
581
632
  type: "suggestion",
@@ -591,7 +642,7 @@ var enforcePropertyCase = createRule5({
591
642
  create(context) {
592
643
  return {
593
644
  Property(node) {
594
- if (node.parent.type !== AST_NODE_TYPES6.ObjectExpression) {
645
+ if (node.parent.type !== AST_NODE_TYPES7.ObjectExpression) {
595
646
  return;
596
647
  }
597
648
  if (isInsideAsConst(node.parent)) {
@@ -600,7 +651,7 @@ var enforcePropertyCase = createRule5({
600
651
  if (node.computed) {
601
652
  return;
602
653
  }
603
- if (node.key.type !== AST_NODE_TYPES6.Identifier) {
654
+ if (node.key.type !== AST_NODE_TYPES7.Identifier) {
604
655
  return;
605
656
  }
606
657
  const { name } = node.key;
@@ -618,12 +669,12 @@ var enforcePropertyCase = createRule5({
618
669
  var enforce_property_case_default = enforcePropertyCase;
619
670
 
620
671
  // src/rules/enforce-props-suffix.ts
621
- import path2 from "path";
622
- import { AST_NODE_TYPES as AST_NODE_TYPES7, ESLintUtils as ESLintUtils6 } from "@typescript-eslint/utils";
623
- var createRule6 = ESLintUtils6.RuleCreator(
672
+ import path3 from "path";
673
+ import { AST_NODE_TYPES as AST_NODE_TYPES8, ESLintUtils as ESLintUtils7 } from "@typescript-eslint/utils";
674
+ var createRule7 = ESLintUtils7.RuleCreator(
624
675
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
625
676
  );
626
- var enforcePropsSuffix = createRule6({
677
+ var enforcePropsSuffix = createRule7({
627
678
  name: "enforce-props-suffix",
628
679
  meta: {
629
680
  type: "suggestion",
@@ -638,7 +689,7 @@ var enforcePropsSuffix = createRule6({
638
689
  defaultOptions: [],
639
690
  create(context) {
640
691
  const { filename } = context;
641
- const ext = path2.extname(filename);
692
+ const ext = path3.extname(filename);
642
693
  const isComponentFile = ext === ".tsx" || ext === ".jsx";
643
694
  if (!isComponentFile) {
644
695
  return {};
@@ -657,13 +708,13 @@ var enforcePropsSuffix = createRule6({
657
708
  };
658
709
  return {
659
710
  TSInterfaceDeclaration(node) {
660
- if (node.id.type === AST_NODE_TYPES7.Identifier) {
711
+ if (node.id.type === AST_NODE_TYPES8.Identifier) {
661
712
  checkTypeName(node.id.name, node.id);
662
713
  }
663
714
  },
664
715
  TSTypeAliasDeclaration(node) {
665
- if (node.id.type === AST_NODE_TYPES7.Identifier) {
666
- if (node.typeAnnotation.type === AST_NODE_TYPES7.TSTypeLiteral) {
716
+ if (node.id.type === AST_NODE_TYPES8.Identifier) {
717
+ if (node.typeAnnotation.type === AST_NODE_TYPES8.TSTypeLiteral) {
667
718
  checkTypeName(node.id.name, node.id);
668
719
  }
669
720
  }
@@ -674,11 +725,11 @@ var enforcePropsSuffix = createRule6({
674
725
  var enforce_props_suffix_default = enforcePropsSuffix;
675
726
 
676
727
  // src/rules/enforce-readonly-component-props.ts
677
- import { AST_NODE_TYPES as AST_NODE_TYPES8, ESLintUtils as ESLintUtils7 } from "@typescript-eslint/utils";
678
- var createRule7 = ESLintUtils7.RuleCreator(
728
+ import { AST_NODE_TYPES as AST_NODE_TYPES9, ESLintUtils as ESLintUtils8 } from "@typescript-eslint/utils";
729
+ var createRule8 = ESLintUtils8.RuleCreator(
679
730
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
680
731
  );
681
- var enforceReadonlyComponentProps = createRule7({
732
+ var enforceReadonlyComponentProps = createRule8({
682
733
  name: "enforce-readonly-component-props",
683
734
  meta: {
684
735
  type: "suggestion",
@@ -694,40 +745,40 @@ var enforceReadonlyComponentProps = createRule7({
694
745
  defaultOptions: [],
695
746
  create(context) {
696
747
  function hasJSXInConditional(node) {
697
- return node.consequent.type === AST_NODE_TYPES8.JSXElement || node.consequent.type === AST_NODE_TYPES8.JSXFragment || node.alternate.type === AST_NODE_TYPES8.JSXElement || node.alternate.type === AST_NODE_TYPES8.JSXFragment;
748
+ return node.consequent.type === AST_NODE_TYPES9.JSXElement || node.consequent.type === AST_NODE_TYPES9.JSXFragment || node.alternate.type === AST_NODE_TYPES9.JSXElement || node.alternate.type === AST_NODE_TYPES9.JSXFragment;
698
749
  }
699
750
  function hasJSXInLogical(node) {
700
- return node.right.type === AST_NODE_TYPES8.JSXElement || node.right.type === AST_NODE_TYPES8.JSXFragment;
751
+ return node.right.type === AST_NODE_TYPES9.JSXElement || node.right.type === AST_NODE_TYPES9.JSXFragment;
701
752
  }
702
753
  function hasJSXReturn(block) {
703
754
  return block.body.some((stmt) => {
704
- if (stmt.type === AST_NODE_TYPES8.ReturnStatement && stmt.argument) {
705
- return stmt.argument.type === AST_NODE_TYPES8.JSXElement || stmt.argument.type === AST_NODE_TYPES8.JSXFragment || stmt.argument.type === AST_NODE_TYPES8.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES8.LogicalExpression && hasJSXInLogical(stmt.argument);
755
+ if (stmt.type === AST_NODE_TYPES9.ReturnStatement && stmt.argument) {
756
+ return stmt.argument.type === AST_NODE_TYPES9.JSXElement || stmt.argument.type === AST_NODE_TYPES9.JSXFragment || stmt.argument.type === AST_NODE_TYPES9.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES9.LogicalExpression && hasJSXInLogical(stmt.argument);
706
757
  }
707
758
  return false;
708
759
  });
709
760
  }
710
761
  function isReactComponent2(node) {
711
- if (node.type === AST_NODE_TYPES8.ArrowFunctionExpression) {
712
- if (node.body.type === AST_NODE_TYPES8.JSXElement || node.body.type === AST_NODE_TYPES8.JSXFragment) {
762
+ if (node.type === AST_NODE_TYPES9.ArrowFunctionExpression) {
763
+ if (node.body.type === AST_NODE_TYPES9.JSXElement || node.body.type === AST_NODE_TYPES9.JSXFragment) {
713
764
  return true;
714
765
  }
715
- if (node.body.type === AST_NODE_TYPES8.BlockStatement) {
766
+ if (node.body.type === AST_NODE_TYPES9.BlockStatement) {
716
767
  return hasJSXReturn(node.body);
717
768
  }
718
- } else if (node.type === AST_NODE_TYPES8.FunctionExpression || node.type === AST_NODE_TYPES8.FunctionDeclaration) {
719
- if (node.body && node.body.type === AST_NODE_TYPES8.BlockStatement) {
769
+ } else if (node.type === AST_NODE_TYPES9.FunctionExpression || node.type === AST_NODE_TYPES9.FunctionDeclaration) {
770
+ if (node.body && node.body.type === AST_NODE_TYPES9.BlockStatement) {
720
771
  return hasJSXReturn(node.body);
721
772
  }
722
773
  }
723
774
  return false;
724
775
  }
725
776
  function isNamedType(node) {
726
- return node.type === AST_NODE_TYPES8.TSTypeReference;
777
+ return node.type === AST_NODE_TYPES9.TSTypeReference;
727
778
  }
728
779
  function isAlreadyReadonly(node) {
729
- if (node.type === AST_NODE_TYPES8.TSTypeReference && node.typeName) {
730
- if (node.typeName.type === AST_NODE_TYPES8.Identifier && node.typeName.name === "Readonly") {
780
+ if (node.type === AST_NODE_TYPES9.TSTypeReference && node.typeName) {
781
+ if (node.typeName.type === AST_NODE_TYPES9.Identifier && node.typeName.name === "Readonly") {
731
782
  return true;
732
783
  }
733
784
  }
@@ -741,7 +792,7 @@ var enforceReadonlyComponentProps = createRule7({
741
792
  return;
742
793
  }
743
794
  const param = node.params[0];
744
- if (param.type === AST_NODE_TYPES8.Identifier && param.typeAnnotation) {
795
+ if (param.type === AST_NODE_TYPES9.Identifier && param.typeAnnotation) {
745
796
  const { typeAnnotation } = param.typeAnnotation;
746
797
  if (isNamedType(typeAnnotation) && !isAlreadyReadonly(typeAnnotation)) {
747
798
  const { sourceCode } = context;
@@ -766,8 +817,8 @@ var enforceReadonlyComponentProps = createRule7({
766
817
  var enforce_readonly_component_props_default = enforceReadonlyComponentProps;
767
818
 
768
819
  // src/rules/enforce-render-naming.ts
769
- import { AST_NODE_TYPES as AST_NODE_TYPES9, ESLintUtils as ESLintUtils8 } from "@typescript-eslint/utils";
770
- var createRule8 = ESLintUtils8.RuleCreator(
820
+ import { AST_NODE_TYPES as AST_NODE_TYPES10, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
821
+ var createRule9 = ESLintUtils9.RuleCreator(
771
822
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
772
823
  );
773
824
  var ARRAY_RETURNING_METHODS = /* @__PURE__ */ new Set(["map", "flatMap", "filter"]);
@@ -782,20 +833,20 @@ function hasRenderPrefix(name) {
782
833
  return nextChar === nextChar.toUpperCase() && nextChar !== nextChar.toLowerCase();
783
834
  }
784
835
  function functionBodyReturnsJsx(body) {
785
- if (body.type === AST_NODE_TYPES9.JSXElement || body.type === AST_NODE_TYPES9.JSXFragment) {
836
+ if (body.type === AST_NODE_TYPES10.JSXElement || body.type === AST_NODE_TYPES10.JSXFragment) {
786
837
  return true;
787
838
  }
788
- if (body.type === AST_NODE_TYPES9.ConditionalExpression) {
839
+ if (body.type === AST_NODE_TYPES10.ConditionalExpression) {
789
840
  return isJsxProducingExpression(body.consequent) || isJsxProducingExpression(body.alternate);
790
841
  }
791
- if (body.type === AST_NODE_TYPES9.LogicalExpression) {
842
+ if (body.type === AST_NODE_TYPES10.LogicalExpression) {
792
843
  return isJsxProducingExpression(body.right);
793
844
  }
794
- if (body.type !== AST_NODE_TYPES9.BlockStatement) {
845
+ if (body.type !== AST_NODE_TYPES10.BlockStatement) {
795
846
  return false;
796
847
  }
797
848
  for (const statement of body.body) {
798
- if (statement.type === AST_NODE_TYPES9.ReturnStatement && statement.argument) {
849
+ if (statement.type === AST_NODE_TYPES10.ReturnStatement && statement.argument) {
799
850
  if (isJsxProducingExpression(statement.argument)) {
800
851
  return true;
801
852
  }
@@ -804,35 +855,35 @@ function functionBodyReturnsJsx(body) {
804
855
  return false;
805
856
  }
806
857
  function isJsxProducingExpression(node) {
807
- if (node.type === AST_NODE_TYPES9.JSXElement || node.type === AST_NODE_TYPES9.JSXFragment) {
858
+ if (node.type === AST_NODE_TYPES10.JSXElement || node.type === AST_NODE_TYPES10.JSXFragment) {
808
859
  return true;
809
860
  }
810
- if (node.type === AST_NODE_TYPES9.ConditionalExpression) {
861
+ if (node.type === AST_NODE_TYPES10.ConditionalExpression) {
811
862
  return isJsxProducingExpression(node.consequent) || isJsxProducingExpression(node.alternate);
812
863
  }
813
- if (node.type === AST_NODE_TYPES9.LogicalExpression) {
864
+ if (node.type === AST_NODE_TYPES10.LogicalExpression) {
814
865
  return isJsxProducingExpression(node.right);
815
866
  }
816
- if (node.type === AST_NODE_TYPES9.ArrayExpression) {
867
+ if (node.type === AST_NODE_TYPES10.ArrayExpression) {
817
868
  return node.elements.some((element) => {
818
- if (!element || element.type === AST_NODE_TYPES9.SpreadElement) {
869
+ if (!element || element.type === AST_NODE_TYPES10.SpreadElement) {
819
870
  return false;
820
871
  }
821
872
  return isJsxProducingExpression(element);
822
873
  });
823
874
  }
824
- if (node.type === AST_NODE_TYPES9.ArrowFunctionExpression || node.type === AST_NODE_TYPES9.FunctionExpression) {
875
+ if (node.type === AST_NODE_TYPES10.ArrowFunctionExpression || node.type === AST_NODE_TYPES10.FunctionExpression) {
825
876
  return functionBodyReturnsJsx(node.body);
826
877
  }
827
- if (node.type === AST_NODE_TYPES9.CallExpression) {
828
- if (node.callee.type === AST_NODE_TYPES9.MemberExpression && node.callee.property.type === AST_NODE_TYPES9.Identifier && ARRAY_RETURNING_METHODS.has(node.callee.property.name)) {
878
+ if (node.type === AST_NODE_TYPES10.CallExpression) {
879
+ if (node.callee.type === AST_NODE_TYPES10.MemberExpression && node.callee.property.type === AST_NODE_TYPES10.Identifier && ARRAY_RETURNING_METHODS.has(node.callee.property.name)) {
829
880
  const callback = node.arguments[0];
830
- if (callback && (callback.type === AST_NODE_TYPES9.ArrowFunctionExpression || callback.type === AST_NODE_TYPES9.FunctionExpression)) {
881
+ if (callback && (callback.type === AST_NODE_TYPES10.ArrowFunctionExpression || callback.type === AST_NODE_TYPES10.FunctionExpression)) {
831
882
  return functionBodyReturnsJsx(callback.body);
832
883
  }
833
884
  }
834
885
  }
835
- if (node.type === AST_NODE_TYPES9.TSAsExpression || node.type === AST_NODE_TYPES9.TSSatisfiesExpression) {
886
+ if (node.type === AST_NODE_TYPES10.TSAsExpression || node.type === AST_NODE_TYPES10.TSSatisfiesExpression) {
836
887
  return isJsxProducingExpression(node.expression);
837
888
  }
838
889
  return false;
@@ -841,16 +892,16 @@ function isPascalCase(name) {
841
892
  return /^[A-Z]/.test(name);
842
893
  }
843
894
  function isComponentFunction2(node) {
844
- if (node.type === AST_NODE_TYPES9.FunctionDeclaration && node.id && isPascalCase(node.id.name)) {
895
+ if (node.type === AST_NODE_TYPES10.FunctionDeclaration && node.id && isPascalCase(node.id.name)) {
845
896
  return true;
846
897
  }
847
898
  const parent = node.parent;
848
- if (parent?.type === AST_NODE_TYPES9.VariableDeclarator && parent.id.type === AST_NODE_TYPES9.Identifier && isPascalCase(parent.id.name)) {
899
+ if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.id.type === AST_NODE_TYPES10.Identifier && isPascalCase(parent.id.name)) {
849
900
  return true;
850
901
  }
851
902
  return false;
852
903
  }
853
- var enforceRenderNaming = createRule8({
904
+ var enforceRenderNaming = createRule9({
854
905
  name: "enforce-render-naming",
855
906
  meta: {
856
907
  type: "problem",
@@ -890,7 +941,7 @@ var enforceRenderNaming = createRule8({
890
941
  if (!isInsideComponent()) {
891
942
  return;
892
943
  }
893
- if (node.id.type !== AST_NODE_TYPES9.Identifier) {
944
+ if (node.id.type !== AST_NODE_TYPES10.Identifier) {
894
945
  return;
895
946
  }
896
947
  if (!node.init) {
@@ -916,8 +967,8 @@ var enforceRenderNaming = createRule8({
916
967
  var enforce_render_naming_default = enforceRenderNaming;
917
968
 
918
969
  // src/rules/enforce-service-naming.ts
919
- import { AST_NODE_TYPES as AST_NODE_TYPES10, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
920
- var createRule9 = ESLintUtils9.RuleCreator(
970
+ import { AST_NODE_TYPES as AST_NODE_TYPES11, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
971
+ var createRule10 = ESLintUtils10.RuleCreator(
921
972
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
922
973
  );
923
974
  var BANNED_PREFIXES = {
@@ -926,7 +977,7 @@ var BANNED_PREFIXES = {
926
977
  handle: ["create", "verify"],
927
978
  set: ["update", "save", "patch"]
928
979
  };
929
- var enforceServiceNaming = createRule9({
980
+ var enforceServiceNaming = createRule10({
930
981
  name: "enforce-service-naming",
931
982
  meta: {
932
983
  type: "suggestion",
@@ -969,12 +1020,12 @@ var enforceServiceNaming = createRule9({
969
1020
  };
970
1021
  return {
971
1022
  ExportNamedDeclaration(node) {
972
- if (node.declaration?.type === AST_NODE_TYPES10.FunctionDeclaration && node.declaration.id) {
1023
+ if (node.declaration?.type === AST_NODE_TYPES11.FunctionDeclaration && node.declaration.id) {
973
1024
  checkExportedFunction(node.declaration, node.declaration.id);
974
1025
  }
975
- if (node.declaration?.type === AST_NODE_TYPES10.VariableDeclaration) {
1026
+ if (node.declaration?.type === AST_NODE_TYPES11.VariableDeclaration) {
976
1027
  node.declaration.declarations.forEach((declarator) => {
977
- if (declarator.id.type === AST_NODE_TYPES10.Identifier && declarator.init?.type === AST_NODE_TYPES10.ArrowFunctionExpression) {
1028
+ if (declarator.id.type === AST_NODE_TYPES11.Identifier && declarator.init?.type === AST_NODE_TYPES11.ArrowFunctionExpression) {
978
1029
  checkExportedFunction(declarator.init, declarator.id);
979
1030
  }
980
1031
  });
@@ -985,12 +1036,52 @@ var enforceServiceNaming = createRule9({
985
1036
  });
986
1037
  var enforce_service_naming_default = enforceServiceNaming;
987
1038
 
1039
+ // src/rules/enforce-test-filename.ts
1040
+ import path4 from "path";
1041
+ import { AST_NODE_TYPES as AST_NODE_TYPES12, ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
1042
+ var createRule11 = ESLintUtils11.RuleCreator(
1043
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1044
+ );
1045
+ var TEST_GLOBALS = /* @__PURE__ */ new Set(["describe", "it", "test", "beforeEach", "beforeAll", "afterEach", "afterAll"]);
1046
+ var enforceTestFilename = createRule11({
1047
+ name: "enforce-test-filename",
1048
+ meta: {
1049
+ type: "suggestion",
1050
+ docs: {
1051
+ description: "Enforce that files containing test code are named *.test.ts or *.test.tsx"
1052
+ },
1053
+ messages: {
1054
+ requireTestFilename: "Files containing test code must be named *.test.ts or *.test.tsx."
1055
+ },
1056
+ schema: []
1057
+ },
1058
+ defaultOptions: [],
1059
+ create(context) {
1060
+ const basename2 = path4.basename(context.filename);
1061
+ const isTestFile = basename2.endsWith(".test.ts") || basename2.endsWith(".test.tsx");
1062
+ if (isTestFile) return {};
1063
+ function isTestGlobalCall(node) {
1064
+ return node.callee.type === AST_NODE_TYPES12.Identifier && TEST_GLOBALS.has(node.callee.name);
1065
+ }
1066
+ let reported = false;
1067
+ return {
1068
+ CallExpression(node) {
1069
+ if (reported) return;
1070
+ if (!isTestGlobalCall(node)) return;
1071
+ reported = true;
1072
+ context.report({ node, messageId: "requireTestFilename" });
1073
+ }
1074
+ };
1075
+ }
1076
+ });
1077
+ var enforce_test_filename_default = enforceTestFilename;
1078
+
988
1079
  // src/rules/enforce-sorted-destructuring.ts
989
- import { AST_NODE_TYPES as AST_NODE_TYPES11, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
990
- var createRule10 = ESLintUtils10.RuleCreator(
1080
+ import { AST_NODE_TYPES as AST_NODE_TYPES13, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
1081
+ var createRule12 = ESLintUtils12.RuleCreator(
991
1082
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
992
1083
  );
993
- var enforceSortedDestructuring = createRule10({
1084
+ var enforceSortedDestructuring = createRule12({
994
1085
  name: "enforce-sorted-destructuring",
995
1086
  meta: {
996
1087
  type: "suggestion",
@@ -1006,19 +1097,19 @@ var enforceSortedDestructuring = createRule10({
1006
1097
  defaultOptions: [],
1007
1098
  create(context) {
1008
1099
  function getPropertyName(property) {
1009
- if (property.type === AST_NODE_TYPES11.RestElement) {
1100
+ if (property.type === AST_NODE_TYPES13.RestElement) {
1010
1101
  return null;
1011
1102
  }
1012
- if (property.key.type === AST_NODE_TYPES11.Identifier) {
1103
+ if (property.key.type === AST_NODE_TYPES13.Identifier) {
1013
1104
  return property.key.name;
1014
1105
  }
1015
1106
  return null;
1016
1107
  }
1017
1108
  function hasDefaultValue(property) {
1018
- return property.value.type === AST_NODE_TYPES11.AssignmentPattern && Boolean(property.value.right);
1109
+ return property.value.type === AST_NODE_TYPES13.AssignmentPattern && Boolean(property.value.right);
1019
1110
  }
1020
1111
  function checkVariableDeclarator(node) {
1021
- if (node.id.type !== AST_NODE_TYPES11.ObjectPattern) {
1112
+ if (node.id.type !== AST_NODE_TYPES13.ObjectPattern) {
1022
1113
  return;
1023
1114
  }
1024
1115
  const { properties } = node.id;
@@ -1026,7 +1117,7 @@ var enforceSortedDestructuring = createRule10({
1026
1117
  return;
1027
1118
  }
1028
1119
  const propertyInfo = properties.map((prop) => {
1029
- if (prop.type === AST_NODE_TYPES11.RestElement) {
1120
+ if (prop.type === AST_NODE_TYPES13.RestElement) {
1030
1121
  return null;
1031
1122
  }
1032
1123
  return {
@@ -1065,20 +1156,20 @@ var enforceSortedDestructuring = createRule10({
1065
1156
  var enforce_sorted_destructuring_default = enforceSortedDestructuring;
1066
1157
 
1067
1158
  // src/rules/enforce-type-declaration-order.ts
1068
- import { AST_NODE_TYPES as AST_NODE_TYPES12, ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
1069
- var createRule11 = ESLintUtils11.RuleCreator(
1159
+ import { AST_NODE_TYPES as AST_NODE_TYPES14, ESLintUtils as ESLintUtils13 } from "@typescript-eslint/utils";
1160
+ var createRule13 = ESLintUtils13.RuleCreator(
1070
1161
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1071
1162
  );
1072
1163
  function getTypeDeclarationName(node) {
1073
- if (node.type === AST_NODE_TYPES12.TSInterfaceDeclaration && node.id.type === AST_NODE_TYPES12.Identifier) {
1164
+ if (node.type === AST_NODE_TYPES14.TSInterfaceDeclaration && node.id.type === AST_NODE_TYPES14.Identifier) {
1074
1165
  return { name: node.id.name, position: node.range[0] };
1075
1166
  }
1076
- if (node.type === AST_NODE_TYPES12.TSTypeAliasDeclaration && node.id.type === AST_NODE_TYPES12.Identifier) {
1167
+ if (node.type === AST_NODE_TYPES14.TSTypeAliasDeclaration && node.id.type === AST_NODE_TYPES14.Identifier) {
1077
1168
  return { name: node.id.name, position: node.range[0] };
1078
1169
  }
1079
1170
  return null;
1080
1171
  }
1081
- var enforceTypeDeclarationOrder = createRule11({
1172
+ var enforceTypeDeclarationOrder = createRule13({
1082
1173
  name: "enforce-type-declaration-order",
1083
1174
  meta: {
1084
1175
  type: "suggestion",
@@ -1109,7 +1200,7 @@ var enforceTypeDeclarationOrder = createRule11({
1109
1200
  }
1110
1201
  },
1111
1202
  "TSPropertySignature TSTypeReference": function checkTypeReference(node) {
1112
- if (node.typeName.type !== AST_NODE_TYPES12.Identifier) {
1203
+ if (node.typeName.type !== AST_NODE_TYPES14.Identifier) {
1113
1204
  return;
1114
1205
  }
1115
1206
  const referencedName = node.typeName.name;
@@ -1146,8 +1237,8 @@ var enforceTypeDeclarationOrder = createRule11({
1146
1237
  var enforce_type_declaration_order_default = enforceTypeDeclarationOrder;
1147
1238
 
1148
1239
  // src/rules/index-export-only.ts
1149
- import { AST_NODE_TYPES as AST_NODE_TYPES13, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
1150
- var createRule12 = ESLintUtils12.RuleCreator(
1240
+ import { AST_NODE_TYPES as AST_NODE_TYPES15, ESLintUtils as ESLintUtils14 } from "@typescript-eslint/utils";
1241
+ var createRule14 = ESLintUtils14.RuleCreator(
1151
1242
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1152
1243
  );
1153
1244
  var isIndexFile = (filename) => getBaseName(filename) === "index";
@@ -1155,26 +1246,26 @@ var isAllowedExportNamed = (node) => {
1155
1246
  if (!node.declaration) {
1156
1247
  return true;
1157
1248
  }
1158
- return node.declaration.type === AST_NODE_TYPES13.TSTypeAliasDeclaration || node.declaration.type === AST_NODE_TYPES13.TSInterfaceDeclaration;
1249
+ return node.declaration.type === AST_NODE_TYPES15.TSTypeAliasDeclaration || node.declaration.type === AST_NODE_TYPES15.TSInterfaceDeclaration;
1159
1250
  };
1160
- var isAllowedExportDefault = (node) => node.declaration.type === AST_NODE_TYPES13.Identifier;
1251
+ var isAllowedExportDefault = (node) => node.declaration.type === AST_NODE_TYPES15.Identifier;
1161
1252
  var isAllowedTopLevel = (node) => {
1162
1253
  switch (node.type) {
1163
- case AST_NODE_TYPES13.ImportDeclaration:
1164
- case AST_NODE_TYPES13.ExportAllDeclaration:
1165
- case AST_NODE_TYPES13.TSTypeAliasDeclaration:
1166
- case AST_NODE_TYPES13.TSInterfaceDeclaration:
1167
- case AST_NODE_TYPES13.TSImportEqualsDeclaration:
1254
+ case AST_NODE_TYPES15.ImportDeclaration:
1255
+ case AST_NODE_TYPES15.ExportAllDeclaration:
1256
+ case AST_NODE_TYPES15.TSTypeAliasDeclaration:
1257
+ case AST_NODE_TYPES15.TSInterfaceDeclaration:
1258
+ case AST_NODE_TYPES15.TSImportEqualsDeclaration:
1168
1259
  return true;
1169
- case AST_NODE_TYPES13.ExportNamedDeclaration:
1260
+ case AST_NODE_TYPES15.ExportNamedDeclaration:
1170
1261
  return isAllowedExportNamed(node);
1171
- case AST_NODE_TYPES13.ExportDefaultDeclaration:
1262
+ case AST_NODE_TYPES15.ExportDefaultDeclaration:
1172
1263
  return isAllowedExportDefault(node);
1173
1264
  default:
1174
1265
  return false;
1175
1266
  }
1176
1267
  };
1177
- var indexExportOnly = createRule12({
1268
+ var indexExportOnly = createRule14({
1178
1269
  name: "index-export-only",
1179
1270
  meta: {
1180
1271
  type: "suggestion",
@@ -1208,11 +1299,11 @@ var indexExportOnly = createRule12({
1208
1299
  var index_export_only_default = indexExportOnly;
1209
1300
 
1210
1301
  // src/rules/jsx-newline-between-elements.ts
1211
- import { AST_NODE_TYPES as AST_NODE_TYPES14, ESLintUtils as ESLintUtils13 } from "@typescript-eslint/utils";
1212
- var createRule13 = ESLintUtils13.RuleCreator(
1302
+ import { AST_NODE_TYPES as AST_NODE_TYPES16, ESLintUtils as ESLintUtils15 } from "@typescript-eslint/utils";
1303
+ var createRule15 = ESLintUtils15.RuleCreator(
1213
1304
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1214
1305
  );
1215
- var jsxNewlineBetweenElements = createRule13({
1306
+ var jsxNewlineBetweenElements = createRule15({
1216
1307
  name: "jsx-newline-between-elements",
1217
1308
  meta: {
1218
1309
  type: "layout",
@@ -1230,7 +1321,7 @@ var jsxNewlineBetweenElements = createRule13({
1230
1321
  create(context) {
1231
1322
  const { sourceCode } = context;
1232
1323
  function isSignificantJSXChild(node) {
1233
- return node.type === AST_NODE_TYPES14.JSXElement || node.type === AST_NODE_TYPES14.JSXFragment || node.type === AST_NODE_TYPES14.JSXExpressionContainer;
1324
+ return node.type === AST_NODE_TYPES16.JSXElement || node.type === AST_NODE_TYPES16.JSXFragment || node.type === AST_NODE_TYPES16.JSXExpressionContainer;
1234
1325
  }
1235
1326
  function isMultiLine(node) {
1236
1327
  return node.loc.start.line !== node.loc.end.line;
@@ -1280,18 +1371,18 @@ var jsxNewlineBetweenElements = createRule13({
1280
1371
  var jsx_newline_between_elements_default = jsxNewlineBetweenElements;
1281
1372
 
1282
1373
  // src/rules/jsx-no-data-array.ts
1283
- import { AST_NODE_TYPES as AST_NODE_TYPES15, ESLintUtils as ESLintUtils14 } from "@typescript-eslint/utils";
1284
- var createRule14 = ESLintUtils14.RuleCreator(
1374
+ import { AST_NODE_TYPES as AST_NODE_TYPES17, ESLintUtils as ESLintUtils16 } from "@typescript-eslint/utils";
1375
+ var createRule16 = ESLintUtils16.RuleCreator(
1285
1376
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1286
1377
  );
1287
1378
  function isObjectLikeElement(node) {
1288
1379
  if (!node) {
1289
1380
  return false;
1290
1381
  }
1291
- if (node.type === AST_NODE_TYPES15.ObjectExpression) {
1382
+ if (node.type === AST_NODE_TYPES17.ObjectExpression) {
1292
1383
  return true;
1293
1384
  }
1294
- if (node.type === AST_NODE_TYPES15.TSAsExpression || node.type === AST_NODE_TYPES15.TSSatisfiesExpression) {
1385
+ if (node.type === AST_NODE_TYPES17.TSAsExpression || node.type === AST_NODE_TYPES17.TSSatisfiesExpression) {
1295
1386
  return isObjectLikeElement(node.expression);
1296
1387
  }
1297
1388
  return false;
@@ -1300,15 +1391,15 @@ function getArrayInitializer(init) {
1300
1391
  if (!init) {
1301
1392
  return null;
1302
1393
  }
1303
- if (init.type === AST_NODE_TYPES15.ArrayExpression) {
1394
+ if (init.type === AST_NODE_TYPES17.ArrayExpression) {
1304
1395
  return init;
1305
1396
  }
1306
- if (init.type === AST_NODE_TYPES15.TSAsExpression || init.type === AST_NODE_TYPES15.TSSatisfiesExpression) {
1397
+ if (init.type === AST_NODE_TYPES17.TSAsExpression || init.type === AST_NODE_TYPES17.TSSatisfiesExpression) {
1307
1398
  return getArrayInitializer(init.expression);
1308
1399
  }
1309
1400
  return null;
1310
1401
  }
1311
- var jsxNoDataArray = createRule14({
1402
+ var jsxNoDataArray = createRule16({
1312
1403
  name: "jsx-no-data-array",
1313
1404
  meta: {
1314
1405
  type: "problem",
@@ -1337,7 +1428,7 @@ var jsxNoDataArray = createRule14({
1337
1428
  if (!hasObjectElement) {
1338
1429
  return;
1339
1430
  }
1340
- const name = node.id.type === AST_NODE_TYPES15.Identifier ? node.id.name : "<destructured>";
1431
+ const name = node.id.type === AST_NODE_TYPES17.Identifier ? node.id.name : "<destructured>";
1341
1432
  context.report({
1342
1433
  node,
1343
1434
  messageId: "noDataArray",
@@ -1353,7 +1444,7 @@ var jsxNoDataArray = createRule14({
1353
1444
  if (!hasObjectElement) {
1354
1445
  return;
1355
1446
  }
1356
- const name = node.id.type === AST_NODE_TYPES15.Identifier ? node.id.name : "<destructured>";
1447
+ const name = node.id.type === AST_NODE_TYPES17.Identifier ? node.id.name : "<destructured>";
1357
1448
  context.report({
1358
1449
  node,
1359
1450
  messageId: "noDataArray",
@@ -1366,15 +1457,15 @@ var jsxNoDataArray = createRule14({
1366
1457
  var jsx_no_data_array_default = jsxNoDataArray;
1367
1458
 
1368
1459
  // src/rules/jsx-no-data-object.ts
1369
- import { AST_NODE_TYPES as AST_NODE_TYPES16, ESLintUtils as ESLintUtils15 } from "@typescript-eslint/utils";
1370
- var createRule15 = ESLintUtils15.RuleCreator(
1460
+ import { AST_NODE_TYPES as AST_NODE_TYPES18, ESLintUtils as ESLintUtils17 } from "@typescript-eslint/utils";
1461
+ var createRule17 = ESLintUtils17.RuleCreator(
1371
1462
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1372
1463
  );
1373
1464
  function unwrapAssertion(node) {
1374
1465
  if (!node) {
1375
1466
  return null;
1376
1467
  }
1377
- if (node.type === AST_NODE_TYPES16.TSAsExpression || node.type === AST_NODE_TYPES16.TSSatisfiesExpression) {
1468
+ if (node.type === AST_NODE_TYPES18.TSAsExpression || node.type === AST_NODE_TYPES18.TSSatisfiesExpression) {
1378
1469
  return unwrapAssertion(node.expression);
1379
1470
  }
1380
1471
  return node;
@@ -1384,26 +1475,26 @@ function isNestedValue(value) {
1384
1475
  if (!unwrapped) {
1385
1476
  return false;
1386
1477
  }
1387
- if (unwrapped.type === AST_NODE_TYPES16.ObjectExpression) {
1478
+ if (unwrapped.type === AST_NODE_TYPES18.ObjectExpression) {
1388
1479
  return true;
1389
1480
  }
1390
- if (unwrapped.type === AST_NODE_TYPES16.ArrayExpression) {
1481
+ if (unwrapped.type === AST_NODE_TYPES18.ArrayExpression) {
1391
1482
  return unwrapped.elements.some((element) => {
1392
- if (!element || element.type === AST_NODE_TYPES16.SpreadElement) {
1483
+ if (!element || element.type === AST_NODE_TYPES18.SpreadElement) {
1393
1484
  return false;
1394
1485
  }
1395
1486
  const inner = unwrapAssertion(element);
1396
- return inner?.type === AST_NODE_TYPES16.ObjectExpression || inner?.type === AST_NODE_TYPES16.ArrayExpression;
1487
+ return inner?.type === AST_NODE_TYPES18.ObjectExpression || inner?.type === AST_NODE_TYPES18.ArrayExpression;
1397
1488
  });
1398
1489
  }
1399
1490
  return false;
1400
1491
  }
1401
1492
  function hasNestedProperty(object) {
1402
1493
  return object.properties.some((property) => {
1403
- if (property.type !== AST_NODE_TYPES16.Property) {
1494
+ if (property.type !== AST_NODE_TYPES18.Property) {
1404
1495
  return false;
1405
1496
  }
1406
- if (property.value.type === AST_NODE_TYPES16.AssignmentPattern) {
1497
+ if (property.value.type === AST_NODE_TYPES18.AssignmentPattern) {
1407
1498
  return false;
1408
1499
  }
1409
1500
  return isNestedValue(property.value);
@@ -1414,12 +1505,12 @@ function getObjectInitializer(init) {
1414
1505
  if (!unwrapped) {
1415
1506
  return null;
1416
1507
  }
1417
- if (unwrapped.type === AST_NODE_TYPES16.ObjectExpression) {
1508
+ if (unwrapped.type === AST_NODE_TYPES18.ObjectExpression) {
1418
1509
  return unwrapped;
1419
1510
  }
1420
1511
  return null;
1421
1512
  }
1422
- var jsxNoDataObject = createRule15({
1513
+ var jsxNoDataObject = createRule17({
1423
1514
  name: "jsx-no-data-object",
1424
1515
  meta: {
1425
1516
  type: "problem",
@@ -1446,7 +1537,7 @@ var jsxNoDataObject = createRule15({
1446
1537
  if (!hasNestedProperty(objectInit)) {
1447
1538
  return;
1448
1539
  }
1449
- const name = node.id.type === AST_NODE_TYPES16.Identifier ? node.id.name : "<destructured>";
1540
+ const name = node.id.type === AST_NODE_TYPES18.Identifier ? node.id.name : "<destructured>";
1450
1541
  context.report({
1451
1542
  node,
1452
1543
  messageId: "noDataObject",
@@ -1462,11 +1553,11 @@ var jsxNoDataObject = createRule15({
1462
1553
  var jsx_no_data_object_default = jsxNoDataObject;
1463
1554
 
1464
1555
  // src/rules/jsx-no-inline-object-prop.ts
1465
- import { AST_NODE_TYPES as AST_NODE_TYPES17, ESLintUtils as ESLintUtils16 } from "@typescript-eslint/utils";
1466
- var createRule16 = ESLintUtils16.RuleCreator(
1556
+ import { AST_NODE_TYPES as AST_NODE_TYPES19, ESLintUtils as ESLintUtils18 } from "@typescript-eslint/utils";
1557
+ var createRule18 = ESLintUtils18.RuleCreator(
1467
1558
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1468
1559
  );
1469
- var jsxNoInlineObjectProp = createRule16({
1560
+ var jsxNoInlineObjectProp = createRule18({
1470
1561
  name: "jsx-no-inline-object-prop",
1471
1562
  meta: {
1472
1563
  type: "suggestion",
@@ -1482,7 +1573,7 @@ var jsxNoInlineObjectProp = createRule16({
1482
1573
  create(context) {
1483
1574
  return {
1484
1575
  JSXAttribute(node) {
1485
- if (node.value?.type === AST_NODE_TYPES17.JSXExpressionContainer && node.value.expression.type === AST_NODE_TYPES17.ObjectExpression) {
1576
+ if (node.value?.type === AST_NODE_TYPES19.JSXExpressionContainer && node.value.expression.type === AST_NODE_TYPES19.ObjectExpression) {
1486
1577
  context.report({
1487
1578
  node: node.value,
1488
1579
  messageId: "noInlineObject"
@@ -1495,17 +1586,17 @@ var jsxNoInlineObjectProp = createRule16({
1495
1586
  var jsx_no_inline_object_prop_default = jsxNoInlineObjectProp;
1496
1587
 
1497
1588
  // src/rules/jsx-no-newline-single-line-elements.ts
1498
- import { AST_NODE_TYPES as AST_NODE_TYPES18, ESLintUtils as ESLintUtils17 } from "@typescript-eslint/utils";
1499
- var createRule17 = ESLintUtils17.RuleCreator(
1589
+ import { AST_NODE_TYPES as AST_NODE_TYPES20, ESLintUtils as ESLintUtils19 } from "@typescript-eslint/utils";
1590
+ var createRule19 = ESLintUtils19.RuleCreator(
1500
1591
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1501
1592
  );
1502
1593
  function isJSXElementOrFragment(node) {
1503
- return node.type === AST_NODE_TYPES18.JSXElement || node.type === AST_NODE_TYPES18.JSXFragment;
1594
+ return node.type === AST_NODE_TYPES20.JSXElement || node.type === AST_NODE_TYPES20.JSXFragment;
1504
1595
  }
1505
1596
  function isSingleLine(node) {
1506
1597
  return node.loc.start.line === node.loc.end.line;
1507
1598
  }
1508
- var jsxNoNewlineSingleLineElements = createRule17({
1599
+ var jsxNoNewlineSingleLineElements = createRule19({
1509
1600
  name: "jsx-no-newline-single-line-elements",
1510
1601
  meta: {
1511
1602
  type: "layout",
@@ -1523,7 +1614,7 @@ var jsxNoNewlineSingleLineElements = createRule17({
1523
1614
  const { sourceCode } = context;
1524
1615
  function checkSiblings(children) {
1525
1616
  const nonWhitespace = children.filter(
1526
- (child) => !(child.type === AST_NODE_TYPES18.JSXText && child.value.trim() === "")
1617
+ (child) => !(child.type === AST_NODE_TYPES20.JSXText && child.value.trim() === "")
1527
1618
  );
1528
1619
  nonWhitespace.forEach((next, index) => {
1529
1620
  if (index === 0) {
@@ -1574,11 +1665,11 @@ ${indent}`);
1574
1665
  var jsx_no_newline_single_line_elements_default = jsxNoNewlineSingleLineElements;
1575
1666
 
1576
1667
  // src/rules/jsx-no-non-component-function.ts
1577
- import { AST_NODE_TYPES as AST_NODE_TYPES19, ESLintUtils as ESLintUtils18 } from "@typescript-eslint/utils";
1578
- var createRule18 = ESLintUtils18.RuleCreator(
1668
+ import { AST_NODE_TYPES as AST_NODE_TYPES21, ESLintUtils as ESLintUtils20 } from "@typescript-eslint/utils";
1669
+ var createRule20 = ESLintUtils20.RuleCreator(
1579
1670
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1580
1671
  );
1581
- var jsxNoNonComponentFunction = createRule18({
1672
+ var jsxNoNonComponentFunction = createRule20({
1582
1673
  name: "jsx-no-non-component-function",
1583
1674
  meta: {
1584
1675
  type: "problem",
@@ -1598,13 +1689,13 @@ var jsxNoNonComponentFunction = createRule18({
1598
1689
  return {};
1599
1690
  }
1600
1691
  function isReactComponent2(node) {
1601
- const functionName = node.type === AST_NODE_TYPES19.FunctionDeclaration && node.id ? node.id.name : null;
1692
+ const functionName = node.type === AST_NODE_TYPES21.FunctionDeclaration && node.id ? node.id.name : null;
1602
1693
  if (functionName && /^[A-Z]/.test(functionName)) {
1603
1694
  return true;
1604
1695
  }
1605
1696
  if (node.returnType?.typeAnnotation) {
1606
1697
  const returnTypeNode = node.returnType.typeAnnotation;
1607
- if (returnTypeNode.type === AST_NODE_TYPES19.TSTypeReference && returnTypeNode.typeName.type === AST_NODE_TYPES19.Identifier) {
1698
+ if (returnTypeNode.type === AST_NODE_TYPES21.TSTypeReference && returnTypeNode.typeName.type === AST_NODE_TYPES21.Identifier) {
1608
1699
  const typeName = returnTypeNode.typeName.name;
1609
1700
  if (typeName === "JSX" || typeName === "ReactElement" || typeName === "ReactNode") {
1610
1701
  return true;
@@ -1621,13 +1712,13 @@ var jsxNoNonComponentFunction = createRule18({
1621
1712
  if (!parent) {
1622
1713
  return;
1623
1714
  }
1624
- if (parent.type === AST_NODE_TYPES19.ExportDefaultDeclaration || parent.type === AST_NODE_TYPES19.ExportNamedDeclaration) {
1715
+ if (parent.type === AST_NODE_TYPES21.ExportDefaultDeclaration || parent.type === AST_NODE_TYPES21.ExportNamedDeclaration) {
1625
1716
  return;
1626
1717
  }
1627
- if (declaratorNode?.parent?.parent?.type === AST_NODE_TYPES19.ExportNamedDeclaration) {
1718
+ if (declaratorNode?.parent?.parent?.type === AST_NODE_TYPES21.ExportNamedDeclaration) {
1628
1719
  return;
1629
1720
  }
1630
- if (declaratorNode?.id.type === AST_NODE_TYPES19.Identifier) {
1721
+ if (declaratorNode?.id.type === AST_NODE_TYPES21.Identifier) {
1631
1722
  const varName = declaratorNode.id.name;
1632
1723
  if (/^[A-Z]/.test(varName)) {
1633
1724
  return;
@@ -1652,13 +1743,13 @@ var jsxNoNonComponentFunction = createRule18({
1652
1743
  var jsx_no_non_component_function_default = jsxNoNonComponentFunction;
1653
1744
 
1654
1745
  // src/rules/jsx-no-sub-interface.ts
1655
- import { AST_NODE_TYPES as AST_NODE_TYPES20, ESLintUtils as ESLintUtils19 } from "@typescript-eslint/utils";
1656
- var createRule19 = ESLintUtils19.RuleCreator(
1746
+ import { AST_NODE_TYPES as AST_NODE_TYPES22, ESLintUtils as ESLintUtils21 } from "@typescript-eslint/utils";
1747
+ var createRule21 = ESLintUtils21.RuleCreator(
1657
1748
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1658
1749
  );
1659
1750
  var PROPS_WRAPPER_NAMES = /* @__PURE__ */ new Set(["Readonly", "Required", "Partial", "PropsWithChildren", "NoInfer"]);
1660
1751
  function unwrapWrapperType(node) {
1661
- if (node.type === AST_NODE_TYPES20.TSTypeReference && node.typeName.type === AST_NODE_TYPES20.Identifier && PROPS_WRAPPER_NAMES.has(node.typeName.name) && node.typeArguments && node.typeArguments.params.length > 0) {
1752
+ if (node.type === AST_NODE_TYPES22.TSTypeReference && node.typeName.type === AST_NODE_TYPES22.Identifier && PROPS_WRAPPER_NAMES.has(node.typeName.name) && node.typeArguments && node.typeArguments.params.length > 0) {
1662
1753
  return unwrapWrapperType(node.typeArguments.params[0]);
1663
1754
  }
1664
1755
  return node;
@@ -1668,7 +1759,7 @@ function getMainTypeName(typeNode) {
1668
1759
  return null;
1669
1760
  }
1670
1761
  const unwrapped = unwrapWrapperType(typeNode);
1671
- if (unwrapped.type === AST_NODE_TYPES20.TSTypeReference && unwrapped.typeName.type === AST_NODE_TYPES20.Identifier) {
1762
+ if (unwrapped.type === AST_NODE_TYPES22.TSTypeReference && unwrapped.typeName.type === AST_NODE_TYPES22.Identifier) {
1672
1763
  return unwrapped.typeName.name;
1673
1764
  }
1674
1765
  return null;
@@ -1687,15 +1778,15 @@ function isPascalCase2(name) {
1687
1778
  return /^[A-Z]/.test(name);
1688
1779
  }
1689
1780
  function getDeclarationFromExportWrapper(node) {
1690
- if (node.type === AST_NODE_TYPES20.ExportNamedDeclaration && node.declaration) {
1781
+ if (node.type === AST_NODE_TYPES22.ExportNamedDeclaration && node.declaration) {
1691
1782
  return node.declaration;
1692
1783
  }
1693
- if (node.type === AST_NODE_TYPES20.ExportDefaultDeclaration) {
1784
+ if (node.type === AST_NODE_TYPES22.ExportDefaultDeclaration) {
1694
1785
  return node.declaration;
1695
1786
  }
1696
1787
  return node;
1697
1788
  }
1698
- var jsxNoSubInterface = createRule19({
1789
+ var jsxNoSubInterface = createRule21({
1699
1790
  name: "jsx-no-sub-interface",
1700
1791
  meta: {
1701
1792
  type: "problem",
@@ -1721,7 +1812,7 @@ var jsxNoSubInterface = createRule19({
1721
1812
  let componentCount = 0;
1722
1813
  for (const statement of programNode.body) {
1723
1814
  const declaration = getDeclarationFromExportWrapper(statement);
1724
- if (declaration.type === AST_NODE_TYPES20.FunctionDeclaration && declaration.id && isPascalCase2(declaration.id.name)) {
1815
+ if (declaration.type === AST_NODE_TYPES22.FunctionDeclaration && declaration.id && isPascalCase2(declaration.id.name)) {
1725
1816
  componentCount += 1;
1726
1817
  const mainType = getComponentMainTypeName(declaration);
1727
1818
  if (mainType) {
@@ -1729,16 +1820,16 @@ var jsxNoSubInterface = createRule19({
1729
1820
  }
1730
1821
  continue;
1731
1822
  }
1732
- if (declaration.type === AST_NODE_TYPES20.VariableDeclaration) {
1823
+ if (declaration.type === AST_NODE_TYPES22.VariableDeclaration) {
1733
1824
  for (const declarator of declaration.declarations) {
1734
- if (declarator.id.type !== AST_NODE_TYPES20.Identifier) {
1825
+ if (declarator.id.type !== AST_NODE_TYPES22.Identifier) {
1735
1826
  continue;
1736
1827
  }
1737
1828
  if (!isPascalCase2(declarator.id.name)) {
1738
1829
  continue;
1739
1830
  }
1740
1831
  const init = declarator.init;
1741
- if (init && (init.type === AST_NODE_TYPES20.ArrowFunctionExpression || init.type === AST_NODE_TYPES20.FunctionExpression)) {
1832
+ if (init && (init.type === AST_NODE_TYPES22.ArrowFunctionExpression || init.type === AST_NODE_TYPES22.FunctionExpression)) {
1742
1833
  componentCount += 1;
1743
1834
  const mainType = getComponentMainTypeName(init);
1744
1835
  if (mainType) {
@@ -1748,11 +1839,11 @@ var jsxNoSubInterface = createRule19({
1748
1839
  }
1749
1840
  continue;
1750
1841
  }
1751
- if (declaration.type === AST_NODE_TYPES20.TSInterfaceDeclaration) {
1842
+ if (declaration.type === AST_NODE_TYPES22.TSInterfaceDeclaration) {
1752
1843
  typeDeclarations.push({ name: declaration.id.name, node: declaration });
1753
1844
  continue;
1754
1845
  }
1755
- if (declaration.type === AST_NODE_TYPES20.TSTypeAliasDeclaration) {
1846
+ if (declaration.type === AST_NODE_TYPES22.TSTypeAliasDeclaration) {
1756
1847
  typeDeclarations.push({ name: declaration.id.name, node: declaration });
1757
1848
  continue;
1758
1849
  }
@@ -1777,20 +1868,20 @@ var jsxNoSubInterface = createRule19({
1777
1868
  var jsx_no_sub_interface_default = jsxNoSubInterface;
1778
1869
 
1779
1870
  // src/rules/jsx-no-ternary-null.ts
1780
- import { AST_NODE_TYPES as AST_NODE_TYPES21, ESLintUtils as ESLintUtils20 } from "@typescript-eslint/utils";
1781
- var createRule20 = ESLintUtils20.RuleCreator(
1871
+ import { AST_NODE_TYPES as AST_NODE_TYPES23, ESLintUtils as ESLintUtils22 } from "@typescript-eslint/utils";
1872
+ var createRule22 = ESLintUtils22.RuleCreator(
1782
1873
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1783
1874
  );
1784
1875
  function isNullOrUndefined(node) {
1785
- if (node.type === AST_NODE_TYPES21.Literal && node.value === null) {
1876
+ if (node.type === AST_NODE_TYPES23.Literal && node.value === null) {
1786
1877
  return true;
1787
1878
  }
1788
- if (node.type === AST_NODE_TYPES21.Identifier && node.name === "undefined") {
1879
+ if (node.type === AST_NODE_TYPES23.Identifier && node.name === "undefined") {
1789
1880
  return true;
1790
1881
  }
1791
1882
  return false;
1792
1883
  }
1793
- var jsxNoTernaryNull = createRule20({
1884
+ var jsxNoTernaryNull = createRule22({
1794
1885
  name: "jsx-no-ternary-null",
1795
1886
  meta: {
1796
1887
  type: "suggestion",
@@ -1808,7 +1899,7 @@ var jsxNoTernaryNull = createRule20({
1808
1899
  return {
1809
1900
  JSXExpressionContainer(node) {
1810
1901
  const { expression } = node;
1811
- if (expression.type !== AST_NODE_TYPES21.ConditionalExpression) {
1902
+ if (expression.type !== AST_NODE_TYPES23.ConditionalExpression) {
1812
1903
  return;
1813
1904
  }
1814
1905
  const { test, consequent, alternate } = expression;
@@ -1840,11 +1931,11 @@ var jsxNoTernaryNull = createRule20({
1840
1931
  var jsx_no_ternary_null_default = jsxNoTernaryNull;
1841
1932
 
1842
1933
  // src/rules/jsx-no-variable-in-callback.ts
1843
- import { AST_NODE_TYPES as AST_NODE_TYPES22, ESLintUtils as ESLintUtils21 } from "@typescript-eslint/utils";
1844
- var createRule21 = ESLintUtils21.RuleCreator(
1934
+ import { AST_NODE_TYPES as AST_NODE_TYPES24, ESLintUtils as ESLintUtils23 } from "@typescript-eslint/utils";
1935
+ var createRule23 = ESLintUtils23.RuleCreator(
1845
1936
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1846
1937
  );
1847
- var jsxNoVariableInCallback = createRule21({
1938
+ var jsxNoVariableInCallback = createRule23({
1848
1939
  name: "jsx-no-variable-in-callback",
1849
1940
  meta: {
1850
1941
  type: "suggestion",
@@ -1861,7 +1952,7 @@ var jsxNoVariableInCallback = createRule21({
1861
1952
  function isInsideJSX(node) {
1862
1953
  let current = node.parent;
1863
1954
  while (current) {
1864
- if (current.type === AST_NODE_TYPES22.JSXElement || current.type === AST_NODE_TYPES22.JSXFragment) {
1955
+ if (current.type === AST_NODE_TYPES24.JSXElement || current.type === AST_NODE_TYPES24.JSXFragment) {
1865
1956
  return true;
1866
1957
  }
1867
1958
  current = current.parent;
@@ -1875,11 +1966,11 @@ var jsxNoVariableInCallback = createRule21({
1875
1966
  if (!isInsideJSX(node)) {
1876
1967
  return false;
1877
1968
  }
1878
- if (node.parent.type === AST_NODE_TYPES22.CallExpression || node.parent.type === AST_NODE_TYPES22.JSXExpressionContainer) {
1969
+ if (node.parent.type === AST_NODE_TYPES24.CallExpression || node.parent.type === AST_NODE_TYPES24.JSXExpressionContainer) {
1879
1970
  return true;
1880
1971
  }
1881
- if (node.parent.type === AST_NODE_TYPES22.ArrayExpression && node.parent.parent) {
1882
- if (node.parent.parent.type === AST_NODE_TYPES22.CallExpression || node.parent.parent.type === AST_NODE_TYPES22.JSXExpressionContainer) {
1972
+ if (node.parent.type === AST_NODE_TYPES24.ArrayExpression && node.parent.parent) {
1973
+ if (node.parent.parent.type === AST_NODE_TYPES24.CallExpression || node.parent.parent.type === AST_NODE_TYPES24.JSXExpressionContainer) {
1883
1974
  return true;
1884
1975
  }
1885
1976
  }
@@ -1890,11 +1981,11 @@ var jsxNoVariableInCallback = createRule21({
1890
1981
  return;
1891
1982
  }
1892
1983
  const { body } = node;
1893
- if (body.type !== AST_NODE_TYPES22.BlockStatement) {
1984
+ if (body.type !== AST_NODE_TYPES24.BlockStatement) {
1894
1985
  return;
1895
1986
  }
1896
1987
  body.body.forEach((statement) => {
1897
- if (statement.type === AST_NODE_TYPES22.VariableDeclaration) {
1988
+ if (statement.type === AST_NODE_TYPES24.VariableDeclaration) {
1898
1989
  context.report({
1899
1990
  node: statement,
1900
1991
  messageId: "noVariableInCallback"
@@ -1911,11 +2002,11 @@ var jsxNoVariableInCallback = createRule21({
1911
2002
  var jsx_no_variable_in_callback_default = jsxNoVariableInCallback;
1912
2003
 
1913
2004
  // src/rules/jsx-require-suspense.ts
1914
- import { AST_NODE_TYPES as AST_NODE_TYPES23, ESLintUtils as ESLintUtils22 } from "@typescript-eslint/utils";
1915
- var createRule22 = ESLintUtils22.RuleCreator(
2005
+ import { AST_NODE_TYPES as AST_NODE_TYPES25, ESLintUtils as ESLintUtils24 } from "@typescript-eslint/utils";
2006
+ var createRule24 = ESLintUtils24.RuleCreator(
1916
2007
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1917
2008
  );
1918
- var jsxRequireSuspense = createRule22({
2009
+ var jsxRequireSuspense = createRule24({
1919
2010
  name: "jsx-require-suspense",
1920
2011
  meta: {
1921
2012
  type: "problem",
@@ -1933,7 +2024,7 @@ var jsxRequireSuspense = createRule22({
1933
2024
  const isInsideSuspense = (node) => {
1934
2025
  let current = node.parent;
1935
2026
  while (current) {
1936
- if (current.type === AST_NODE_TYPES23.JSXElement && current.openingElement.name.type === AST_NODE_TYPES23.JSXIdentifier && current.openingElement.name.name === "Suspense") {
2027
+ if (current.type === AST_NODE_TYPES25.JSXElement && current.openingElement.name.type === AST_NODE_TYPES25.JSXIdentifier && current.openingElement.name.name === "Suspense") {
1937
2028
  return true;
1938
2029
  }
1939
2030
  current = current.parent;
@@ -1942,16 +2033,16 @@ var jsxRequireSuspense = createRule22({
1942
2033
  };
1943
2034
  return {
1944
2035
  VariableDeclarator(node) {
1945
- if (node.id.type === AST_NODE_TYPES23.Identifier && node.init?.type === AST_NODE_TYPES23.CallExpression) {
2036
+ if (node.id.type === AST_NODE_TYPES25.Identifier && node.init?.type === AST_NODE_TYPES25.CallExpression) {
1946
2037
  const { callee } = node.init;
1947
- const isLazyCall = callee.type === AST_NODE_TYPES23.Identifier && callee.name === "lazy" || callee.type === AST_NODE_TYPES23.MemberExpression && callee.object.type === AST_NODE_TYPES23.Identifier && callee.object.name === "React" && callee.property.type === AST_NODE_TYPES23.Identifier && callee.property.name === "lazy";
2038
+ const isLazyCall = callee.type === AST_NODE_TYPES25.Identifier && callee.name === "lazy" || callee.type === AST_NODE_TYPES25.MemberExpression && callee.object.type === AST_NODE_TYPES25.Identifier && callee.object.name === "React" && callee.property.type === AST_NODE_TYPES25.Identifier && callee.property.name === "lazy";
1948
2039
  if (isLazyCall) {
1949
2040
  lazyComponents.add(node.id.name);
1950
2041
  }
1951
2042
  }
1952
2043
  },
1953
2044
  JSXOpeningElement(node) {
1954
- if (node.name.type === AST_NODE_TYPES23.JSXIdentifier) {
2045
+ if (node.name.type === AST_NODE_TYPES25.JSXIdentifier) {
1955
2046
  const componentName = node.name.name;
1956
2047
  if (lazyComponents.has(componentName) && !isInsideSuspense(node)) {
1957
2048
  context.report({
@@ -1970,11 +2061,11 @@ var jsxRequireSuspense = createRule22({
1970
2061
  var jsx_require_suspense_default = jsxRequireSuspense;
1971
2062
 
1972
2063
  // src/rules/jsx-simple-props.ts
1973
- import { AST_NODE_TYPES as AST_NODE_TYPES24, ESLintUtils as ESLintUtils23 } from "@typescript-eslint/utils";
1974
- var createRule23 = ESLintUtils23.RuleCreator(
2064
+ import { AST_NODE_TYPES as AST_NODE_TYPES26, ESLintUtils as ESLintUtils25 } from "@typescript-eslint/utils";
2065
+ var createRule25 = ESLintUtils25.RuleCreator(
1975
2066
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1976
2067
  );
1977
- var jsxSimpleProps = createRule23({
2068
+ var jsxSimpleProps = createRule25({
1978
2069
  name: "jsx-simple-props",
1979
2070
  meta: {
1980
2071
  type: "suggestion",
@@ -1989,25 +2080,25 @@ var jsxSimpleProps = createRule23({
1989
2080
  defaultOptions: [],
1990
2081
  create(context) {
1991
2082
  const allowedExpressionTypes = /* @__PURE__ */ new Set([
1992
- AST_NODE_TYPES24.Identifier,
1993
- AST_NODE_TYPES24.Literal,
1994
- AST_NODE_TYPES24.JSXElement,
1995
- AST_NODE_TYPES24.JSXFragment,
1996
- AST_NODE_TYPES24.MemberExpression,
1997
- AST_NODE_TYPES24.ArrowFunctionExpression,
1998
- AST_NODE_TYPES24.FunctionExpression
2083
+ AST_NODE_TYPES26.Identifier,
2084
+ AST_NODE_TYPES26.Literal,
2085
+ AST_NODE_TYPES26.JSXElement,
2086
+ AST_NODE_TYPES26.JSXFragment,
2087
+ AST_NODE_TYPES26.MemberExpression,
2088
+ AST_NODE_TYPES26.ArrowFunctionExpression,
2089
+ AST_NODE_TYPES26.FunctionExpression
1999
2090
  ]);
2000
2091
  return {
2001
2092
  JSXAttribute(node) {
2002
2093
  if (!node.value) {
2003
2094
  return;
2004
2095
  }
2005
- if (node.value.type === AST_NODE_TYPES24.Literal) {
2096
+ if (node.value.type === AST_NODE_TYPES26.Literal) {
2006
2097
  return;
2007
2098
  }
2008
- if (node.value.type === AST_NODE_TYPES24.JSXExpressionContainer) {
2099
+ if (node.value.type === AST_NODE_TYPES26.JSXExpressionContainer) {
2009
2100
  const { expression } = node.value;
2010
- if (expression.type === AST_NODE_TYPES24.JSXEmptyExpression) {
2101
+ if (expression.type === AST_NODE_TYPES26.JSXEmptyExpression) {
2011
2102
  return;
2012
2103
  }
2013
2104
  if (!allowedExpressionTypes.has(expression.type)) {
@@ -2024,8 +2115,8 @@ var jsxSimpleProps = createRule23({
2024
2115
  var jsx_simple_props_default = jsxSimpleProps;
2025
2116
 
2026
2117
  // src/rules/jsx-sort-props.ts
2027
- import { AST_NODE_TYPES as AST_NODE_TYPES25, ESLintUtils as ESLintUtils24 } from "@typescript-eslint/utils";
2028
- var createRule24 = ESLintUtils24.RuleCreator(
2118
+ import { AST_NODE_TYPES as AST_NODE_TYPES27, ESLintUtils as ESLintUtils26 } from "@typescript-eslint/utils";
2119
+ var createRule26 = ESLintUtils26.RuleCreator(
2029
2120
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2030
2121
  );
2031
2122
  var TYPE_GROUP = {
@@ -2039,15 +2130,15 @@ var TYPE_GROUP = {
2039
2130
  SHORTHAND: 8
2040
2131
  };
2041
2132
  var EXPRESSION_TYPE_TO_GROUP = /* @__PURE__ */ new Map([
2042
- [AST_NODE_TYPES25.ObjectExpression, TYPE_GROUP.OBJECT_ARRAY],
2043
- [AST_NODE_TYPES25.ArrayExpression, TYPE_GROUP.OBJECT_ARRAY],
2044
- [AST_NODE_TYPES25.ArrowFunctionExpression, TYPE_GROUP.FUNCTION],
2045
- [AST_NODE_TYPES25.FunctionExpression, TYPE_GROUP.FUNCTION],
2046
- [AST_NODE_TYPES25.JSXElement, TYPE_GROUP.JSX],
2047
- [AST_NODE_TYPES25.JSXFragment, TYPE_GROUP.JSX]
2133
+ [AST_NODE_TYPES27.ObjectExpression, TYPE_GROUP.OBJECT_ARRAY],
2134
+ [AST_NODE_TYPES27.ArrayExpression, TYPE_GROUP.OBJECT_ARRAY],
2135
+ [AST_NODE_TYPES27.ArrowFunctionExpression, TYPE_GROUP.FUNCTION],
2136
+ [AST_NODE_TYPES27.FunctionExpression, TYPE_GROUP.FUNCTION],
2137
+ [AST_NODE_TYPES27.JSXElement, TYPE_GROUP.JSX],
2138
+ [AST_NODE_TYPES27.JSXFragment, TYPE_GROUP.JSX]
2048
2139
  ]);
2049
2140
  function isHyphenatedName(node) {
2050
- return node.name.type === AST_NODE_TYPES25.JSXIdentifier && node.name.name.includes("-");
2141
+ return node.name.type === AST_NODE_TYPES27.JSXIdentifier && node.name.name.includes("-");
2051
2142
  }
2052
2143
  function getStringGroup(node) {
2053
2144
  return isHyphenatedName(node) ? TYPE_GROUP.HYPHENATED_STRING : TYPE_GROUP.STRING;
@@ -2059,13 +2150,13 @@ function getLiteralValueGroup(value) {
2059
2150
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
2060
2151
  }
2061
2152
  function getExpressionGroup(expression) {
2062
- if (expression.type === AST_NODE_TYPES25.Literal) {
2153
+ if (expression.type === AST_NODE_TYPES27.Literal) {
2063
2154
  return getLiteralValueGroup(expression.value);
2064
2155
  }
2065
- if (expression.type === AST_NODE_TYPES25.TemplateLiteral) {
2156
+ if (expression.type === AST_NODE_TYPES27.TemplateLiteral) {
2066
2157
  return null;
2067
2158
  }
2068
- if (expression.type === AST_NODE_TYPES25.Identifier && expression.name === "undefined") {
2159
+ if (expression.type === AST_NODE_TYPES27.Identifier && expression.name === "undefined") {
2069
2160
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
2070
2161
  }
2071
2162
  return EXPRESSION_TYPE_TO_GROUP.get(expression.type) ?? TYPE_GROUP.EXPRESSION;
@@ -2074,17 +2165,17 @@ function getTypeGroup(node) {
2074
2165
  if (node.value === null) {
2075
2166
  return TYPE_GROUP.SHORTHAND;
2076
2167
  }
2077
- if (node.value.type === AST_NODE_TYPES25.Literal) {
2168
+ if (node.value.type === AST_NODE_TYPES27.Literal) {
2078
2169
  if (typeof node.value.value === "string") {
2079
2170
  return getStringGroup(node);
2080
2171
  }
2081
2172
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
2082
2173
  }
2083
- if (node.value.type !== AST_NODE_TYPES25.JSXExpressionContainer) {
2174
+ if (node.value.type !== AST_NODE_TYPES27.JSXExpressionContainer) {
2084
2175
  return null;
2085
2176
  }
2086
2177
  const { expression } = node.value;
2087
- if (expression.type === AST_NODE_TYPES25.JSXEmptyExpression) {
2178
+ if (expression.type === AST_NODE_TYPES27.JSXEmptyExpression) {
2088
2179
  return null;
2089
2180
  }
2090
2181
  const group = getExpressionGroup(expression);
@@ -2096,7 +2187,7 @@ function getTypeGroup(node) {
2096
2187
  function hasUnsortedProps(attributes) {
2097
2188
  let lastGroup = 0;
2098
2189
  return attributes.some((attribute) => {
2099
- if (attribute.type === AST_NODE_TYPES25.JSXSpreadAttribute) {
2190
+ if (attribute.type === AST_NODE_TYPES27.JSXSpreadAttribute) {
2100
2191
  lastGroup = 0;
2101
2192
  return false;
2102
2193
  }
@@ -2120,7 +2211,7 @@ function getSegments(attributes) {
2120
2211
  const result = [];
2121
2212
  let current = [];
2122
2213
  attributes.forEach((attr) => {
2123
- if (attr.type === AST_NODE_TYPES25.JSXSpreadAttribute) {
2214
+ if (attr.type === AST_NODE_TYPES27.JSXSpreadAttribute) {
2124
2215
  if (current.length > 0) {
2125
2216
  result.push(current);
2126
2217
  current = [];
@@ -2134,7 +2225,7 @@ function getSegments(attributes) {
2134
2225
  }
2135
2226
  return result;
2136
2227
  }
2137
- var jsxSortProps = createRule24({
2228
+ var jsxSortProps = createRule26({
2138
2229
  name: "jsx-sort-props",
2139
2230
  meta: {
2140
2231
  type: "suggestion",
@@ -2169,11 +2260,11 @@ var jsxSortProps = createRule24({
2169
2260
  var jsx_sort_props_default = jsxSortProps;
2170
2261
 
2171
2262
  // src/rules/jsx-spread-props-last.ts
2172
- import { AST_NODE_TYPES as AST_NODE_TYPES26, ESLintUtils as ESLintUtils25 } from "@typescript-eslint/utils";
2173
- var createRule25 = ESLintUtils25.RuleCreator(
2263
+ import { AST_NODE_TYPES as AST_NODE_TYPES28, ESLintUtils as ESLintUtils27 } from "@typescript-eslint/utils";
2264
+ var createRule27 = ESLintUtils27.RuleCreator(
2174
2265
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2175
2266
  );
2176
- var jsxSpreadPropsLast = createRule25({
2267
+ var jsxSpreadPropsLast = createRule27({
2177
2268
  name: "jsx-spread-props-last",
2178
2269
  meta: {
2179
2270
  type: "suggestion",
@@ -2192,12 +2283,12 @@ var jsxSpreadPropsLast = createRule25({
2192
2283
  const { attributes } = node;
2193
2284
  let lastNonSpreadIndex = -1;
2194
2285
  attributes.forEach((attribute, index) => {
2195
- if (attribute.type !== AST_NODE_TYPES26.JSXSpreadAttribute) {
2286
+ if (attribute.type !== AST_NODE_TYPES28.JSXSpreadAttribute) {
2196
2287
  lastNonSpreadIndex = index;
2197
2288
  }
2198
2289
  });
2199
2290
  attributes.forEach((attribute, index) => {
2200
- if (attribute.type === AST_NODE_TYPES26.JSXSpreadAttribute && index < lastNonSpreadIndex) {
2291
+ if (attribute.type === AST_NODE_TYPES28.JSXSpreadAttribute && index < lastNonSpreadIndex) {
2201
2292
  context.report({
2202
2293
  node: attribute,
2203
2294
  messageId: "spreadNotLast"
@@ -2211,12 +2302,12 @@ var jsxSpreadPropsLast = createRule25({
2211
2302
  var jsx_spread_props_last_default = jsxSpreadPropsLast;
2212
2303
 
2213
2304
  // src/rules/newline-after-multiline-block.ts
2214
- import { AST_NODE_TYPES as AST_NODE_TYPES27, ESLintUtils as ESLintUtils26 } from "@typescript-eslint/utils";
2215
- var createRule26 = ESLintUtils26.RuleCreator(
2305
+ import { AST_NODE_TYPES as AST_NODE_TYPES29, ESLintUtils as ESLintUtils28 } from "@typescript-eslint/utils";
2306
+ var createRule28 = ESLintUtils28.RuleCreator(
2216
2307
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2217
2308
  );
2218
2309
  function isImportDeclaration(node) {
2219
- return node.type === AST_NODE_TYPES27.ImportDeclaration;
2310
+ return node.type === AST_NODE_TYPES29.ImportDeclaration;
2220
2311
  }
2221
2312
  function checkStatements(statements, context) {
2222
2313
  const { sourceCode } = context;
@@ -2251,7 +2342,7 @@ function checkStatements(statements, context) {
2251
2342
  }
2252
2343
  });
2253
2344
  }
2254
- var newlineAfterMultilineBlock = createRule26({
2345
+ var newlineAfterMultilineBlock = createRule28({
2255
2346
  name: "newline-after-multiline-block",
2256
2347
  meta: {
2257
2348
  type: "layout",
@@ -2279,11 +2370,11 @@ var newlineAfterMultilineBlock = createRule26({
2279
2370
  var newline_after_multiline_block_default = newlineAfterMultilineBlock;
2280
2371
 
2281
2372
  // src/rules/newline-before-return.ts
2282
- import { AST_NODE_TYPES as AST_NODE_TYPES28, ESLintUtils as ESLintUtils27 } from "@typescript-eslint/utils";
2283
- var createRule27 = ESLintUtils27.RuleCreator(
2373
+ import { AST_NODE_TYPES as AST_NODE_TYPES30, ESLintUtils as ESLintUtils29 } from "@typescript-eslint/utils";
2374
+ var createRule29 = ESLintUtils29.RuleCreator(
2284
2375
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2285
2376
  );
2286
- var newlineBeforeReturn = createRule27({
2377
+ var newlineBeforeReturn = createRule29({
2287
2378
  name: "newline-before-return",
2288
2379
  meta: {
2289
2380
  type: "layout",
@@ -2301,7 +2392,7 @@ var newlineBeforeReturn = createRule27({
2301
2392
  const { sourceCode } = context;
2302
2393
  function checkReturnStatement(node) {
2303
2394
  const { parent } = node;
2304
- if (!parent || parent.type !== AST_NODE_TYPES28.BlockStatement) {
2395
+ if (!parent || parent.type !== AST_NODE_TYPES30.BlockStatement) {
2305
2396
  return;
2306
2397
  }
2307
2398
  const { body: statements } = parent;
@@ -2338,11 +2429,11 @@ var newlineBeforeReturn = createRule27({
2338
2429
  var newline_before_return_default = newlineBeforeReturn;
2339
2430
 
2340
2431
  // src/rules/no-complex-inline-return.ts
2341
- import { AST_NODE_TYPES as AST_NODE_TYPES29, ESLintUtils as ESLintUtils28 } from "@typescript-eslint/utils";
2342
- var createRule28 = ESLintUtils28.RuleCreator(
2432
+ import { AST_NODE_TYPES as AST_NODE_TYPES31, ESLintUtils as ESLintUtils30 } from "@typescript-eslint/utils";
2433
+ var createRule30 = ESLintUtils30.RuleCreator(
2343
2434
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2344
2435
  );
2345
- var noComplexInlineReturn = createRule28({
2436
+ var noComplexInlineReturn = createRule30({
2346
2437
  name: "no-complex-inline-return",
2347
2438
  meta: {
2348
2439
  type: "suggestion",
@@ -2358,13 +2449,13 @@ var noComplexInlineReturn = createRule28({
2358
2449
  create(context) {
2359
2450
  const isComplexExpression = (node) => {
2360
2451
  if (!node) return false;
2361
- if (node.type === AST_NODE_TYPES29.ConditionalExpression) {
2452
+ if (node.type === AST_NODE_TYPES31.ConditionalExpression) {
2362
2453
  return true;
2363
2454
  }
2364
- if (node.type === AST_NODE_TYPES29.LogicalExpression) {
2455
+ if (node.type === AST_NODE_TYPES31.LogicalExpression) {
2365
2456
  return true;
2366
2457
  }
2367
- if (node.type === AST_NODE_TYPES29.NewExpression) {
2458
+ if (node.type === AST_NODE_TYPES31.NewExpression) {
2368
2459
  return true;
2369
2460
  }
2370
2461
  return false;
@@ -2384,11 +2475,11 @@ var noComplexInlineReturn = createRule28({
2384
2475
  var no_complex_inline_return_default = noComplexInlineReturn;
2385
2476
 
2386
2477
  // src/rules/no-direct-date.ts
2387
- import { AST_NODE_TYPES as AST_NODE_TYPES30, ESLintUtils as ESLintUtils29 } from "@typescript-eslint/utils";
2388
- var createRule29 = ESLintUtils29.RuleCreator(
2478
+ import { AST_NODE_TYPES as AST_NODE_TYPES32, ESLintUtils as ESLintUtils31 } from "@typescript-eslint/utils";
2479
+ var createRule31 = ESLintUtils31.RuleCreator(
2389
2480
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2390
2481
  );
2391
- var noDirectDate = createRule29({
2482
+ var noDirectDate = createRule31({
2392
2483
  name: "no-direct-date",
2393
2484
  meta: {
2394
2485
  type: "problem",
@@ -2406,7 +2497,7 @@ var noDirectDate = createRule29({
2406
2497
  create(context) {
2407
2498
  return {
2408
2499
  NewExpression(node) {
2409
- if (node.callee.type === AST_NODE_TYPES30.Identifier && node.callee.name === "Date") {
2500
+ if (node.callee.type === AST_NODE_TYPES32.Identifier && node.callee.name === "Date") {
2410
2501
  context.report({
2411
2502
  node,
2412
2503
  messageId: "noNewDate"
@@ -2414,7 +2505,7 @@ var noDirectDate = createRule29({
2414
2505
  }
2415
2506
  },
2416
2507
  CallExpression(node) {
2417
- if (node.callee.type === AST_NODE_TYPES30.MemberExpression && node.callee.object.type === AST_NODE_TYPES30.Identifier && node.callee.object.name === "Date" && node.callee.property.type === AST_NODE_TYPES30.Identifier) {
2508
+ if (node.callee.type === AST_NODE_TYPES32.MemberExpression && node.callee.object.type === AST_NODE_TYPES32.Identifier && node.callee.object.name === "Date" && node.callee.property.type === AST_NODE_TYPES32.Identifier) {
2418
2509
  const methodName = node.callee.property.name;
2419
2510
  if (methodName === "now") {
2420
2511
  context.report({
@@ -2437,11 +2528,11 @@ var no_direct_date_default = noDirectDate;
2437
2528
 
2438
2529
  // src/rules/no-emoji.ts
2439
2530
  import emojiRegex from "emoji-regex";
2440
- import { ESLintUtils as ESLintUtils30 } from "@typescript-eslint/utils";
2441
- var createRule30 = ESLintUtils30.RuleCreator(
2531
+ import { ESLintUtils as ESLintUtils32 } from "@typescript-eslint/utils";
2532
+ var createRule32 = ESLintUtils32.RuleCreator(
2442
2533
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2443
2534
  );
2444
- var noEmoji = createRule30({
2535
+ var noEmoji = createRule32({
2445
2536
  name: "no-emoji",
2446
2537
  meta: {
2447
2538
  type: "problem",
@@ -2475,11 +2566,11 @@ var noEmoji = createRule30({
2475
2566
  var no_emoji_default = noEmoji;
2476
2567
 
2477
2568
  // src/rules/no-env-fallback.ts
2478
- import { AST_NODE_TYPES as AST_NODE_TYPES31, ESLintUtils as ESLintUtils31 } from "@typescript-eslint/utils";
2479
- var createRule31 = ESLintUtils31.RuleCreator(
2569
+ import { AST_NODE_TYPES as AST_NODE_TYPES33, ESLintUtils as ESLintUtils33 } from "@typescript-eslint/utils";
2570
+ var createRule33 = ESLintUtils33.RuleCreator(
2480
2571
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2481
2572
  );
2482
- var noEnvFallback = createRule31({
2573
+ var noEnvFallback = createRule33({
2483
2574
  name: "no-env-fallback",
2484
2575
  meta: {
2485
2576
  type: "problem",
@@ -2494,16 +2585,16 @@ var noEnvFallback = createRule31({
2494
2585
  defaultOptions: [],
2495
2586
  create(context) {
2496
2587
  const isProcessEnvAccess = (node) => {
2497
- if (node.type !== AST_NODE_TYPES31.MemberExpression) {
2588
+ if (node.type !== AST_NODE_TYPES33.MemberExpression) {
2498
2589
  return false;
2499
2590
  }
2500
2591
  const { object } = node;
2501
- if (object.type !== AST_NODE_TYPES31.MemberExpression) {
2592
+ if (object.type !== AST_NODE_TYPES33.MemberExpression) {
2502
2593
  return false;
2503
2594
  }
2504
2595
  const processNode = object.object;
2505
2596
  const envNode = object.property;
2506
- return processNode.type === AST_NODE_TYPES31.Identifier && processNode.name === "process" && envNode.type === AST_NODE_TYPES31.Identifier && envNode.name === "env";
2597
+ return processNode.type === AST_NODE_TYPES33.Identifier && processNode.name === "process" && envNode.type === AST_NODE_TYPES33.Identifier && envNode.name === "env";
2507
2598
  };
2508
2599
  return {
2509
2600
  LogicalExpression(node) {
@@ -2528,15 +2619,15 @@ var noEnvFallback = createRule31({
2528
2619
  var no_env_fallback_default = noEnvFallback;
2529
2620
 
2530
2621
  // src/rules/no-ghost-wrapper.ts
2531
- import { AST_NODE_TYPES as AST_NODE_TYPES32, ESLintUtils as ESLintUtils32 } from "@typescript-eslint/utils";
2532
- var createRule32 = ESLintUtils32.RuleCreator(
2622
+ import { AST_NODE_TYPES as AST_NODE_TYPES34, ESLintUtils as ESLintUtils34 } from "@typescript-eslint/utils";
2623
+ var createRule34 = ESLintUtils34.RuleCreator(
2533
2624
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2534
2625
  );
2535
2626
  var GHOST_TAGS = /* @__PURE__ */ new Set(["div", "span"]);
2536
2627
  function isKeyAttribute(attribute) {
2537
- return attribute.type === AST_NODE_TYPES32.JSXAttribute && attribute.name.type === AST_NODE_TYPES32.JSXIdentifier && attribute.name.name === "key";
2628
+ return attribute.type === AST_NODE_TYPES34.JSXAttribute && attribute.name.type === AST_NODE_TYPES34.JSXIdentifier && attribute.name.name === "key";
2538
2629
  }
2539
- var noGhostWrapper = createRule32({
2630
+ var noGhostWrapper = createRule34({
2540
2631
  name: "no-ghost-wrapper",
2541
2632
  meta: {
2542
2633
  type: "problem",
@@ -2552,7 +2643,7 @@ var noGhostWrapper = createRule32({
2552
2643
  create(context) {
2553
2644
  return {
2554
2645
  JSXOpeningElement(node) {
2555
- if (node.name.type !== AST_NODE_TYPES32.JSXIdentifier) {
2646
+ if (node.name.type !== AST_NODE_TYPES34.JSXIdentifier) {
2556
2647
  return;
2557
2648
  }
2558
2649
  const tagName = node.name.name;
@@ -2573,12 +2664,92 @@ var noGhostWrapper = createRule32({
2573
2664
  });
2574
2665
  var no_ghost_wrapper_default = noGhostWrapper;
2575
2666
 
2667
+ // src/rules/no-helper-function-in-hook.ts
2668
+ import { AST_NODE_TYPES as AST_NODE_TYPES35, ESLintUtils as ESLintUtils35 } from "@typescript-eslint/utils";
2669
+ var createRule35 = ESLintUtils35.RuleCreator(
2670
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2671
+ );
2672
+ var noHelperFunctionInHook = createRule35({
2673
+ name: "no-helper-function-in-hook",
2674
+ meta: {
2675
+ type: "suggestion",
2676
+ docs: {
2677
+ description: "Disallow non-hook helper function definitions in hook files"
2678
+ },
2679
+ messages: {
2680
+ noHelperFunction: "Helper functions must not be defined in hook files. Extract to a separate utility file."
2681
+ },
2682
+ schema: []
2683
+ },
2684
+ defaultOptions: [],
2685
+ create(context) {
2686
+ function isAtProgramLevel(node) {
2687
+ const { parent } = node;
2688
+ if (parent === void 0) return false;
2689
+ if (parent.type === AST_NODE_TYPES35.Program) return true;
2690
+ if (parent.type !== AST_NODE_TYPES35.ExportNamedDeclaration) return false;
2691
+ return parent.parent?.type === AST_NODE_TYPES35.Program;
2692
+ }
2693
+ return {
2694
+ FunctionDeclaration(node) {
2695
+ if (!isAtProgramLevel(node)) return;
2696
+ if (node.id !== null && node.id.name.startsWith("use")) return;
2697
+ context.report({ node, messageId: "noHelperFunction" });
2698
+ },
2699
+ VariableDeclarator(node) {
2700
+ if (node.parent.type !== AST_NODE_TYPES35.VariableDeclaration) return;
2701
+ if (!isAtProgramLevel(node.parent)) return;
2702
+ if (node.init === null || node.init.type !== AST_NODE_TYPES35.ArrowFunctionExpression && node.init.type !== AST_NODE_TYPES35.FunctionExpression)
2703
+ return;
2704
+ if (node.id.type === AST_NODE_TYPES35.Identifier && node.id.name.startsWith("use")) return;
2705
+ context.report({ node, messageId: "noHelperFunction" });
2706
+ }
2707
+ };
2708
+ }
2709
+ });
2710
+ var no_helper_function_in_hook_default = noHelperFunctionInHook;
2711
+
2712
+ // src/rules/no-helper-function-in-test.ts
2713
+ import { AST_NODE_TYPES as AST_NODE_TYPES36, ESLintUtils as ESLintUtils36 } from "@typescript-eslint/utils";
2714
+ var createRule36 = ESLintUtils36.RuleCreator(
2715
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2716
+ );
2717
+ var noHelperFunctionInTest = createRule36({
2718
+ name: "no-helper-function-in-test",
2719
+ meta: {
2720
+ type: "suggestion",
2721
+ docs: {
2722
+ description: "Disallow helper function definitions in test files"
2723
+ },
2724
+ messages: {
2725
+ noHelperFunction: "Helper functions must not be defined in test files. Extract to a separate utility file."
2726
+ },
2727
+ schema: []
2728
+ },
2729
+ defaultOptions: [],
2730
+ create(context) {
2731
+ return {
2732
+ FunctionDeclaration(node) {
2733
+ if (node.parent.type === AST_NODE_TYPES36.Program) {
2734
+ context.report({ node, messageId: "noHelperFunction" });
2735
+ }
2736
+ },
2737
+ VariableDeclarator(node) {
2738
+ if (node.parent.type === AST_NODE_TYPES36.VariableDeclaration && node.parent.parent.type === AST_NODE_TYPES36.Program && node.init !== null && (node.init.type === AST_NODE_TYPES36.ArrowFunctionExpression || node.init.type === AST_NODE_TYPES36.FunctionExpression)) {
2739
+ context.report({ node, messageId: "noHelperFunction" });
2740
+ }
2741
+ }
2742
+ };
2743
+ }
2744
+ });
2745
+ var no_helper_function_in_test_default = noHelperFunctionInTest;
2746
+
2576
2747
  // src/rules/no-inline-default-export.ts
2577
- import { AST_NODE_TYPES as AST_NODE_TYPES33, ESLintUtils as ESLintUtils33 } from "@typescript-eslint/utils";
2578
- var createRule33 = ESLintUtils33.RuleCreator(
2748
+ import { AST_NODE_TYPES as AST_NODE_TYPES37, ESLintUtils as ESLintUtils37 } from "@typescript-eslint/utils";
2749
+ var createRule37 = ESLintUtils37.RuleCreator(
2579
2750
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2580
2751
  );
2581
- var noInlineDefaultExport = createRule33({
2752
+ var noInlineDefaultExport = createRule37({
2582
2753
  name: "no-inline-default-export",
2583
2754
  meta: {
2584
2755
  type: "suggestion",
@@ -2597,7 +2768,7 @@ var noInlineDefaultExport = createRule33({
2597
2768
  return {
2598
2769
  ExportDefaultDeclaration(node) {
2599
2770
  const { declaration } = node;
2600
- if (declaration.type === AST_NODE_TYPES33.FunctionDeclaration) {
2771
+ if (declaration.type === AST_NODE_TYPES37.FunctionDeclaration) {
2601
2772
  if (declaration.id) {
2602
2773
  context.report({
2603
2774
  node,
@@ -2612,7 +2783,7 @@ var noInlineDefaultExport = createRule33({
2612
2783
  });
2613
2784
  }
2614
2785
  }
2615
- if (declaration.type === AST_NODE_TYPES33.ClassDeclaration) {
2786
+ if (declaration.type === AST_NODE_TYPES37.ClassDeclaration) {
2616
2787
  if (declaration.id) {
2617
2788
  context.report({
2618
2789
  node,
@@ -2627,7 +2798,7 @@ var noInlineDefaultExport = createRule33({
2627
2798
  });
2628
2799
  }
2629
2800
  }
2630
- if (declaration.type === AST_NODE_TYPES33.ArrowFunctionExpression || declaration.type === AST_NODE_TYPES33.FunctionExpression) {
2801
+ if (declaration.type === AST_NODE_TYPES37.ArrowFunctionExpression || declaration.type === AST_NODE_TYPES37.FunctionExpression) {
2631
2802
  context.report({
2632
2803
  node,
2633
2804
  messageId: "noAnonymousDefaultExport",
@@ -2640,14 +2811,14 @@ var noInlineDefaultExport = createRule33({
2640
2811
  if (!declaration) {
2641
2812
  return;
2642
2813
  }
2643
- if (declaration.type === AST_NODE_TYPES33.FunctionDeclaration && declaration.id) {
2814
+ if (declaration.type === AST_NODE_TYPES37.FunctionDeclaration && declaration.id) {
2644
2815
  context.report({
2645
2816
  node,
2646
2817
  messageId: "noInlineNamedExport",
2647
2818
  data: { type: "function", name: declaration.id.name }
2648
2819
  });
2649
2820
  }
2650
- if (declaration.type === AST_NODE_TYPES33.ClassDeclaration && declaration.id) {
2821
+ if (declaration.type === AST_NODE_TYPES37.ClassDeclaration && declaration.id) {
2651
2822
  context.report({
2652
2823
  node,
2653
2824
  messageId: "noInlineNamedExport",
@@ -2661,27 +2832,27 @@ var noInlineDefaultExport = createRule33({
2661
2832
  var no_inline_default_export_default = noInlineDefaultExport;
2662
2833
 
2663
2834
  // src/rules/no-inline-nested-object.ts
2664
- import { AST_NODE_TYPES as AST_NODE_TYPES34, ESLintUtils as ESLintUtils34 } from "@typescript-eslint/utils";
2665
- var createRule34 = ESLintUtils34.RuleCreator(
2835
+ import { AST_NODE_TYPES as AST_NODE_TYPES38, ESLintUtils as ESLintUtils38 } from "@typescript-eslint/utils";
2836
+ var createRule38 = ESLintUtils38.RuleCreator(
2666
2837
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2667
2838
  );
2668
2839
  function isObjectOrArray(node) {
2669
- return node.type === AST_NODE_TYPES34.ObjectExpression || node.type === AST_NODE_TYPES34.ArrayExpression || node.type === AST_NODE_TYPES34.TSAsExpression;
2840
+ return node.type === AST_NODE_TYPES38.ObjectExpression || node.type === AST_NODE_TYPES38.ArrayExpression || node.type === AST_NODE_TYPES38.TSAsExpression;
2670
2841
  }
2671
2842
  function getInnerExpression(node) {
2672
- if (node.type === AST_NODE_TYPES34.TSAsExpression) {
2843
+ if (node.type === AST_NODE_TYPES38.TSAsExpression) {
2673
2844
  return getInnerExpression(node.expression);
2674
2845
  }
2675
2846
  return node;
2676
2847
  }
2677
2848
  function isNestedStructure(node) {
2678
2849
  const inner = getInnerExpression(node);
2679
- return inner.type === AST_NODE_TYPES34.ObjectExpression || inner.type === AST_NODE_TYPES34.ArrayExpression;
2850
+ return inner.type === AST_NODE_TYPES38.ObjectExpression || inner.type === AST_NODE_TYPES38.ArrayExpression;
2680
2851
  }
2681
2852
  function containsNestedStructure(node) {
2682
- if (node.type === AST_NODE_TYPES34.ObjectExpression) {
2853
+ if (node.type === AST_NODE_TYPES38.ObjectExpression) {
2683
2854
  return node.properties.some((prop) => {
2684
- if (prop.type !== AST_NODE_TYPES34.Property) return false;
2855
+ if (prop.type !== AST_NODE_TYPES38.Property) return false;
2685
2856
  return isNestedStructure(prop.value);
2686
2857
  });
2687
2858
  }
@@ -2690,7 +2861,7 @@ function containsNestedStructure(node) {
2690
2861
  return isNestedStructure(el);
2691
2862
  });
2692
2863
  }
2693
- var noInlineNestedObject = createRule34({
2864
+ var noInlineNestedObject = createRule38({
2694
2865
  name: "no-inline-nested-object",
2695
2866
  meta: {
2696
2867
  type: "layout",
@@ -2712,7 +2883,7 @@ var noInlineNestedObject = createRule34({
2712
2883
  return;
2713
2884
  }
2714
2885
  const valueNode = getInnerExpression(node.value);
2715
- if (valueNode.type !== AST_NODE_TYPES34.ObjectExpression && valueNode.type !== AST_NODE_TYPES34.ArrayExpression) {
2886
+ if (valueNode.type !== AST_NODE_TYPES38.ObjectExpression && valueNode.type !== AST_NODE_TYPES38.ArrayExpression) {
2716
2887
  return;
2717
2888
  }
2718
2889
  if (!valueNode.loc) {
@@ -2725,7 +2896,7 @@ var noInlineNestedObject = createRule34({
2725
2896
  if (!containsNestedStructure(valueNode)) {
2726
2897
  return;
2727
2898
  }
2728
- const elements = valueNode.type === AST_NODE_TYPES34.ObjectExpression ? valueNode.properties : valueNode.elements;
2899
+ const elements = valueNode.type === AST_NODE_TYPES38.ObjectExpression ? valueNode.properties : valueNode.elements;
2729
2900
  context.report({
2730
2901
  node: valueNode,
2731
2902
  messageId: "requireMultiline",
@@ -2738,7 +2909,7 @@ var noInlineNestedObject = createRule34({
2738
2909
  const indent = " ".repeat(node.loc?.start.column ?? 0);
2739
2910
  const innerIndent = `${indent} `;
2740
2911
  const elementTexts = elements.filter((el) => el !== null).map((el) => sourceCode.getText(el));
2741
- const isObject = valueNode.type === AST_NODE_TYPES34.ObjectExpression;
2912
+ const isObject = valueNode.type === AST_NODE_TYPES38.ObjectExpression;
2742
2913
  const openChar = isObject ? "{" : "[";
2743
2914
  const closeChar = isObject ? "}" : "]";
2744
2915
  const formattedElements = elementTexts.map((text) => `${innerIndent}${text},`).join("\n");
@@ -2755,20 +2926,20 @@ ${indent}${closeChar}`;
2755
2926
  var no_inline_nested_object_default = noInlineNestedObject;
2756
2927
 
2757
2928
  // src/rules/no-inline-return-properties.ts
2758
- import { AST_NODE_TYPES as AST_NODE_TYPES35, ESLintUtils as ESLintUtils35 } from "@typescript-eslint/utils";
2759
- var createRule35 = ESLintUtils35.RuleCreator(
2929
+ import { AST_NODE_TYPES as AST_NODE_TYPES39, ESLintUtils as ESLintUtils39 } from "@typescript-eslint/utils";
2930
+ var createRule39 = ESLintUtils39.RuleCreator(
2760
2931
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2761
2932
  );
2762
2933
  var isShorthandProperty = (property) => {
2763
- if (property.type === AST_NODE_TYPES35.SpreadElement) {
2934
+ if (property.type === AST_NODE_TYPES39.SpreadElement) {
2764
2935
  return true;
2765
2936
  }
2766
- if (property.type !== AST_NODE_TYPES35.Property) {
2937
+ if (property.type !== AST_NODE_TYPES39.Property) {
2767
2938
  return false;
2768
2939
  }
2769
2940
  return property.shorthand;
2770
2941
  };
2771
- var noInlineReturnProperties = createRule35({
2942
+ var noInlineReturnProperties = createRule39({
2772
2943
  name: "no-inline-return-properties",
2773
2944
  meta: {
2774
2945
  type: "suggestion",
@@ -2784,20 +2955,20 @@ var noInlineReturnProperties = createRule35({
2784
2955
  create(context) {
2785
2956
  return {
2786
2957
  ReturnStatement(node) {
2787
- if (!node.argument || node.argument.type !== AST_NODE_TYPES35.ObjectExpression) {
2958
+ if (!node.argument || node.argument.type !== AST_NODE_TYPES39.ObjectExpression) {
2788
2959
  return;
2789
2960
  }
2790
2961
  node.argument.properties.forEach((property) => {
2791
2962
  if (isShorthandProperty(property)) {
2792
2963
  return;
2793
2964
  }
2794
- if (property.type !== AST_NODE_TYPES35.Property) {
2965
+ if (property.type !== AST_NODE_TYPES39.Property) {
2795
2966
  return;
2796
2967
  }
2797
2968
  let keyName = null;
2798
- if (property.key.type === AST_NODE_TYPES35.Identifier) {
2969
+ if (property.key.type === AST_NODE_TYPES39.Identifier) {
2799
2970
  keyName = property.key.name;
2800
- } else if (property.key.type === AST_NODE_TYPES35.Literal) {
2971
+ } else if (property.key.type === AST_NODE_TYPES39.Literal) {
2801
2972
  keyName = String(property.key.value);
2802
2973
  }
2803
2974
  context.report({
@@ -2813,12 +2984,12 @@ var noInlineReturnProperties = createRule35({
2813
2984
  var no_inline_return_properties_default = noInlineReturnProperties;
2814
2985
 
2815
2986
  // src/rules/no-inline-type-import.ts
2816
- import { AST_NODE_TYPES as AST_NODE_TYPES36, ESLintUtils as ESLintUtils36 } from "@typescript-eslint/utils";
2817
- var createRule36 = ESLintUtils36.RuleCreator(
2987
+ import { AST_NODE_TYPES as AST_NODE_TYPES40, ESLintUtils as ESLintUtils40 } from "@typescript-eslint/utils";
2988
+ var createRule40 = ESLintUtils40.RuleCreator(
2818
2989
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2819
2990
  );
2820
- var isInlineTypeSpecifier = (specifier) => specifier.type === AST_NODE_TYPES36.ImportSpecifier && specifier.importKind === "type";
2821
- var noInlineTypeImport = createRule36({
2991
+ var isInlineTypeSpecifier = (specifier) => specifier.type === AST_NODE_TYPES40.ImportSpecifier && specifier.importKind === "type";
2992
+ var noInlineTypeImport = createRule40({
2822
2993
  name: "no-inline-type-import",
2823
2994
  meta: {
2824
2995
  type: "suggestion",
@@ -2855,7 +3026,7 @@ var noInlineTypeImport = createRule36({
2855
3026
  );
2856
3027
  const typeImport = `import type { ${typeSpecifierTexts.join(", ")} } from ${sourceText};`;
2857
3028
  const valueSpecifiers = node.specifiers.filter(
2858
- (specifier) => !(specifier.type === AST_NODE_TYPES36.ImportSpecifier && specifier.importKind === "type")
3029
+ (specifier) => !(specifier.type === AST_NODE_TYPES40.ImportSpecifier && specifier.importKind === "type")
2859
3030
  );
2860
3031
  if (valueSpecifiers.length === 0) {
2861
3032
  return fixer.replaceText(node, typeImport);
@@ -2863,11 +3034,11 @@ var noInlineTypeImport = createRule36({
2863
3034
  const parts = [];
2864
3035
  const namedValueSpecifiers = [];
2865
3036
  for (const specifier of valueSpecifiers) {
2866
- if (specifier.type === AST_NODE_TYPES36.ImportDefaultSpecifier) {
3037
+ if (specifier.type === AST_NODE_TYPES40.ImportDefaultSpecifier) {
2867
3038
  parts.push(specifier.local.name);
2868
- } else if (specifier.type === AST_NODE_TYPES36.ImportNamespaceSpecifier) {
3039
+ } else if (specifier.type === AST_NODE_TYPES40.ImportNamespaceSpecifier) {
2869
3040
  parts.push(`* as ${specifier.local.name}`);
2870
- } else if (specifier.type === AST_NODE_TYPES36.ImportSpecifier) {
3041
+ } else if (specifier.type === AST_NODE_TYPES40.ImportSpecifier) {
2871
3042
  namedValueSpecifiers.push(specifier);
2872
3043
  }
2873
3044
  }
@@ -2887,8 +3058,8 @@ ${typeImport}`);
2887
3058
  var no_inline_type_import_default = noInlineTypeImport;
2888
3059
 
2889
3060
  // src/rules/no-lazy-identifiers.ts
2890
- import { AST_NODE_TYPES as AST_NODE_TYPES37, ESLintUtils as ESLintUtils37 } from "@typescript-eslint/utils";
2891
- var createRule37 = ESLintUtils37.RuleCreator(
3061
+ import { AST_NODE_TYPES as AST_NODE_TYPES41, ESLintUtils as ESLintUtils41 } from "@typescript-eslint/utils";
3062
+ var createRule41 = ESLintUtils41.RuleCreator(
2892
3063
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2893
3064
  );
2894
3065
  var KEYBOARD_ROWS = ["qwertyuiop", "asdfghjkl", "zxcvbnm", "1234567890"];
@@ -2929,7 +3100,7 @@ var isLazyIdentifier = (name) => {
2929
3100
  }
2930
3101
  return false;
2931
3102
  };
2932
- var noLazyIdentifiers = createRule37({
3103
+ var noLazyIdentifiers = createRule41({
2933
3104
  name: "no-lazy-identifiers",
2934
3105
  meta: {
2935
3106
  type: "problem",
@@ -2955,27 +3126,27 @@ var noLazyIdentifiers = createRule37({
2955
3126
  });
2956
3127
  };
2957
3128
  const checkPattern = (pattern) => {
2958
- if (pattern.type === AST_NODE_TYPES37.Identifier) {
3129
+ if (pattern.type === AST_NODE_TYPES41.Identifier) {
2959
3130
  checkIdentifier(pattern);
2960
- } else if (pattern.type === AST_NODE_TYPES37.ObjectPattern) {
3131
+ } else if (pattern.type === AST_NODE_TYPES41.ObjectPattern) {
2961
3132
  pattern.properties.forEach((prop) => {
2962
- if (prop.type === AST_NODE_TYPES37.Property && prop.value.type === AST_NODE_TYPES37.Identifier) {
3133
+ if (prop.type === AST_NODE_TYPES41.Property && prop.value.type === AST_NODE_TYPES41.Identifier) {
2963
3134
  checkIdentifier(prop.value);
2964
- } else if (prop.type === AST_NODE_TYPES37.RestElement && prop.argument.type === AST_NODE_TYPES37.Identifier) {
3135
+ } else if (prop.type === AST_NODE_TYPES41.RestElement && prop.argument.type === AST_NODE_TYPES41.Identifier) {
2965
3136
  checkIdentifier(prop.argument);
2966
3137
  }
2967
3138
  });
2968
- } else if (pattern.type === AST_NODE_TYPES37.ArrayPattern) {
3139
+ } else if (pattern.type === AST_NODE_TYPES41.ArrayPattern) {
2969
3140
  pattern.elements.forEach((element) => {
2970
- if (element?.type === AST_NODE_TYPES37.Identifier) {
3141
+ if (element?.type === AST_NODE_TYPES41.Identifier) {
2971
3142
  checkIdentifier(element);
2972
- } else if (element?.type === AST_NODE_TYPES37.RestElement && element.argument.type === AST_NODE_TYPES37.Identifier) {
3143
+ } else if (element?.type === AST_NODE_TYPES41.RestElement && element.argument.type === AST_NODE_TYPES41.Identifier) {
2973
3144
  checkIdentifier(element.argument);
2974
3145
  }
2975
3146
  });
2976
- } else if (pattern.type === AST_NODE_TYPES37.AssignmentPattern && pattern.left.type === AST_NODE_TYPES37.Identifier) {
3147
+ } else if (pattern.type === AST_NODE_TYPES41.AssignmentPattern && pattern.left.type === AST_NODE_TYPES41.Identifier) {
2977
3148
  checkIdentifier(pattern.left);
2978
- } else if (pattern.type === AST_NODE_TYPES37.RestElement && pattern.argument.type === AST_NODE_TYPES37.Identifier) {
3149
+ } else if (pattern.type === AST_NODE_TYPES41.RestElement && pattern.argument.type === AST_NODE_TYPES41.Identifier) {
2979
3150
  checkIdentifier(pattern.argument);
2980
3151
  }
2981
3152
  };
@@ -3020,11 +3191,11 @@ var noLazyIdentifiers = createRule37({
3020
3191
  var no_lazy_identifiers_default = noLazyIdentifiers;
3021
3192
 
3022
3193
  // src/rules/no-logic-in-params.ts
3023
- import { AST_NODE_TYPES as AST_NODE_TYPES38, ESLintUtils as ESLintUtils38 } from "@typescript-eslint/utils";
3024
- var createRule38 = ESLintUtils38.RuleCreator(
3194
+ import { AST_NODE_TYPES as AST_NODE_TYPES42, ESLintUtils as ESLintUtils42 } from "@typescript-eslint/utils";
3195
+ var createRule42 = ESLintUtils42.RuleCreator(
3025
3196
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3026
3197
  );
3027
- var noLogicInParams = createRule38({
3198
+ var noLogicInParams = createRule42({
3028
3199
  name: "no-logic-in-params",
3029
3200
  meta: {
3030
3201
  type: "suggestion",
@@ -3039,20 +3210,20 @@ var noLogicInParams = createRule38({
3039
3210
  defaultOptions: [],
3040
3211
  create(context) {
3041
3212
  const isComplexExpression = (node) => {
3042
- if (node.type === AST_NODE_TYPES38.SpreadElement) {
3213
+ if (node.type === AST_NODE_TYPES42.SpreadElement) {
3043
3214
  return false;
3044
3215
  }
3045
- if (node.type === AST_NODE_TYPES38.ConditionalExpression) {
3216
+ if (node.type === AST_NODE_TYPES42.ConditionalExpression) {
3046
3217
  return true;
3047
3218
  }
3048
- if (node.type === AST_NODE_TYPES38.LogicalExpression) {
3219
+ if (node.type === AST_NODE_TYPES42.LogicalExpression) {
3049
3220
  return true;
3050
3221
  }
3051
- if (node.type === AST_NODE_TYPES38.BinaryExpression) {
3222
+ if (node.type === AST_NODE_TYPES42.BinaryExpression) {
3052
3223
  const logicalOperators = ["==", "===", "!=", "!==", "<", ">", "<=", ">=", "in", "instanceof"];
3053
3224
  return logicalOperators.includes(node.operator);
3054
3225
  }
3055
- if (node.type === AST_NODE_TYPES38.UnaryExpression) {
3226
+ if (node.type === AST_NODE_TYPES42.UnaryExpression) {
3056
3227
  return node.operator === "!";
3057
3228
  }
3058
3229
  return false;
@@ -3065,7 +3236,7 @@ var noLogicInParams = createRule38({
3065
3236
  messageId: "noLogicInParams"
3066
3237
  });
3067
3238
  }
3068
- if (arg.type === AST_NODE_TYPES38.ArrayExpression) {
3239
+ if (arg.type === AST_NODE_TYPES42.ArrayExpression) {
3069
3240
  arg.elements.forEach((element) => {
3070
3241
  if (element && isComplexExpression(element)) {
3071
3242
  context.report({
@@ -3090,46 +3261,46 @@ var noLogicInParams = createRule38({
3090
3261
  var no_logic_in_params_default = noLogicInParams;
3091
3262
 
3092
3263
  // src/rules/no-misleading-constant-case.ts
3093
- import { AST_NODE_TYPES as AST_NODE_TYPES39, ESLintUtils as ESLintUtils39 } from "@typescript-eslint/utils";
3094
- var createRule39 = ESLintUtils39.RuleCreator(
3264
+ import { AST_NODE_TYPES as AST_NODE_TYPES43, ESLintUtils as ESLintUtils43 } from "@typescript-eslint/utils";
3265
+ var createRule43 = ESLintUtils43.RuleCreator(
3095
3266
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3096
3267
  );
3097
3268
  var SCREAMING_SNAKE_CASE_REGEX3 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
3098
- var isAsConstAssertion = (node) => node.type === AST_NODE_TYPES39.TSAsExpression && node.typeAnnotation.type === AST_NODE_TYPES39.TSTypeReference && node.typeAnnotation.typeName.type === AST_NODE_TYPES39.Identifier && node.typeAnnotation.typeName.name === "const";
3269
+ var isAsConstAssertion = (node) => node.type === AST_NODE_TYPES43.TSAsExpression && node.typeAnnotation.type === AST_NODE_TYPES43.TSTypeReference && node.typeAnnotation.typeName.type === AST_NODE_TYPES43.Identifier && node.typeAnnotation.typeName.name === "const";
3099
3270
  var isStaticValue2 = (init) => {
3100
3271
  if (isAsConstAssertion(init)) {
3101
3272
  return true;
3102
3273
  }
3103
- if (init.type === AST_NODE_TYPES39.Literal) {
3274
+ if (init.type === AST_NODE_TYPES43.Literal) {
3104
3275
  return true;
3105
3276
  }
3106
- if (init.type === AST_NODE_TYPES39.UnaryExpression && init.argument.type === AST_NODE_TYPES39.Literal) {
3277
+ if (init.type === AST_NODE_TYPES43.UnaryExpression && init.argument.type === AST_NODE_TYPES43.Literal) {
3107
3278
  return true;
3108
3279
  }
3109
- if (init.type === AST_NODE_TYPES39.TemplateLiteral && init.expressions.length === 0) {
3280
+ if (init.type === AST_NODE_TYPES43.TemplateLiteral && init.expressions.length === 0) {
3110
3281
  return true;
3111
3282
  }
3112
- if (init.type === AST_NODE_TYPES39.ArrayExpression) {
3113
- return init.elements.every((el) => el !== null && el.type !== AST_NODE_TYPES39.SpreadElement && isStaticValue2(el));
3283
+ if (init.type === AST_NODE_TYPES43.ArrayExpression) {
3284
+ return init.elements.every((el) => el !== null && el.type !== AST_NODE_TYPES43.SpreadElement && isStaticValue2(el));
3114
3285
  }
3115
- if (init.type === AST_NODE_TYPES39.ObjectExpression) {
3286
+ if (init.type === AST_NODE_TYPES43.ObjectExpression) {
3116
3287
  return init.properties.every(
3117
- (prop) => prop.type === AST_NODE_TYPES39.Property && isStaticValue2(prop.value)
3288
+ (prop) => prop.type === AST_NODE_TYPES43.Property && isStaticValue2(prop.value)
3118
3289
  );
3119
3290
  }
3120
3291
  return false;
3121
3292
  };
3122
3293
  var isGlobalScope3 = (node) => {
3123
3294
  const { parent } = node;
3124
- if (parent.type === AST_NODE_TYPES39.Program) {
3295
+ if (parent.type === AST_NODE_TYPES43.Program) {
3125
3296
  return true;
3126
3297
  }
3127
- if (parent.type === AST_NODE_TYPES39.ExportNamedDeclaration && parent.parent?.type === AST_NODE_TYPES39.Program) {
3298
+ if (parent.type === AST_NODE_TYPES43.ExportNamedDeclaration && parent.parent?.type === AST_NODE_TYPES43.Program) {
3128
3299
  return true;
3129
3300
  }
3130
3301
  return false;
3131
3302
  };
3132
- var noMisleadingConstantCase = createRule39({
3303
+ var noMisleadingConstantCase = createRule43({
3133
3304
  name: "no-misleading-constant-case",
3134
3305
  meta: {
3135
3306
  type: "suggestion",
@@ -3148,7 +3319,7 @@ var noMisleadingConstantCase = createRule39({
3148
3319
  return {
3149
3320
  VariableDeclaration(node) {
3150
3321
  node.declarations.forEach((declarator) => {
3151
- if (declarator.id.type !== AST_NODE_TYPES39.Identifier) {
3322
+ if (declarator.id.type !== AST_NODE_TYPES43.Identifier) {
3152
3323
  return;
3153
3324
  }
3154
3325
  const { name } = declarator.id;
@@ -3189,11 +3360,11 @@ var noMisleadingConstantCase = createRule39({
3189
3360
  var no_misleading_constant_case_default = noMisleadingConstantCase;
3190
3361
 
3191
3362
  // src/rules/no-nested-interface-declaration.ts
3192
- import { AST_NODE_TYPES as AST_NODE_TYPES40, ESLintUtils as ESLintUtils40 } from "@typescript-eslint/utils";
3193
- var createRule40 = ESLintUtils40.RuleCreator(
3363
+ import { AST_NODE_TYPES as AST_NODE_TYPES44, ESLintUtils as ESLintUtils44 } from "@typescript-eslint/utils";
3364
+ var createRule44 = ESLintUtils44.RuleCreator(
3194
3365
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3195
3366
  );
3196
- var noNestedInterfaceDeclaration = createRule40({
3367
+ var noNestedInterfaceDeclaration = createRule44({
3197
3368
  name: "no-nested-interface-declaration",
3198
3369
  meta: {
3199
3370
  type: "suggestion",
@@ -3214,15 +3385,15 @@ var noNestedInterfaceDeclaration = createRule40({
3214
3385
  return;
3215
3386
  }
3216
3387
  const { typeAnnotation } = node.typeAnnotation;
3217
- if (typeAnnotation.type === AST_NODE_TYPES40.TSTypeLiteral) {
3388
+ if (typeAnnotation.type === AST_NODE_TYPES44.TSTypeLiteral) {
3218
3389
  context.report({
3219
3390
  node: typeAnnotation,
3220
3391
  messageId: "noNestedInterface"
3221
3392
  });
3222
3393
  return;
3223
3394
  }
3224
- if (typeAnnotation.type === AST_NODE_TYPES40.TSArrayType) {
3225
- if (typeAnnotation.elementType.type === AST_NODE_TYPES40.TSTypeLiteral) {
3395
+ if (typeAnnotation.type === AST_NODE_TYPES44.TSArrayType) {
3396
+ if (typeAnnotation.elementType.type === AST_NODE_TYPES44.TSTypeLiteral) {
3226
3397
  context.report({
3227
3398
  node: typeAnnotation.elementType,
3228
3399
  messageId: "noNestedInterface"
@@ -3230,9 +3401,9 @@ var noNestedInterfaceDeclaration = createRule40({
3230
3401
  }
3231
3402
  return;
3232
3403
  }
3233
- if (typeAnnotation.type === AST_NODE_TYPES40.TSTypeReference && typeAnnotation.typeArguments) {
3404
+ if (typeAnnotation.type === AST_NODE_TYPES44.TSTypeReference && typeAnnotation.typeArguments) {
3234
3405
  typeAnnotation.typeArguments.params.forEach((param) => {
3235
- if (param.type === AST_NODE_TYPES40.TSTypeLiteral) {
3406
+ if (param.type === AST_NODE_TYPES44.TSTypeLiteral) {
3236
3407
  context.report({
3237
3408
  node: param,
3238
3409
  messageId: "noNestedInterface"
@@ -3247,11 +3418,11 @@ var noNestedInterfaceDeclaration = createRule40({
3247
3418
  var no_nested_interface_declaration_default = noNestedInterfaceDeclaration;
3248
3419
 
3249
3420
  // src/rules/no-nested-ternary.ts
3250
- import { AST_NODE_TYPES as AST_NODE_TYPES41, ESLintUtils as ESLintUtils41 } from "@typescript-eslint/utils";
3251
- var createRule41 = ESLintUtils41.RuleCreator(
3421
+ import { AST_NODE_TYPES as AST_NODE_TYPES45, ESLintUtils as ESLintUtils45 } from "@typescript-eslint/utils";
3422
+ var createRule45 = ESLintUtils45.RuleCreator(
3252
3423
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3253
3424
  );
3254
- var noNestedTernary = createRule41({
3425
+ var noNestedTernary = createRule45({
3255
3426
  name: "no-nested-ternary",
3256
3427
  meta: {
3257
3428
  type: "suggestion",
@@ -3268,13 +3439,13 @@ var noNestedTernary = createRule41({
3268
3439
  return {
3269
3440
  ConditionalExpression(node) {
3270
3441
  const { consequent, alternate } = node;
3271
- if (consequent.type === AST_NODE_TYPES41.ConditionalExpression) {
3442
+ if (consequent.type === AST_NODE_TYPES45.ConditionalExpression) {
3272
3443
  context.report({
3273
3444
  node: consequent,
3274
3445
  messageId: "noNestedTernary"
3275
3446
  });
3276
3447
  }
3277
- if (alternate.type === AST_NODE_TYPES41.ConditionalExpression) {
3448
+ if (alternate.type === AST_NODE_TYPES45.ConditionalExpression) {
3278
3449
  context.report({
3279
3450
  node: alternate,
3280
3451
  messageId: "noNestedTernary"
@@ -3287,33 +3458,33 @@ var noNestedTernary = createRule41({
3287
3458
  var no_nested_ternary_default = noNestedTernary;
3288
3459
 
3289
3460
  // src/rules/no-redundant-fragment.ts
3290
- import { AST_NODE_TYPES as AST_NODE_TYPES42, ESLintUtils as ESLintUtils42 } from "@typescript-eslint/utils";
3291
- var createRule42 = ESLintUtils42.RuleCreator(
3461
+ import { AST_NODE_TYPES as AST_NODE_TYPES46, ESLintUtils as ESLintUtils46 } from "@typescript-eslint/utils";
3462
+ var createRule46 = ESLintUtils46.RuleCreator(
3292
3463
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3293
3464
  );
3294
3465
  function isFragmentName(name) {
3295
- if (name.type === AST_NODE_TYPES42.JSXIdentifier && name.name === "Fragment") {
3466
+ if (name.type === AST_NODE_TYPES46.JSXIdentifier && name.name === "Fragment") {
3296
3467
  return true;
3297
3468
  }
3298
- if (name.type === AST_NODE_TYPES42.JSXMemberExpression && name.object.type === AST_NODE_TYPES42.JSXIdentifier && name.object.name === "React" && name.property.type === AST_NODE_TYPES42.JSXIdentifier && name.property.name === "Fragment") {
3469
+ if (name.type === AST_NODE_TYPES46.JSXMemberExpression && name.object.type === AST_NODE_TYPES46.JSXIdentifier && name.object.name === "React" && name.property.type === AST_NODE_TYPES46.JSXIdentifier && name.property.name === "Fragment") {
3299
3470
  return true;
3300
3471
  }
3301
3472
  return false;
3302
3473
  }
3303
3474
  function hasKeyAttribute(attributes) {
3304
3475
  return attributes.some(
3305
- (attribute) => attribute.type === AST_NODE_TYPES42.JSXAttribute && attribute.name.type === AST_NODE_TYPES42.JSXIdentifier && attribute.name.name === "key"
3476
+ (attribute) => attribute.type === AST_NODE_TYPES46.JSXAttribute && attribute.name.type === AST_NODE_TYPES46.JSXIdentifier && attribute.name.name === "key"
3306
3477
  );
3307
3478
  }
3308
3479
  function countMeaningfulChildren(children) {
3309
3480
  return children.filter((child) => {
3310
- if (child.type === AST_NODE_TYPES42.JSXText) {
3481
+ if (child.type === AST_NODE_TYPES46.JSXText) {
3311
3482
  return child.value.trim() !== "";
3312
3483
  }
3313
3484
  return true;
3314
3485
  }).length;
3315
3486
  }
3316
- var noRedundantFragment = createRule42({
3487
+ var noRedundantFragment = createRule46({
3317
3488
  name: "no-redundant-fragment",
3318
3489
  meta: {
3319
3490
  type: "problem",
@@ -3361,11 +3532,11 @@ var noRedundantFragment = createRule42({
3361
3532
  var no_redundant_fragment_default = noRedundantFragment;
3362
3533
 
3363
3534
  // src/rules/no-relative-imports.ts
3364
- import { AST_NODE_TYPES as AST_NODE_TYPES43, ESLintUtils as ESLintUtils43 } from "@typescript-eslint/utils";
3365
- var createRule43 = ESLintUtils43.RuleCreator(
3535
+ import { AST_NODE_TYPES as AST_NODE_TYPES47, ESLintUtils as ESLintUtils47 } from "@typescript-eslint/utils";
3536
+ var createRule47 = ESLintUtils47.RuleCreator(
3366
3537
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3367
3538
  );
3368
- var noRelativeImports = createRule43({
3539
+ var noRelativeImports = createRule47({
3369
3540
  name: "no-relative-imports",
3370
3541
  meta: {
3371
3542
  type: "suggestion",
@@ -3389,22 +3560,22 @@ var noRelativeImports = createRule43({
3389
3560
  };
3390
3561
  return {
3391
3562
  ImportDeclaration(node) {
3392
- if (node.source.type === AST_NODE_TYPES43.Literal && typeof node.source.value === "string") {
3563
+ if (node.source.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
3393
3564
  checkImportPath(node.source.value, node);
3394
3565
  }
3395
3566
  },
3396
3567
  ImportExpression(node) {
3397
- if (node.source.type === AST_NODE_TYPES43.Literal && typeof node.source.value === "string") {
3568
+ if (node.source.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
3398
3569
  checkImportPath(node.source.value, node);
3399
3570
  }
3400
3571
  },
3401
3572
  ExportNamedDeclaration(node) {
3402
- if (node.source?.type === AST_NODE_TYPES43.Literal && typeof node.source.value === "string") {
3573
+ if (node.source?.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
3403
3574
  checkImportPath(node.source.value, node);
3404
3575
  }
3405
3576
  },
3406
3577
  ExportAllDeclaration(node) {
3407
- if (node.source.type === AST_NODE_TYPES43.Literal && typeof node.source.value === "string") {
3578
+ if (node.source.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
3408
3579
  checkImportPath(node.source.value, node);
3409
3580
  }
3410
3581
  }
@@ -3414,8 +3585,8 @@ var noRelativeImports = createRule43({
3414
3585
  var no_relative_imports_default = noRelativeImports;
3415
3586
 
3416
3587
  // src/rules/no-single-char-variables.ts
3417
- import { AST_NODE_TYPES as AST_NODE_TYPES44, ESLintUtils as ESLintUtils44 } from "@typescript-eslint/utils";
3418
- var createRule44 = ESLintUtils44.RuleCreator(
3588
+ import { AST_NODE_TYPES as AST_NODE_TYPES48, ESLintUtils as ESLintUtils48 } from "@typescript-eslint/utils";
3589
+ var createRule48 = ESLintUtils48.RuleCreator(
3419
3590
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3420
3591
  );
3421
3592
  var ALLOWED_IN_FOR_LOOPS = /* @__PURE__ */ new Set(["i", "j", "k", "n"]);
@@ -3427,7 +3598,7 @@ var isForLoopInit = (node) => {
3427
3598
  if (!parentNode) {
3428
3599
  return false;
3429
3600
  }
3430
- if (parentNode.type === AST_NODE_TYPES44.ForStatement) {
3601
+ if (parentNode.type === AST_NODE_TYPES48.ForStatement) {
3431
3602
  const { init } = parentNode;
3432
3603
  if (init && init === current) {
3433
3604
  return true;
@@ -3446,7 +3617,7 @@ var isAllowedInContext = (name, node) => {
3446
3617
  }
3447
3618
  return false;
3448
3619
  };
3449
- var noSingleCharVariables = createRule44({
3620
+ var noSingleCharVariables = createRule48({
3450
3621
  name: "no-single-char-variables",
3451
3622
  meta: {
3452
3623
  type: "suggestion",
@@ -3475,27 +3646,27 @@ var noSingleCharVariables = createRule44({
3475
3646
  });
3476
3647
  };
3477
3648
  const checkPattern = (pattern, declarationNode) => {
3478
- if (pattern.type === AST_NODE_TYPES44.Identifier) {
3649
+ if (pattern.type === AST_NODE_TYPES48.Identifier) {
3479
3650
  checkIdentifier(pattern, declarationNode);
3480
- } else if (pattern.type === AST_NODE_TYPES44.ObjectPattern) {
3651
+ } else if (pattern.type === AST_NODE_TYPES48.ObjectPattern) {
3481
3652
  pattern.properties.forEach((prop) => {
3482
- if (prop.type === AST_NODE_TYPES44.Property && prop.value.type === AST_NODE_TYPES44.Identifier) {
3653
+ if (prop.type === AST_NODE_TYPES48.Property && prop.value.type === AST_NODE_TYPES48.Identifier) {
3483
3654
  checkIdentifier(prop.value, declarationNode);
3484
- } else if (prop.type === AST_NODE_TYPES44.RestElement && prop.argument.type === AST_NODE_TYPES44.Identifier) {
3655
+ } else if (prop.type === AST_NODE_TYPES48.RestElement && prop.argument.type === AST_NODE_TYPES48.Identifier) {
3485
3656
  checkIdentifier(prop.argument, declarationNode);
3486
3657
  }
3487
3658
  });
3488
- } else if (pattern.type === AST_NODE_TYPES44.ArrayPattern) {
3659
+ } else if (pattern.type === AST_NODE_TYPES48.ArrayPattern) {
3489
3660
  pattern.elements.forEach((element) => {
3490
- if (element?.type === AST_NODE_TYPES44.Identifier) {
3661
+ if (element?.type === AST_NODE_TYPES48.Identifier) {
3491
3662
  checkIdentifier(element, declarationNode);
3492
- } else if (element?.type === AST_NODE_TYPES44.RestElement && element.argument.type === AST_NODE_TYPES44.Identifier) {
3663
+ } else if (element?.type === AST_NODE_TYPES48.RestElement && element.argument.type === AST_NODE_TYPES48.Identifier) {
3493
3664
  checkIdentifier(element.argument, declarationNode);
3494
3665
  }
3495
3666
  });
3496
- } else if (pattern.type === AST_NODE_TYPES44.AssignmentPattern && pattern.left.type === AST_NODE_TYPES44.Identifier) {
3667
+ } else if (pattern.type === AST_NODE_TYPES48.AssignmentPattern && pattern.left.type === AST_NODE_TYPES48.Identifier) {
3497
3668
  checkIdentifier(pattern.left, declarationNode);
3498
- } else if (pattern.type === AST_NODE_TYPES44.RestElement && pattern.argument.type === AST_NODE_TYPES44.Identifier) {
3669
+ } else if (pattern.type === AST_NODE_TYPES48.RestElement && pattern.argument.type === AST_NODE_TYPES48.Identifier) {
3499
3670
  checkIdentifier(pattern.argument, declarationNode);
3500
3671
  }
3501
3672
  };
@@ -3529,11 +3700,11 @@ var noSingleCharVariables = createRule44({
3529
3700
  var no_single_char_variables_default = noSingleCharVariables;
3530
3701
 
3531
3702
  // src/rules/prefer-async-await.ts
3532
- import { AST_NODE_TYPES as AST_NODE_TYPES45, ESLintUtils as ESLintUtils45 } from "@typescript-eslint/utils";
3533
- var createRule45 = ESLintUtils45.RuleCreator(
3703
+ import { AST_NODE_TYPES as AST_NODE_TYPES49, ESLintUtils as ESLintUtils49 } from "@typescript-eslint/utils";
3704
+ var createRule49 = ESLintUtils49.RuleCreator(
3534
3705
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3535
3706
  );
3536
- var preferAsyncAwait = createRule45({
3707
+ var preferAsyncAwait = createRule49({
3537
3708
  name: "prefer-async-await",
3538
3709
  meta: {
3539
3710
  type: "suggestion",
@@ -3549,7 +3720,7 @@ var preferAsyncAwait = createRule45({
3549
3720
  create(context) {
3550
3721
  return {
3551
3722
  CallExpression(node) {
3552
- if (node.callee.type === AST_NODE_TYPES45.MemberExpression && node.callee.property.type === AST_NODE_TYPES45.Identifier && node.callee.property.name === "then") {
3723
+ if (node.callee.type === AST_NODE_TYPES49.MemberExpression && node.callee.property.type === AST_NODE_TYPES49.Identifier && node.callee.property.name === "then") {
3553
3724
  context.report({
3554
3725
  node: node.callee.property,
3555
3726
  messageId: "preferAsyncAwait"
@@ -3562,11 +3733,11 @@ var preferAsyncAwait = createRule45({
3562
3733
  var prefer_async_await_default = preferAsyncAwait;
3563
3734
 
3564
3735
  // src/rules/prefer-destructuring-params.ts
3565
- import { AST_NODE_TYPES as AST_NODE_TYPES46, ESLintUtils as ESLintUtils46 } from "@typescript-eslint/utils";
3566
- var createRule46 = ESLintUtils46.RuleCreator(
3736
+ import { AST_NODE_TYPES as AST_NODE_TYPES50, ESLintUtils as ESLintUtils50 } from "@typescript-eslint/utils";
3737
+ var createRule50 = ESLintUtils50.RuleCreator(
3567
3738
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3568
3739
  );
3569
- var preferDestructuringParams = createRule46({
3740
+ var preferDestructuringParams = createRule50({
3570
3741
  name: "prefer-destructuring-params",
3571
3742
  meta: {
3572
3743
  type: "suggestion",
@@ -3582,18 +3753,18 @@ var preferDestructuringParams = createRule46({
3582
3753
  create(context) {
3583
3754
  const isCallbackFunction2 = (node) => {
3584
3755
  const { parent } = node;
3585
- return parent?.type === AST_NODE_TYPES46.CallExpression;
3756
+ return parent?.type === AST_NODE_TYPES50.CallExpression;
3586
3757
  };
3587
3758
  const isDeveloperFunction = (node) => {
3588
- if (node.type === AST_NODE_TYPES46.FunctionDeclaration) {
3759
+ if (node.type === AST_NODE_TYPES50.FunctionDeclaration) {
3589
3760
  return true;
3590
3761
  }
3591
- if (node.type === AST_NODE_TYPES46.FunctionExpression || node.type === AST_NODE_TYPES46.ArrowFunctionExpression) {
3762
+ if (node.type === AST_NODE_TYPES50.FunctionExpression || node.type === AST_NODE_TYPES50.ArrowFunctionExpression) {
3592
3763
  if (isCallbackFunction2(node)) {
3593
3764
  return false;
3594
3765
  }
3595
3766
  const { parent } = node;
3596
- return parent?.type === AST_NODE_TYPES46.VariableDeclarator || parent?.type === AST_NODE_TYPES46.AssignmentExpression || parent?.type === AST_NODE_TYPES46.Property || parent?.type === AST_NODE_TYPES46.MethodDefinition;
3767
+ return parent?.type === AST_NODE_TYPES50.VariableDeclarator || parent?.type === AST_NODE_TYPES50.AssignmentExpression || parent?.type === AST_NODE_TYPES50.Property || parent?.type === AST_NODE_TYPES50.MethodDefinition;
3597
3768
  }
3598
3769
  return false;
3599
3770
  };
@@ -3605,7 +3776,7 @@ var preferDestructuringParams = createRule46({
3605
3776
  if (!isDeveloperFunction(node)) {
3606
3777
  return;
3607
3778
  }
3608
- if (node.type === AST_NODE_TYPES46.FunctionDeclaration && node.id) {
3779
+ if (node.type === AST_NODE_TYPES50.FunctionDeclaration && node.id) {
3609
3780
  const functionName = node.id.name;
3610
3781
  if (functionName.startsWith("_") || functionName.includes("$") || /^[A-Z][a-zA-Z]*$/.test(functionName)) {
3611
3782
  return;
@@ -3615,7 +3786,7 @@ var preferDestructuringParams = createRule46({
3615
3786
  return;
3616
3787
  }
3617
3788
  const hasNonDestructuredParams = node.params.some(
3618
- (param) => param.type !== AST_NODE_TYPES46.ObjectPattern && param.type !== AST_NODE_TYPES46.RestElement
3789
+ (param) => param.type !== AST_NODE_TYPES50.ObjectPattern && param.type !== AST_NODE_TYPES50.RestElement
3619
3790
  );
3620
3791
  if (hasNonDestructuredParams) {
3621
3792
  context.report({
@@ -3634,8 +3805,8 @@ var preferDestructuringParams = createRule46({
3634
3805
  var prefer_destructuring_params_default = preferDestructuringParams;
3635
3806
 
3636
3807
  // src/rules/prefer-function-declaration.ts
3637
- import { AST_NODE_TYPES as AST_NODE_TYPES47, ESLintUtils as ESLintUtils47 } from "@typescript-eslint/utils";
3638
- var createRule47 = ESLintUtils47.RuleCreator(
3808
+ import { AST_NODE_TYPES as AST_NODE_TYPES51, ESLintUtils as ESLintUtils51 } from "@typescript-eslint/utils";
3809
+ var createRule51 = ESLintUtils51.RuleCreator(
3639
3810
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3640
3811
  );
3641
3812
  var isTsFile = (filename) => filename.endsWith(".ts") && !filename.endsWith(".d.ts");
@@ -3644,33 +3815,33 @@ var isCallbackContext = (node) => {
3644
3815
  if (!parent) {
3645
3816
  return false;
3646
3817
  }
3647
- if (parent.type === AST_NODE_TYPES47.CallExpression && parent.arguments.includes(node)) {
3818
+ if (parent.type === AST_NODE_TYPES51.CallExpression && parent.arguments.includes(node)) {
3648
3819
  return true;
3649
3820
  }
3650
- if (parent.type === AST_NODE_TYPES47.NewExpression && parent.arguments.includes(node)) {
3821
+ if (parent.type === AST_NODE_TYPES51.NewExpression && parent.arguments.includes(node)) {
3651
3822
  return true;
3652
3823
  }
3653
- if (parent.type === AST_NODE_TYPES47.ReturnStatement) {
3824
+ if (parent.type === AST_NODE_TYPES51.ReturnStatement) {
3654
3825
  return true;
3655
3826
  }
3656
- if (parent.type === AST_NODE_TYPES47.Property) {
3827
+ if (parent.type === AST_NODE_TYPES51.Property) {
3657
3828
  return true;
3658
3829
  }
3659
- if (parent.type === AST_NODE_TYPES47.ArrayExpression) {
3830
+ if (parent.type === AST_NODE_TYPES51.ArrayExpression) {
3660
3831
  return true;
3661
3832
  }
3662
- if (parent.type === AST_NODE_TYPES47.ConditionalExpression) {
3833
+ if (parent.type === AST_NODE_TYPES51.ConditionalExpression) {
3663
3834
  return true;
3664
3835
  }
3665
- if (parent.type === AST_NODE_TYPES47.LogicalExpression) {
3836
+ if (parent.type === AST_NODE_TYPES51.LogicalExpression) {
3666
3837
  return true;
3667
3838
  }
3668
- if (parent.type === AST_NODE_TYPES47.AssignmentExpression && parent.left !== node) {
3839
+ if (parent.type === AST_NODE_TYPES51.AssignmentExpression && parent.left !== node) {
3669
3840
  return true;
3670
3841
  }
3671
3842
  return false;
3672
3843
  };
3673
- var preferFunctionDeclaration = createRule47({
3844
+ var preferFunctionDeclaration = createRule51({
3674
3845
  name: "prefer-function-declaration",
3675
3846
  meta: {
3676
3847
  type: "suggestion",
@@ -3691,14 +3862,14 @@ var preferFunctionDeclaration = createRule47({
3691
3862
  }
3692
3863
  return {
3693
3864
  VariableDeclarator(node) {
3694
- if (node.id.type !== AST_NODE_TYPES47.Identifier) {
3865
+ if (node.id.type !== AST_NODE_TYPES51.Identifier) {
3695
3866
  return;
3696
3867
  }
3697
3868
  const { init } = node;
3698
3869
  if (!init) {
3699
3870
  return;
3700
3871
  }
3701
- if (init.type === AST_NODE_TYPES47.ArrowFunctionExpression) {
3872
+ if (init.type === AST_NODE_TYPES51.ArrowFunctionExpression) {
3702
3873
  if (isCallbackContext(init)) {
3703
3874
  return;
3704
3875
  }
@@ -3708,7 +3879,7 @@ var preferFunctionDeclaration = createRule47({
3708
3879
  data: { name: node.id.name }
3709
3880
  });
3710
3881
  }
3711
- if (init.type === AST_NODE_TYPES47.FunctionExpression) {
3882
+ if (init.type === AST_NODE_TYPES51.FunctionExpression) {
3712
3883
  if (isCallbackContext(init)) {
3713
3884
  return;
3714
3885
  }
@@ -3725,11 +3896,11 @@ var preferFunctionDeclaration = createRule47({
3725
3896
  var prefer_function_declaration_default = preferFunctionDeclaration;
3726
3897
 
3727
3898
  // src/rules/prefer-guard-clause.ts
3728
- import { AST_NODE_TYPES as AST_NODE_TYPES48, ESLintUtils as ESLintUtils48 } from "@typescript-eslint/utils";
3729
- var createRule48 = ESLintUtils48.RuleCreator(
3899
+ import { AST_NODE_TYPES as AST_NODE_TYPES52, ESLintUtils as ESLintUtils52 } from "@typescript-eslint/utils";
3900
+ var createRule52 = ESLintUtils52.RuleCreator(
3730
3901
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3731
3902
  );
3732
- var preferGuardClause = createRule48({
3903
+ var preferGuardClause = createRule52({
3733
3904
  name: "prefer-guard-clause",
3734
3905
  meta: {
3735
3906
  type: "suggestion",
@@ -3746,8 +3917,8 @@ var preferGuardClause = createRule48({
3746
3917
  return {
3747
3918
  IfStatement(node) {
3748
3919
  const { consequent } = node;
3749
- if (consequent.type === AST_NODE_TYPES48.BlockStatement) {
3750
- const hasNestedIf = consequent.body.some((statement) => statement.type === AST_NODE_TYPES48.IfStatement);
3920
+ if (consequent.type === AST_NODE_TYPES52.BlockStatement) {
3921
+ const hasNestedIf = consequent.body.some((statement) => statement.type === AST_NODE_TYPES52.IfStatement);
3751
3922
  if (hasNestedIf && consequent.body.length === 1) {
3752
3923
  context.report({
3753
3924
  node,
@@ -3755,7 +3926,7 @@ var preferGuardClause = createRule48({
3755
3926
  });
3756
3927
  }
3757
3928
  }
3758
- if (consequent.type === AST_NODE_TYPES48.IfStatement) {
3929
+ if (consequent.type === AST_NODE_TYPES52.IfStatement) {
3759
3930
  context.report({
3760
3931
  node,
3761
3932
  messageId: "preferGuardClause"
@@ -3768,11 +3939,11 @@ var preferGuardClause = createRule48({
3768
3939
  var prefer_guard_clause_default = preferGuardClause;
3769
3940
 
3770
3941
  // src/rules/prefer-import-type.ts
3771
- import { AST_NODE_TYPES as AST_NODE_TYPES49, ESLintUtils as ESLintUtils49 } from "@typescript-eslint/utils";
3772
- var createRule49 = ESLintUtils49.RuleCreator(
3942
+ import { AST_NODE_TYPES as AST_NODE_TYPES53, ESLintUtils as ESLintUtils53 } from "@typescript-eslint/utils";
3943
+ var createRule53 = ESLintUtils53.RuleCreator(
3773
3944
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3774
3945
  );
3775
- var preferImportType = createRule49({
3946
+ var preferImportType = createRule53({
3776
3947
  name: "prefer-import-type",
3777
3948
  meta: {
3778
3949
  type: "suggestion",
@@ -3791,22 +3962,22 @@ var preferImportType = createRule49({
3791
3962
  let current = node;
3792
3963
  while (current) {
3793
3964
  switch (current.type) {
3794
- case AST_NODE_TYPES49.TSTypeReference:
3795
- case AST_NODE_TYPES49.TSTypeAnnotation:
3796
- case AST_NODE_TYPES49.TSTypeParameterInstantiation:
3797
- case AST_NODE_TYPES49.TSInterfaceHeritage:
3798
- case AST_NODE_TYPES49.TSClassImplements:
3799
- case AST_NODE_TYPES49.TSTypeQuery:
3800
- case AST_NODE_TYPES49.TSTypeAssertion:
3801
- case AST_NODE_TYPES49.TSAsExpression:
3802
- case AST_NODE_TYPES49.TSSatisfiesExpression:
3803
- case AST_NODE_TYPES49.TSTypeAliasDeclaration:
3804
- case AST_NODE_TYPES49.TSInterfaceDeclaration:
3805
- case AST_NODE_TYPES49.TSTypeParameter:
3806
- case AST_NODE_TYPES49.TSQualifiedName:
3965
+ case AST_NODE_TYPES53.TSTypeReference:
3966
+ case AST_NODE_TYPES53.TSTypeAnnotation:
3967
+ case AST_NODE_TYPES53.TSTypeParameterInstantiation:
3968
+ case AST_NODE_TYPES53.TSInterfaceHeritage:
3969
+ case AST_NODE_TYPES53.TSClassImplements:
3970
+ case AST_NODE_TYPES53.TSTypeQuery:
3971
+ case AST_NODE_TYPES53.TSTypeAssertion:
3972
+ case AST_NODE_TYPES53.TSAsExpression:
3973
+ case AST_NODE_TYPES53.TSSatisfiesExpression:
3974
+ case AST_NODE_TYPES53.TSTypeAliasDeclaration:
3975
+ case AST_NODE_TYPES53.TSInterfaceDeclaration:
3976
+ case AST_NODE_TYPES53.TSTypeParameter:
3977
+ case AST_NODE_TYPES53.TSQualifiedName:
3807
3978
  return true;
3808
- case AST_NODE_TYPES49.MemberExpression:
3809
- case AST_NODE_TYPES49.Identifier:
3979
+ case AST_NODE_TYPES53.MemberExpression:
3980
+ case AST_NODE_TYPES53.Identifier:
3810
3981
  current = current.parent;
3811
3982
  break;
3812
3983
  default:
@@ -3836,27 +4007,27 @@ var preferImportType = createRule49({
3836
4007
  return false;
3837
4008
  }
3838
4009
  switch (parent.type) {
3839
- case AST_NODE_TYPES49.CallExpression:
3840
- case AST_NODE_TYPES49.NewExpression:
3841
- case AST_NODE_TYPES49.JSXOpeningElement:
3842
- case AST_NODE_TYPES49.JSXClosingElement:
3843
- case AST_NODE_TYPES49.MemberExpression:
3844
- case AST_NODE_TYPES49.VariableDeclarator:
3845
- case AST_NODE_TYPES49.TaggedTemplateExpression:
3846
- case AST_NODE_TYPES49.SpreadElement:
3847
- case AST_NODE_TYPES49.ExportSpecifier:
3848
- case AST_NODE_TYPES49.ArrayExpression:
3849
- case AST_NODE_TYPES49.ObjectExpression:
3850
- case AST_NODE_TYPES49.BinaryExpression:
3851
- case AST_NODE_TYPES49.LogicalExpression:
3852
- case AST_NODE_TYPES49.UnaryExpression:
3853
- case AST_NODE_TYPES49.ReturnStatement:
3854
- case AST_NODE_TYPES49.ArrowFunctionExpression:
3855
- case AST_NODE_TYPES49.ConditionalExpression:
3856
- case AST_NODE_TYPES49.AwaitExpression:
3857
- case AST_NODE_TYPES49.YieldExpression:
3858
- case AST_NODE_TYPES49.Property:
3859
- case AST_NODE_TYPES49.JSXExpressionContainer:
4010
+ case AST_NODE_TYPES53.CallExpression:
4011
+ case AST_NODE_TYPES53.NewExpression:
4012
+ case AST_NODE_TYPES53.JSXOpeningElement:
4013
+ case AST_NODE_TYPES53.JSXClosingElement:
4014
+ case AST_NODE_TYPES53.MemberExpression:
4015
+ case AST_NODE_TYPES53.VariableDeclarator:
4016
+ case AST_NODE_TYPES53.TaggedTemplateExpression:
4017
+ case AST_NODE_TYPES53.SpreadElement:
4018
+ case AST_NODE_TYPES53.ExportSpecifier:
4019
+ case AST_NODE_TYPES53.ArrayExpression:
4020
+ case AST_NODE_TYPES53.ObjectExpression:
4021
+ case AST_NODE_TYPES53.BinaryExpression:
4022
+ case AST_NODE_TYPES53.LogicalExpression:
4023
+ case AST_NODE_TYPES53.UnaryExpression:
4024
+ case AST_NODE_TYPES53.ReturnStatement:
4025
+ case AST_NODE_TYPES53.ArrowFunctionExpression:
4026
+ case AST_NODE_TYPES53.ConditionalExpression:
4027
+ case AST_NODE_TYPES53.AwaitExpression:
4028
+ case AST_NODE_TYPES53.YieldExpression:
4029
+ case AST_NODE_TYPES53.Property:
4030
+ case AST_NODE_TYPES53.JSXExpressionContainer:
3860
4031
  return true;
3861
4032
  default:
3862
4033
  return false;
@@ -3868,7 +4039,7 @@ var preferImportType = createRule49({
3868
4039
  return;
3869
4040
  }
3870
4041
  const hasInlineTypeSpecifier = node.specifiers.some(
3871
- (specifier) => specifier.type === AST_NODE_TYPES49.ImportSpecifier && specifier.importKind === "type"
4042
+ (specifier) => specifier.type === AST_NODE_TYPES53.ImportSpecifier && specifier.importKind === "type"
3872
4043
  );
3873
4044
  if (hasInlineTypeSpecifier) {
3874
4045
  return;
@@ -3886,13 +4057,13 @@ var preferImportType = createRule49({
3886
4057
  }
3887
4058
  const scope = context.sourceCode.getScope(node);
3888
4059
  const isTypeOnlyImport2 = node.specifiers.every((specifier) => {
3889
- if (specifier.type === AST_NODE_TYPES49.ImportDefaultSpecifier) {
4060
+ if (specifier.type === AST_NODE_TYPES53.ImportDefaultSpecifier) {
3890
4061
  return false;
3891
4062
  }
3892
- if (specifier.type === AST_NODE_TYPES49.ImportNamespaceSpecifier) {
4063
+ if (specifier.type === AST_NODE_TYPES53.ImportNamespaceSpecifier) {
3893
4064
  return false;
3894
4065
  }
3895
- if (specifier.type === AST_NODE_TYPES49.ImportSpecifier) {
4066
+ if (specifier.type === AST_NODE_TYPES53.ImportSpecifier) {
3896
4067
  const localName = specifier.local.name;
3897
4068
  return !isUsedAsValue(localName, scope);
3898
4069
  }
@@ -3918,19 +4089,19 @@ var preferImportType = createRule49({
3918
4089
  var prefer_import_type_default = preferImportType;
3919
4090
 
3920
4091
  // src/rules/prefer-inline-literal-union.ts
3921
- import { AST_NODE_TYPES as AST_NODE_TYPES50, ESLintUtils as ESLintUtils50 } from "@typescript-eslint/utils";
3922
- var createRule50 = ESLintUtils50.RuleCreator(
4092
+ import { AST_NODE_TYPES as AST_NODE_TYPES54, ESLintUtils as ESLintUtils54 } from "@typescript-eslint/utils";
4093
+ var createRule54 = ESLintUtils54.RuleCreator(
3923
4094
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3924
4095
  );
3925
4096
  function isLiteralUnionType(node) {
3926
- if (node.type !== AST_NODE_TYPES50.TSUnionType) {
4097
+ if (node.type !== AST_NODE_TYPES54.TSUnionType) {
3927
4098
  return false;
3928
4099
  }
3929
4100
  return node.types.every(
3930
- (member) => member.type === AST_NODE_TYPES50.TSLiteralType || member.type === AST_NODE_TYPES50.TSNullKeyword || member.type === AST_NODE_TYPES50.TSUndefinedKeyword
4101
+ (member) => member.type === AST_NODE_TYPES54.TSLiteralType || member.type === AST_NODE_TYPES54.TSNullKeyword || member.type === AST_NODE_TYPES54.TSUndefinedKeyword
3931
4102
  );
3932
4103
  }
3933
- var preferInlineLiteralUnion = createRule50({
4104
+ var preferInlineLiteralUnion = createRule54({
3934
4105
  name: "prefer-inline-literal-union",
3935
4106
  meta: {
3936
4107
  type: "suggestion",
@@ -3957,10 +4128,10 @@ var preferInlineLiteralUnion = createRule50({
3957
4128
  return;
3958
4129
  }
3959
4130
  const { typeAnnotation } = node.typeAnnotation;
3960
- if (typeAnnotation.type !== AST_NODE_TYPES50.TSTypeReference) {
4131
+ if (typeAnnotation.type !== AST_NODE_TYPES54.TSTypeReference) {
3961
4132
  return;
3962
4133
  }
3963
- if (typeAnnotation.typeName.type !== AST_NODE_TYPES50.Identifier) {
4134
+ if (typeAnnotation.typeName.type !== AST_NODE_TYPES54.Identifier) {
3964
4135
  return;
3965
4136
  }
3966
4137
  const aliasName = typeAnnotation.typeName.name;
@@ -3984,12 +4155,12 @@ var preferInlineLiteralUnion = createRule50({
3984
4155
  var prefer_inline_literal_union_default = preferInlineLiteralUnion;
3985
4156
 
3986
4157
  // src/rules/prefer-inline-type-export.ts
3987
- import { AST_NODE_TYPES as AST_NODE_TYPES51, ESLintUtils as ESLintUtils51 } from "@typescript-eslint/utils";
3988
- var createRule51 = ESLintUtils51.RuleCreator(
4158
+ import { AST_NODE_TYPES as AST_NODE_TYPES55, ESLintUtils as ESLintUtils55 } from "@typescript-eslint/utils";
4159
+ var createRule55 = ESLintUtils55.RuleCreator(
3989
4160
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3990
4161
  );
3991
- var isTypeDeclaration = (node) => node.type === AST_NODE_TYPES51.TSInterfaceDeclaration || node.type === AST_NODE_TYPES51.TSTypeAliasDeclaration;
3992
- var preferInlineTypeExport = createRule51({
4162
+ var isTypeDeclaration = (node) => node.type === AST_NODE_TYPES55.TSInterfaceDeclaration || node.type === AST_NODE_TYPES55.TSTypeAliasDeclaration;
4163
+ var preferInlineTypeExport = createRule55({
3993
4164
  name: "prefer-inline-type-export",
3994
4165
  meta: {
3995
4166
  type: "suggestion",
@@ -4006,12 +4177,12 @@ var preferInlineTypeExport = createRule51({
4006
4177
  create(context) {
4007
4178
  const typeDeclarations = /* @__PURE__ */ new Map();
4008
4179
  function collectDeclaration(node) {
4009
- if (node.parent.type !== AST_NODE_TYPES51.ExportNamedDeclaration) {
4180
+ if (node.parent.type !== AST_NODE_TYPES55.ExportNamedDeclaration) {
4010
4181
  typeDeclarations.set(node.id.name, node);
4011
4182
  }
4012
4183
  }
4013
4184
  function reportSpecifier(specifier, statement, declarationNode) {
4014
- if (specifier.local.type !== AST_NODE_TYPES51.Identifier) {
4185
+ if (specifier.local.type !== AST_NODE_TYPES55.Identifier) {
4015
4186
  return;
4016
4187
  }
4017
4188
  const { name } = specifier.local;
@@ -4044,16 +4215,16 @@ var preferInlineTypeExport = createRule51({
4044
4215
  return {
4045
4216
  Program(node) {
4046
4217
  node.body.forEach((statement) => {
4047
- if (statement.type === AST_NODE_TYPES51.TSInterfaceDeclaration || statement.type === AST_NODE_TYPES51.TSTypeAliasDeclaration) {
4218
+ if (statement.type === AST_NODE_TYPES55.TSInterfaceDeclaration || statement.type === AST_NODE_TYPES55.TSTypeAliasDeclaration) {
4048
4219
  collectDeclaration(statement);
4049
4220
  }
4050
4221
  });
4051
4222
  node.body.forEach((statement) => {
4052
- if (statement.type !== AST_NODE_TYPES51.ExportNamedDeclaration || statement.declaration !== null) {
4223
+ if (statement.type !== AST_NODE_TYPES55.ExportNamedDeclaration || statement.declaration !== null) {
4053
4224
  return;
4054
4225
  }
4055
4226
  statement.specifiers.forEach((specifier) => {
4056
- if (specifier.local.type !== AST_NODE_TYPES51.Identifier) {
4227
+ if (specifier.local.type !== AST_NODE_TYPES55.Identifier) {
4057
4228
  return;
4058
4229
  }
4059
4230
  const declarationNode = typeDeclarations.get(specifier.local.name);
@@ -4070,11 +4241,11 @@ var preferInlineTypeExport = createRule51({
4070
4241
  var prefer_inline_type_export_default = preferInlineTypeExport;
4071
4242
 
4072
4243
  // src/rules/prefer-interface-for-component-props.ts
4073
- import { AST_NODE_TYPES as AST_NODE_TYPES52, ESLintUtils as ESLintUtils52 } from "@typescript-eslint/utils";
4074
- var createRule52 = ESLintUtils52.RuleCreator(
4244
+ import { AST_NODE_TYPES as AST_NODE_TYPES56, ESLintUtils as ESLintUtils56 } from "@typescript-eslint/utils";
4245
+ var createRule56 = ESLintUtils56.RuleCreator(
4075
4246
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4076
4247
  );
4077
- var preferInterfaceForComponentProps = createRule52({
4248
+ var preferInterfaceForComponentProps = createRule56({
4078
4249
  name: "prefer-interface-for-component-props",
4079
4250
  meta: {
4080
4251
  type: "suggestion",
@@ -4094,13 +4265,13 @@ var preferInterfaceForComponentProps = createRule52({
4094
4265
  }
4095
4266
  return {
4096
4267
  TSTypeAliasDeclaration(node) {
4097
- if (node.id.type !== AST_NODE_TYPES52.Identifier) {
4268
+ if (node.id.type !== AST_NODE_TYPES56.Identifier) {
4098
4269
  return;
4099
4270
  }
4100
4271
  if (!node.id.name.endsWith("Props")) {
4101
4272
  return;
4102
4273
  }
4103
- if (node.typeAnnotation.type !== AST_NODE_TYPES52.TSTypeLiteral) {
4274
+ if (node.typeAnnotation.type !== AST_NODE_TYPES56.TSTypeLiteral) {
4104
4275
  return;
4105
4276
  }
4106
4277
  const { name } = node.id;
@@ -4127,11 +4298,11 @@ var preferInterfaceForComponentProps = createRule52({
4127
4298
  var prefer_interface_for_component_props_default = preferInterfaceForComponentProps;
4128
4299
 
4129
4300
  // src/rules/prefer-interface-over-inline-types.ts
4130
- import { AST_NODE_TYPES as AST_NODE_TYPES53, ESLintUtils as ESLintUtils53 } from "@typescript-eslint/utils";
4131
- var createRule53 = ESLintUtils53.RuleCreator(
4301
+ import { AST_NODE_TYPES as AST_NODE_TYPES57, ESLintUtils as ESLintUtils57 } from "@typescript-eslint/utils";
4302
+ var createRule57 = ESLintUtils57.RuleCreator(
4132
4303
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4133
4304
  );
4134
- var preferInterfaceOverInlineTypes = createRule53({
4305
+ var preferInterfaceOverInlineTypes = createRule57({
4135
4306
  name: "prefer-interface-over-inline-types",
4136
4307
  meta: {
4137
4308
  type: "suggestion",
@@ -4147,54 +4318,54 @@ var preferInterfaceOverInlineTypes = createRule53({
4147
4318
  defaultOptions: [],
4148
4319
  create(context) {
4149
4320
  function hasJSXInConditional(node) {
4150
- return node.consequent.type === AST_NODE_TYPES53.JSXElement || node.consequent.type === AST_NODE_TYPES53.JSXFragment || node.alternate.type === AST_NODE_TYPES53.JSXElement || node.alternate.type === AST_NODE_TYPES53.JSXFragment;
4321
+ return node.consequent.type === AST_NODE_TYPES57.JSXElement || node.consequent.type === AST_NODE_TYPES57.JSXFragment || node.alternate.type === AST_NODE_TYPES57.JSXElement || node.alternate.type === AST_NODE_TYPES57.JSXFragment;
4151
4322
  }
4152
4323
  function hasJSXInLogical(node) {
4153
- return node.right.type === AST_NODE_TYPES53.JSXElement || node.right.type === AST_NODE_TYPES53.JSXFragment;
4324
+ return node.right.type === AST_NODE_TYPES57.JSXElement || node.right.type === AST_NODE_TYPES57.JSXFragment;
4154
4325
  }
4155
4326
  function hasJSXReturn(block) {
4156
4327
  return block.body.some((stmt) => {
4157
- if (stmt.type === AST_NODE_TYPES53.ReturnStatement && stmt.argument) {
4158
- return stmt.argument.type === AST_NODE_TYPES53.JSXElement || stmt.argument.type === AST_NODE_TYPES53.JSXFragment || stmt.argument.type === AST_NODE_TYPES53.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES53.LogicalExpression && hasJSXInLogical(stmt.argument);
4328
+ if (stmt.type === AST_NODE_TYPES57.ReturnStatement && stmt.argument) {
4329
+ return stmt.argument.type === AST_NODE_TYPES57.JSXElement || stmt.argument.type === AST_NODE_TYPES57.JSXFragment || stmt.argument.type === AST_NODE_TYPES57.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES57.LogicalExpression && hasJSXInLogical(stmt.argument);
4159
4330
  }
4160
4331
  return false;
4161
4332
  });
4162
4333
  }
4163
4334
  function isReactComponent2(node) {
4164
- if (node.type === AST_NODE_TYPES53.ArrowFunctionExpression) {
4165
- if (node.body.type === AST_NODE_TYPES53.JSXElement || node.body.type === AST_NODE_TYPES53.JSXFragment) {
4335
+ if (node.type === AST_NODE_TYPES57.ArrowFunctionExpression) {
4336
+ if (node.body.type === AST_NODE_TYPES57.JSXElement || node.body.type === AST_NODE_TYPES57.JSXFragment) {
4166
4337
  return true;
4167
4338
  }
4168
- if (node.body.type === AST_NODE_TYPES53.BlockStatement) {
4339
+ if (node.body.type === AST_NODE_TYPES57.BlockStatement) {
4169
4340
  return hasJSXReturn(node.body);
4170
4341
  }
4171
- } else if (node.type === AST_NODE_TYPES53.FunctionExpression || node.type === AST_NODE_TYPES53.FunctionDeclaration) {
4172
- if (node.body && node.body.type === AST_NODE_TYPES53.BlockStatement) {
4342
+ } else if (node.type === AST_NODE_TYPES57.FunctionExpression || node.type === AST_NODE_TYPES57.FunctionDeclaration) {
4343
+ if (node.body && node.body.type === AST_NODE_TYPES57.BlockStatement) {
4173
4344
  return hasJSXReturn(node.body);
4174
4345
  }
4175
4346
  }
4176
4347
  return false;
4177
4348
  }
4178
4349
  function isInlineTypeAnnotation(node) {
4179
- if (node.type === AST_NODE_TYPES53.TSTypeLiteral) {
4350
+ if (node.type === AST_NODE_TYPES57.TSTypeLiteral) {
4180
4351
  return true;
4181
4352
  }
4182
- if (node.type === AST_NODE_TYPES53.TSTypeReference && node.typeArguments) {
4183
- return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES53.TSTypeLiteral);
4353
+ if (node.type === AST_NODE_TYPES57.TSTypeReference && node.typeArguments) {
4354
+ return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES57.TSTypeLiteral);
4184
4355
  }
4185
- if (node.type === AST_NODE_TYPES53.TSUnionType) {
4356
+ if (node.type === AST_NODE_TYPES57.TSUnionType) {
4186
4357
  return node.types.some((type) => isInlineTypeAnnotation(type));
4187
4358
  }
4188
4359
  return false;
4189
4360
  }
4190
4361
  function hasInlineObjectType(node) {
4191
- if (node.type === AST_NODE_TYPES53.TSTypeLiteral) {
4362
+ if (node.type === AST_NODE_TYPES57.TSTypeLiteral) {
4192
4363
  return true;
4193
4364
  }
4194
- if (node.type === AST_NODE_TYPES53.TSTypeReference && node.typeArguments) {
4195
- return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES53.TSTypeLiteral);
4365
+ if (node.type === AST_NODE_TYPES57.TSTypeReference && node.typeArguments) {
4366
+ return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES57.TSTypeLiteral);
4196
4367
  }
4197
- if (node.type === AST_NODE_TYPES53.TSUnionType) {
4368
+ if (node.type === AST_NODE_TYPES57.TSUnionType) {
4198
4369
  return node.types.some((type) => hasInlineObjectType(type));
4199
4370
  }
4200
4371
  return false;
@@ -4207,7 +4378,7 @@ var preferInterfaceOverInlineTypes = createRule53({
4207
4378
  return;
4208
4379
  }
4209
4380
  const param = node.params[0];
4210
- if (param.type === AST_NODE_TYPES53.Identifier && param.typeAnnotation) {
4381
+ if (param.type === AST_NODE_TYPES57.Identifier && param.typeAnnotation) {
4211
4382
  const { typeAnnotation } = param.typeAnnotation;
4212
4383
  if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
4213
4384
  context.report({
@@ -4227,11 +4398,11 @@ var preferInterfaceOverInlineTypes = createRule53({
4227
4398
  var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
4228
4399
 
4229
4400
  // src/rules/prefer-jsx-template-literals.ts
4230
- import { AST_NODE_TYPES as AST_NODE_TYPES54, ESLintUtils as ESLintUtils54 } from "@typescript-eslint/utils";
4231
- var createRule54 = ESLintUtils54.RuleCreator(
4401
+ import { AST_NODE_TYPES as AST_NODE_TYPES58, ESLintUtils as ESLintUtils58 } from "@typescript-eslint/utils";
4402
+ var createRule58 = ESLintUtils58.RuleCreator(
4232
4403
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4233
4404
  );
4234
- var preferJSXTemplateLiterals = createRule54({
4405
+ var preferJSXTemplateLiterals = createRule58({
4235
4406
  name: "prefer-jsx-template-literals",
4236
4407
  meta: {
4237
4408
  type: "suggestion",
@@ -4300,9 +4471,9 @@ var preferJSXTemplateLiterals = createRule54({
4300
4471
  if (!child || !nextChild) {
4301
4472
  return;
4302
4473
  }
4303
- if (child.type === AST_NODE_TYPES54.JSXText && nextChild.type === AST_NODE_TYPES54.JSXExpressionContainer) {
4474
+ if (child.type === AST_NODE_TYPES58.JSXText && nextChild.type === AST_NODE_TYPES58.JSXExpressionContainer) {
4304
4475
  handleTextBeforeExpression(child, nextChild);
4305
- } else if (child.type === AST_NODE_TYPES54.JSXExpressionContainer && nextChild.type === AST_NODE_TYPES54.JSXText) {
4476
+ } else if (child.type === AST_NODE_TYPES58.JSXExpressionContainer && nextChild.type === AST_NODE_TYPES58.JSXText) {
4306
4477
  handleExpressionBeforeText(child, nextChild);
4307
4478
  }
4308
4479
  }
@@ -4315,32 +4486,32 @@ var preferJSXTemplateLiterals = createRule54({
4315
4486
  var prefer_jsx_template_literals_default = preferJSXTemplateLiterals;
4316
4487
 
4317
4488
  // src/rules/prefer-named-param-types.ts
4318
- import { AST_NODE_TYPES as AST_NODE_TYPES55, ESLintUtils as ESLintUtils55 } from "@typescript-eslint/utils";
4319
- var createRule55 = ESLintUtils55.RuleCreator(
4489
+ import { AST_NODE_TYPES as AST_NODE_TYPES59, ESLintUtils as ESLintUtils59 } from "@typescript-eslint/utils";
4490
+ var createRule59 = ESLintUtils59.RuleCreator(
4320
4491
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4321
4492
  );
4322
4493
  var returnsJsx2 = (node) => {
4323
- if (node.type === AST_NODE_TYPES55.JSXElement || node.type === AST_NODE_TYPES55.JSXFragment) {
4494
+ if (node.type === AST_NODE_TYPES59.JSXElement || node.type === AST_NODE_TYPES59.JSXFragment) {
4324
4495
  return true;
4325
4496
  }
4326
- if (node.type === AST_NODE_TYPES55.ConditionalExpression) {
4497
+ if (node.type === AST_NODE_TYPES59.ConditionalExpression) {
4327
4498
  return returnsJsx2(node.consequent) || returnsJsx2(node.alternate);
4328
4499
  }
4329
- if (node.type === AST_NODE_TYPES55.LogicalExpression) {
4500
+ if (node.type === AST_NODE_TYPES59.LogicalExpression) {
4330
4501
  return returnsJsx2(node.left) || returnsJsx2(node.right);
4331
4502
  }
4332
4503
  return false;
4333
4504
  };
4334
4505
  var bodyReturnsJsx2 = (body) => {
4335
- if (body.type !== AST_NODE_TYPES55.BlockStatement) {
4506
+ if (body.type !== AST_NODE_TYPES59.BlockStatement) {
4336
4507
  return returnsJsx2(body);
4337
4508
  }
4338
4509
  return body.body.some(
4339
- (stmt) => stmt.type === AST_NODE_TYPES55.ReturnStatement && stmt.argument !== null && returnsJsx2(stmt.argument)
4510
+ (stmt) => stmt.type === AST_NODE_TYPES59.ReturnStatement && stmt.argument !== null && returnsJsx2(stmt.argument)
4340
4511
  );
4341
4512
  };
4342
4513
  var isReactComponentFunction = (node) => bodyReturnsJsx2(node.body);
4343
- var preferNamedParamTypes = createRule55({
4514
+ var preferNamedParamTypes = createRule59({
4344
4515
  name: "prefer-named-param-types",
4345
4516
  meta: {
4346
4517
  type: "suggestion",
@@ -4355,16 +4526,16 @@ var preferNamedParamTypes = createRule55({
4355
4526
  defaultOptions: [],
4356
4527
  create(context) {
4357
4528
  function hasInlineObjectType(param) {
4358
- if (param.type === AST_NODE_TYPES55.AssignmentPattern) {
4529
+ if (param.type === AST_NODE_TYPES59.AssignmentPattern) {
4359
4530
  return hasInlineObjectType(param.left);
4360
4531
  }
4361
- if (param.type === AST_NODE_TYPES55.ObjectPattern) {
4362
- if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES55.TSTypeLiteral) {
4532
+ if (param.type === AST_NODE_TYPES59.ObjectPattern) {
4533
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES59.TSTypeLiteral) {
4363
4534
  return true;
4364
4535
  }
4365
4536
  }
4366
- if (param.type === AST_NODE_TYPES55.Identifier) {
4367
- if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES55.TSTypeLiteral) {
4537
+ if (param.type === AST_NODE_TYPES59.Identifier) {
4538
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES59.TSTypeLiteral) {
4368
4539
  return true;
4369
4540
  }
4370
4541
  }
@@ -4377,7 +4548,7 @@ var preferNamedParamTypes = createRule55({
4377
4548
  } else if ("value" in node && node.value) {
4378
4549
  params = node.value.params;
4379
4550
  }
4380
- if ((node.type === AST_NODE_TYPES55.FunctionDeclaration || node.type === AST_NODE_TYPES55.FunctionExpression || node.type === AST_NODE_TYPES55.ArrowFunctionExpression) && params.length === 1 && params[0].type === AST_NODE_TYPES55.Identifier && isReactComponentFunction(node)) {
4551
+ if ((node.type === AST_NODE_TYPES59.FunctionDeclaration || node.type === AST_NODE_TYPES59.FunctionExpression || node.type === AST_NODE_TYPES59.ArrowFunctionExpression) && params.length === 1 && params[0].type === AST_NODE_TYPES59.Identifier && isReactComponentFunction(node)) {
4381
4552
  return;
4382
4553
  }
4383
4554
  params.forEach((param) => {
@@ -4401,11 +4572,11 @@ var preferNamedParamTypes = createRule55({
4401
4572
  var prefer_named_param_types_default = preferNamedParamTypes;
4402
4573
 
4403
4574
  // src/rules/prefer-props-with-children.ts
4404
- import { AST_NODE_TYPES as AST_NODE_TYPES56, ESLintUtils as ESLintUtils56 } from "@typescript-eslint/utils";
4405
- var createRule56 = ESLintUtils56.RuleCreator(
4575
+ import { AST_NODE_TYPES as AST_NODE_TYPES60, ESLintUtils as ESLintUtils60 } from "@typescript-eslint/utils";
4576
+ var createRule60 = ESLintUtils60.RuleCreator(
4406
4577
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4407
4578
  );
4408
- var preferPropsWithChildren = createRule56({
4579
+ var preferPropsWithChildren = createRule60({
4409
4580
  name: "prefer-props-with-children",
4410
4581
  meta: {
4411
4582
  type: "suggestion",
@@ -4423,24 +4594,24 @@ var preferPropsWithChildren = createRule56({
4423
4594
  if (!typeNode) {
4424
4595
  return false;
4425
4596
  }
4426
- if (typeNode.type !== AST_NODE_TYPES56.TSTypeReference) {
4597
+ if (typeNode.type !== AST_NODE_TYPES60.TSTypeReference) {
4427
4598
  return false;
4428
4599
  }
4429
4600
  const { typeName } = typeNode;
4430
- if (typeName.type === AST_NODE_TYPES56.Identifier) {
4601
+ if (typeName.type === AST_NODE_TYPES60.Identifier) {
4431
4602
  return typeName.name === "ReactNode";
4432
4603
  }
4433
- if (typeName.type === AST_NODE_TYPES56.TSQualifiedName && typeName.left.type === AST_NODE_TYPES56.Identifier && typeName.left.name === "React" && typeName.right.type === AST_NODE_TYPES56.Identifier && typeName.right.name === "ReactNode") {
4604
+ if (typeName.type === AST_NODE_TYPES60.TSQualifiedName && typeName.left.type === AST_NODE_TYPES60.Identifier && typeName.left.name === "React" && typeName.right.type === AST_NODE_TYPES60.Identifier && typeName.right.name === "ReactNode") {
4434
4605
  return true;
4435
4606
  }
4436
4607
  return false;
4437
4608
  }
4438
4609
  function findChildrenReactNode(members) {
4439
4610
  for (const member of members) {
4440
- if (member.type !== AST_NODE_TYPES56.TSPropertySignature) {
4611
+ if (member.type !== AST_NODE_TYPES60.TSPropertySignature) {
4441
4612
  continue;
4442
4613
  }
4443
- if (member.key.type !== AST_NODE_TYPES56.Identifier) {
4614
+ if (member.key.type !== AST_NODE_TYPES60.Identifier) {
4444
4615
  continue;
4445
4616
  }
4446
4617
  if (member.key.name !== "children") {
@@ -4480,11 +4651,11 @@ var preferPropsWithChildren = createRule56({
4480
4651
  var prefer_props_with_children_default = preferPropsWithChildren;
4481
4652
 
4482
4653
  // src/rules/prefer-react-import-types.ts
4483
- import { AST_NODE_TYPES as AST_NODE_TYPES57, ESLintUtils as ESLintUtils57 } from "@typescript-eslint/utils";
4484
- var createRule57 = ESLintUtils57.RuleCreator(
4654
+ import { AST_NODE_TYPES as AST_NODE_TYPES61, ESLintUtils as ESLintUtils61 } from "@typescript-eslint/utils";
4655
+ var createRule61 = ESLintUtils61.RuleCreator(
4485
4656
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4486
4657
  );
4487
- var preferReactImportTypes = createRule57({
4658
+ var preferReactImportTypes = createRule61({
4488
4659
  name: "prefer-react-import-types",
4489
4660
  meta: {
4490
4661
  type: "suggestion",
@@ -4560,7 +4731,7 @@ var preferReactImportTypes = createRule57({
4560
4731
  ]);
4561
4732
  const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
4562
4733
  function checkMemberExpression(node) {
4563
- if (node.object.type === AST_NODE_TYPES57.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES57.Identifier && allReactExports.has(node.property.name)) {
4734
+ if (node.object.type === AST_NODE_TYPES61.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES61.Identifier && allReactExports.has(node.property.name)) {
4564
4735
  const typeName = node.property.name;
4565
4736
  const isType = reactTypes.has(typeName);
4566
4737
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -4577,7 +4748,7 @@ var preferReactImportTypes = createRule57({
4577
4748
  return {
4578
4749
  MemberExpression: checkMemberExpression,
4579
4750
  "TSTypeReference > TSQualifiedName": (node) => {
4580
- if (node.left.type === AST_NODE_TYPES57.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES57.Identifier && allReactExports.has(node.right.name)) {
4751
+ if (node.left.type === AST_NODE_TYPES61.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES61.Identifier && allReactExports.has(node.right.name)) {
4581
4752
  const typeName = node.right.name;
4582
4753
  const isType = reactTypes.has(typeName);
4583
4754
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -4597,11 +4768,11 @@ var preferReactImportTypes = createRule57({
4597
4768
  var prefer_react_import_types_default = preferReactImportTypes;
4598
4769
 
4599
4770
  // src/rules/react-props-destructure.ts
4600
- import { AST_NODE_TYPES as AST_NODE_TYPES58, ESLintUtils as ESLintUtils58 } from "@typescript-eslint/utils";
4601
- var createRule58 = ESLintUtils58.RuleCreator(
4771
+ import { AST_NODE_TYPES as AST_NODE_TYPES62, ESLintUtils as ESLintUtils62 } from "@typescript-eslint/utils";
4772
+ var createRule62 = ESLintUtils62.RuleCreator(
4602
4773
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4603
4774
  );
4604
- var reactPropsDestructure = createRule58({
4775
+ var reactPropsDestructure = createRule62({
4605
4776
  name: "react-props-destructure",
4606
4777
  meta: {
4607
4778
  type: "suggestion",
@@ -4617,29 +4788,29 @@ var reactPropsDestructure = createRule58({
4617
4788
  defaultOptions: [],
4618
4789
  create(context) {
4619
4790
  function hasJSXInConditional(node) {
4620
- return node.consequent.type === AST_NODE_TYPES58.JSXElement || node.consequent.type === AST_NODE_TYPES58.JSXFragment || node.alternate.type === AST_NODE_TYPES58.JSXElement || node.alternate.type === AST_NODE_TYPES58.JSXFragment;
4791
+ return node.consequent.type === AST_NODE_TYPES62.JSXElement || node.consequent.type === AST_NODE_TYPES62.JSXFragment || node.alternate.type === AST_NODE_TYPES62.JSXElement || node.alternate.type === AST_NODE_TYPES62.JSXFragment;
4621
4792
  }
4622
4793
  function hasJSXInLogical(node) {
4623
- return node.right.type === AST_NODE_TYPES58.JSXElement || node.right.type === AST_NODE_TYPES58.JSXFragment;
4794
+ return node.right.type === AST_NODE_TYPES62.JSXElement || node.right.type === AST_NODE_TYPES62.JSXFragment;
4624
4795
  }
4625
4796
  function hasJSXReturn(block) {
4626
4797
  return block.body.some((stmt) => {
4627
- if (stmt.type === AST_NODE_TYPES58.ReturnStatement && stmt.argument) {
4628
- return stmt.argument.type === AST_NODE_TYPES58.JSXElement || stmt.argument.type === AST_NODE_TYPES58.JSXFragment || stmt.argument.type === AST_NODE_TYPES58.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES58.LogicalExpression && hasJSXInLogical(stmt.argument);
4798
+ if (stmt.type === AST_NODE_TYPES62.ReturnStatement && stmt.argument) {
4799
+ return stmt.argument.type === AST_NODE_TYPES62.JSXElement || stmt.argument.type === AST_NODE_TYPES62.JSXFragment || stmt.argument.type === AST_NODE_TYPES62.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES62.LogicalExpression && hasJSXInLogical(stmt.argument);
4629
4800
  }
4630
4801
  return false;
4631
4802
  });
4632
4803
  }
4633
4804
  function isReactComponent2(node) {
4634
- if (node.type === AST_NODE_TYPES58.ArrowFunctionExpression) {
4635
- if (node.body.type === AST_NODE_TYPES58.JSXElement || node.body.type === AST_NODE_TYPES58.JSXFragment) {
4805
+ if (node.type === AST_NODE_TYPES62.ArrowFunctionExpression) {
4806
+ if (node.body.type === AST_NODE_TYPES62.JSXElement || node.body.type === AST_NODE_TYPES62.JSXFragment) {
4636
4807
  return true;
4637
4808
  }
4638
- if (node.body.type === AST_NODE_TYPES58.BlockStatement) {
4809
+ if (node.body.type === AST_NODE_TYPES62.BlockStatement) {
4639
4810
  return hasJSXReturn(node.body);
4640
4811
  }
4641
- } else if (node.type === AST_NODE_TYPES58.FunctionExpression || node.type === AST_NODE_TYPES58.FunctionDeclaration) {
4642
- if (node.body && node.body.type === AST_NODE_TYPES58.BlockStatement) {
4812
+ } else if (node.type === AST_NODE_TYPES62.FunctionExpression || node.type === AST_NODE_TYPES62.FunctionDeclaration) {
4813
+ if (node.body && node.body.type === AST_NODE_TYPES62.BlockStatement) {
4643
4814
  return hasJSXReturn(node.body);
4644
4815
  }
4645
4816
  }
@@ -4653,9 +4824,9 @@ var reactPropsDestructure = createRule58({
4653
4824
  return;
4654
4825
  }
4655
4826
  const param = node.params[0];
4656
- if (param.type === AST_NODE_TYPES58.ObjectPattern) {
4657
- const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES58.Property).map((prop) => {
4658
- if (prop.key.type === AST_NODE_TYPES58.Identifier) {
4827
+ if (param.type === AST_NODE_TYPES62.ObjectPattern) {
4828
+ const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES62.Property).map((prop) => {
4829
+ if (prop.key.type === AST_NODE_TYPES62.Identifier) {
4659
4830
  return prop.key.name;
4660
4831
  }
4661
4832
  return null;
@@ -4682,57 +4853,57 @@ var reactPropsDestructure = createRule58({
4682
4853
  var react_props_destructure_default = reactPropsDestructure;
4683
4854
 
4684
4855
  // src/rules/require-explicit-return-type.ts
4685
- import { AST_NODE_TYPES as AST_NODE_TYPES59, ESLintUtils as ESLintUtils59 } from "@typescript-eslint/utils";
4686
- var createRule59 = ESLintUtils59.RuleCreator(
4856
+ import { AST_NODE_TYPES as AST_NODE_TYPES63, ESLintUtils as ESLintUtils63 } from "@typescript-eslint/utils";
4857
+ var createRule63 = ESLintUtils63.RuleCreator(
4687
4858
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4688
4859
  );
4689
4860
  var isReactComponent = (node) => {
4690
- if (node.type === AST_NODE_TYPES59.ArrowFunctionExpression) {
4861
+ if (node.type === AST_NODE_TYPES63.ArrowFunctionExpression) {
4691
4862
  const { parent } = node;
4692
- if (parent?.type === AST_NODE_TYPES59.VariableDeclarator) {
4863
+ if (parent?.type === AST_NODE_TYPES63.VariableDeclarator) {
4693
4864
  const { id } = parent;
4694
- if (id.type === AST_NODE_TYPES59.Identifier) {
4865
+ if (id.type === AST_NODE_TYPES63.Identifier) {
4695
4866
  return /^[A-Z]/.test(id.name);
4696
4867
  }
4697
4868
  }
4698
4869
  }
4699
- if (node.type === AST_NODE_TYPES59.FunctionDeclaration && node.id) {
4870
+ if (node.type === AST_NODE_TYPES63.FunctionDeclaration && node.id) {
4700
4871
  return /^[A-Z]/.test(node.id.name);
4701
4872
  }
4702
4873
  return false;
4703
4874
  };
4704
4875
  var isCallbackFunction = (node) => {
4705
- if (node.type === AST_NODE_TYPES59.FunctionDeclaration) {
4876
+ if (node.type === AST_NODE_TYPES63.FunctionDeclaration) {
4706
4877
  return false;
4707
4878
  }
4708
4879
  const { parent } = node;
4709
4880
  if (!parent) {
4710
4881
  return false;
4711
4882
  }
4712
- if (parent.type === AST_NODE_TYPES59.CallExpression && parent.arguments.includes(node)) {
4883
+ if (parent.type === AST_NODE_TYPES63.CallExpression && parent.arguments.includes(node)) {
4713
4884
  return true;
4714
4885
  }
4715
- if (parent.type === AST_NODE_TYPES59.Property) {
4886
+ if (parent.type === AST_NODE_TYPES63.Property) {
4716
4887
  return true;
4717
4888
  }
4718
- if (parent.type === AST_NODE_TYPES59.ArrayExpression) {
4889
+ if (parent.type === AST_NODE_TYPES63.ArrayExpression) {
4719
4890
  return true;
4720
4891
  }
4721
4892
  return false;
4722
4893
  };
4723
4894
  var getFunctionName = (node) => {
4724
- if (node.type === AST_NODE_TYPES59.FunctionDeclaration && node.id) {
4895
+ if (node.type === AST_NODE_TYPES63.FunctionDeclaration && node.id) {
4725
4896
  return node.id.name;
4726
4897
  }
4727
- if (node.type === AST_NODE_TYPES59.FunctionExpression && node.id) {
4898
+ if (node.type === AST_NODE_TYPES63.FunctionExpression && node.id) {
4728
4899
  return node.id.name;
4729
4900
  }
4730
- if ((node.type === AST_NODE_TYPES59.ArrowFunctionExpression || node.type === AST_NODE_TYPES59.FunctionExpression) && node.parent?.type === AST_NODE_TYPES59.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES59.Identifier) {
4901
+ if ((node.type === AST_NODE_TYPES63.ArrowFunctionExpression || node.type === AST_NODE_TYPES63.FunctionExpression) && node.parent?.type === AST_NODE_TYPES63.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES63.Identifier) {
4731
4902
  return node.parent.id.name;
4732
4903
  }
4733
4904
  return null;
4734
4905
  };
4735
- var requireExplicitReturnType = createRule59({
4906
+ var requireExplicitReturnType = createRule63({
4736
4907
  name: "require-explicit-return-type",
4737
4908
  meta: {
4738
4909
  type: "suggestion",
@@ -4781,8 +4952,8 @@ var requireExplicitReturnType = createRule59({
4781
4952
  var require_explicit_return_type_default = requireExplicitReturnType;
4782
4953
 
4783
4954
  // src/rules/sort-exports.ts
4784
- import { AST_NODE_TYPES as AST_NODE_TYPES60, ESLintUtils as ESLintUtils60 } from "@typescript-eslint/utils";
4785
- var createRule60 = ESLintUtils60.RuleCreator(
4955
+ import { AST_NODE_TYPES as AST_NODE_TYPES64, ESLintUtils as ESLintUtils64 } from "@typescript-eslint/utils";
4956
+ var createRule64 = ESLintUtils64.RuleCreator(
4786
4957
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4787
4958
  );
4788
4959
  var GROUP_NAMES = ["", "external/alias re-export", "relative re-export", "local export"];
@@ -4796,7 +4967,7 @@ function getExportGroup(node) {
4796
4967
  }
4797
4968
  return 1;
4798
4969
  }
4799
- var sortExports = createRule60({
4970
+ var sortExports = createRule64({
4800
4971
  name: "sort-exports",
4801
4972
  meta: {
4802
4973
  type: "suggestion",
@@ -4836,7 +5007,7 @@ var sortExports = createRule60({
4836
5007
  Program(node) {
4837
5008
  const exportGroups = [];
4838
5009
  node.body.forEach((statement) => {
4839
- if (statement.type !== AST_NODE_TYPES60.ExportNamedDeclaration || statement.declaration !== null) {
5010
+ if (statement.type !== AST_NODE_TYPES64.ExportNamedDeclaration || statement.declaration !== null) {
4840
5011
  if (exportGroups.length > 0) {
4841
5012
  checkOrder(exportGroups);
4842
5013
  exportGroups.length = 0;
@@ -4855,8 +5026,8 @@ var sortExports = createRule60({
4855
5026
  var sort_exports_default = sortExports;
4856
5027
 
4857
5028
  // src/rules/sort-imports.ts
4858
- import { AST_NODE_TYPES as AST_NODE_TYPES61, ESLintUtils as ESLintUtils61 } from "@typescript-eslint/utils";
4859
- var createRule61 = ESLintUtils61.RuleCreator(
5029
+ import { AST_NODE_TYPES as AST_NODE_TYPES65, ESLintUtils as ESLintUtils65 } from "@typescript-eslint/utils";
5030
+ var createRule65 = ESLintUtils65.RuleCreator(
4860
5031
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4861
5032
  );
4862
5033
  var NODE_BUILTINS = /* @__PURE__ */ new Set([
@@ -4923,7 +5094,7 @@ function getImportGroup(node) {
4923
5094
  function isTypeOnlyImport(node) {
4924
5095
  return node.importKind === "type" && node.specifiers.length > 0;
4925
5096
  }
4926
- var sortImports = createRule61({
5097
+ var sortImports = createRule65({
4927
5098
  name: "sort-imports",
4928
5099
  meta: {
4929
5100
  type: "suggestion",
@@ -4967,7 +5138,7 @@ var sortImports = createRule61({
4967
5138
  Program(node) {
4968
5139
  const importGroups = [];
4969
5140
  node.body.forEach((statement) => {
4970
- if (statement.type !== AST_NODE_TYPES61.ImportDeclaration) {
5141
+ if (statement.type !== AST_NODE_TYPES65.ImportDeclaration) {
4971
5142
  if (importGroups.length > 0) {
4972
5143
  checkOrder(importGroups);
4973
5144
  importGroups.length = 0;
@@ -4989,13 +5160,13 @@ var sortImports = createRule61({
4989
5160
  var sort_imports_default = sortImports;
4990
5161
 
4991
5162
  // src/rules/sort-type-alphabetically.ts
4992
- import { AST_NODE_TYPES as AST_NODE_TYPES62, ESLintUtils as ESLintUtils62 } from "@typescript-eslint/utils";
4993
- var createRule62 = ESLintUtils62.RuleCreator(
5163
+ import { AST_NODE_TYPES as AST_NODE_TYPES66, ESLintUtils as ESLintUtils66 } from "@typescript-eslint/utils";
5164
+ var createRule66 = ESLintUtils66.RuleCreator(
4994
5165
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4995
5166
  );
4996
5167
  function isAlphabeticallySortedWithinGroups(members) {
4997
5168
  const properties = members.filter(
4998
- (member) => member.type === AST_NODE_TYPES62.TSPropertySignature && member.key.type === AST_NODE_TYPES62.Identifier
5169
+ (member) => member.type === AST_NODE_TYPES66.TSPropertySignature && member.key.type === AST_NODE_TYPES66.Identifier
4999
5170
  );
5000
5171
  if (properties.length < 2) {
5001
5172
  return true;
@@ -5006,7 +5177,7 @@ function isAlphabeticallySortedWithinGroups(members) {
5006
5177
  const isOptionalSorted = optional.every((name, index) => index === 0 || optional[index - 1].localeCompare(name) <= 0);
5007
5178
  return isRequiredSorted && isOptionalSorted;
5008
5179
  }
5009
- var sortTypeAlphabetically = createRule62({
5180
+ var sortTypeAlphabetically = createRule66({
5010
5181
  name: "sort-type-alphabetically",
5011
5182
  meta: {
5012
5183
  type: "suggestion",
@@ -5024,7 +5195,7 @@ var sortTypeAlphabetically = createRule62({
5024
5195
  function fixMembers(fixer, members) {
5025
5196
  const { sourceCode } = context;
5026
5197
  const properties = members.filter(
5027
- (member) => member.type === AST_NODE_TYPES62.TSPropertySignature && member.key.type === AST_NODE_TYPES62.Identifier
5198
+ (member) => member.type === AST_NODE_TYPES66.TSPropertySignature && member.key.type === AST_NODE_TYPES66.Identifier
5028
5199
  );
5029
5200
  const required = properties.filter((prop) => !prop.optional);
5030
5201
  const optional = properties.filter((prop) => prop.optional);
@@ -5061,7 +5232,7 @@ var sortTypeAlphabetically = createRule62({
5061
5232
  }
5062
5233
  },
5063
5234
  TSTypeAliasDeclaration(node) {
5064
- if (node.typeAnnotation.type !== AST_NODE_TYPES62.TSTypeLiteral) {
5235
+ if (node.typeAnnotation.type !== AST_NODE_TYPES66.TSTypeLiteral) {
5065
5236
  return;
5066
5237
  }
5067
5238
  const { members } = node.typeAnnotation;
@@ -5081,13 +5252,13 @@ var sortTypeAlphabetically = createRule62({
5081
5252
  var sort_type_alphabetically_default = sortTypeAlphabetically;
5082
5253
 
5083
5254
  // src/rules/sort-type-required-first.ts
5084
- import { AST_NODE_TYPES as AST_NODE_TYPES63, ESLintUtils as ESLintUtils63 } from "@typescript-eslint/utils";
5085
- var createRule63 = ESLintUtils63.RuleCreator(
5255
+ import { AST_NODE_TYPES as AST_NODE_TYPES67, ESLintUtils as ESLintUtils67 } from "@typescript-eslint/utils";
5256
+ var createRule67 = ESLintUtils67.RuleCreator(
5086
5257
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
5087
5258
  );
5088
5259
  function isRequiredBeforeOptional(members) {
5089
5260
  const properties = members.filter(
5090
- (member) => member.type === AST_NODE_TYPES63.TSPropertySignature && member.key.type === AST_NODE_TYPES63.Identifier
5261
+ (member) => member.type === AST_NODE_TYPES67.TSPropertySignature && member.key.type === AST_NODE_TYPES67.Identifier
5091
5262
  );
5092
5263
  if (properties.length < 2) {
5093
5264
  return true;
@@ -5098,7 +5269,7 @@ function isRequiredBeforeOptional(members) {
5098
5269
  }
5099
5270
  return properties.slice(firstOptionalIndex).every((prop) => prop.optional);
5100
5271
  }
5101
- var sortTypeRequiredFirst = createRule63({
5272
+ var sortTypeRequiredFirst = createRule67({
5102
5273
  name: "sort-type-required-first",
5103
5274
  meta: {
5104
5275
  type: "suggestion",
@@ -5116,7 +5287,7 @@ var sortTypeRequiredFirst = createRule63({
5116
5287
  function fixMembers(fixer, members) {
5117
5288
  const { sourceCode } = context;
5118
5289
  const properties = members.filter(
5119
- (member) => member.type === AST_NODE_TYPES63.TSPropertySignature && member.key.type === AST_NODE_TYPES63.Identifier
5290
+ (member) => member.type === AST_NODE_TYPES67.TSPropertySignature && member.key.type === AST_NODE_TYPES67.Identifier
5120
5291
  );
5121
5292
  const required = properties.filter((prop) => !prop.optional);
5122
5293
  const optional = properties.filter((prop) => prop.optional);
@@ -5137,7 +5308,7 @@ var sortTypeRequiredFirst = createRule63({
5137
5308
  }
5138
5309
  },
5139
5310
  TSTypeAliasDeclaration(node) {
5140
- if (node.typeAnnotation.type !== AST_NODE_TYPES63.TSTypeLiteral) {
5311
+ if (node.typeAnnotation.type !== AST_NODE_TYPES67.TSTypeLiteral) {
5141
5312
  return;
5142
5313
  }
5143
5314
  const { members } = node.typeAnnotation;
@@ -5165,12 +5336,14 @@ var rules = {
5165
5336
  "boolean-naming-prefix": boolean_naming_prefix_default,
5166
5337
  "enforce-camel-case": enforce_camel_case_default,
5167
5338
  "enforce-constant-case": enforce_constant_case_default,
5339
+ "enforce-hook-filename": enforce_hook_filename_default,
5168
5340
  "enforce-hook-naming": enforce_hook_naming_default,
5169
5341
  "enforce-property-case": enforce_property_case_default,
5170
5342
  "enforce-props-suffix": enforce_props_suffix_default,
5171
5343
  "enforce-readonly-component-props": enforce_readonly_component_props_default,
5172
5344
  "enforce-render-naming": enforce_render_naming_default,
5173
5345
  "enforce-service-naming": enforce_service_naming_default,
5346
+ "enforce-test-filename": enforce_test_filename_default,
5174
5347
  "enforce-sorted-destructuring": enforce_sorted_destructuring_default,
5175
5348
  "enforce-type-declaration-order": enforce_type_declaration_order_default,
5176
5349
  "index-export-only": index_export_only_default,
@@ -5194,6 +5367,8 @@ var rules = {
5194
5367
  "no-emoji": no_emoji_default,
5195
5368
  "no-env-fallback": no_env_fallback_default,
5196
5369
  "no-ghost-wrapper": no_ghost_wrapper_default,
5370
+ "no-helper-function-in-hook": no_helper_function_in_hook_default,
5371
+ "no-helper-function-in-test": no_helper_function_in_test_default,
5197
5372
  "no-inline-default-export": no_inline_default_export_default,
5198
5373
  "no-inline-nested-object": no_inline_nested_object_default,
5199
5374
  "no-inline-return-properties": no_inline_return_properties_default,
@@ -5234,9 +5409,11 @@ var baseRules = {
5234
5409
  "nextfriday/boolean-naming-prefix": "warn",
5235
5410
  "nextfriday/enforce-camel-case": "warn",
5236
5411
  "nextfriday/enforce-constant-case": "warn",
5412
+ "nextfriday/enforce-hook-filename": "warn",
5237
5413
  "nextfriday/enforce-hook-naming": "warn",
5238
5414
  "nextfriday/enforce-property-case": "warn",
5239
5415
  "nextfriday/enforce-service-naming": "warn",
5416
+ "nextfriday/enforce-test-filename": "warn",
5240
5417
  "nextfriday/enforce-sorted-destructuring": "warn",
5241
5418
  "nextfriday/enforce-type-declaration-order": "warn",
5242
5419
  "nextfriday/index-export-only": "warn",
@@ -5276,9 +5453,11 @@ var baseRecommendedRules = {
5276
5453
  "nextfriday/boolean-naming-prefix": "error",
5277
5454
  "nextfriday/enforce-camel-case": "error",
5278
5455
  "nextfriday/enforce-constant-case": "error",
5456
+ "nextfriday/enforce-hook-filename": "error",
5279
5457
  "nextfriday/enforce-hook-naming": "error",
5280
5458
  "nextfriday/enforce-property-case": "error",
5281
5459
  "nextfriday/enforce-service-naming": "error",
5460
+ "nextfriday/enforce-test-filename": "error",
5282
5461
  "nextfriday/enforce-sorted-destructuring": "error",
5283
5462
  "nextfriday/enforce-type-declaration-order": "error",
5284
5463
  "nextfriday/index-export-only": "error",