eslint-plugin-nextfriday 4.1.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.1.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;
@@ -765,9 +816,159 @@ var enforceReadonlyComponentProps = createRule7({
765
816
  });
766
817
  var enforce_readonly_component_props_default = enforceReadonlyComponentProps;
767
818
 
819
+ // src/rules/enforce-render-naming.ts
820
+ import { AST_NODE_TYPES as AST_NODE_TYPES10, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
821
+ var createRule9 = ESLintUtils9.RuleCreator(
822
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
823
+ );
824
+ var ARRAY_RETURNING_METHODS = /* @__PURE__ */ new Set(["map", "flatMap", "filter"]);
825
+ function hasRenderPrefix(name) {
826
+ if (!name.startsWith("render")) {
827
+ return false;
828
+ }
829
+ if (name.length === "render".length) {
830
+ return true;
831
+ }
832
+ const nextChar = name["render".length];
833
+ return nextChar === nextChar.toUpperCase() && nextChar !== nextChar.toLowerCase();
834
+ }
835
+ function functionBodyReturnsJsx(body) {
836
+ if (body.type === AST_NODE_TYPES10.JSXElement || body.type === AST_NODE_TYPES10.JSXFragment) {
837
+ return true;
838
+ }
839
+ if (body.type === AST_NODE_TYPES10.ConditionalExpression) {
840
+ return isJsxProducingExpression(body.consequent) || isJsxProducingExpression(body.alternate);
841
+ }
842
+ if (body.type === AST_NODE_TYPES10.LogicalExpression) {
843
+ return isJsxProducingExpression(body.right);
844
+ }
845
+ if (body.type !== AST_NODE_TYPES10.BlockStatement) {
846
+ return false;
847
+ }
848
+ for (const statement of body.body) {
849
+ if (statement.type === AST_NODE_TYPES10.ReturnStatement && statement.argument) {
850
+ if (isJsxProducingExpression(statement.argument)) {
851
+ return true;
852
+ }
853
+ }
854
+ }
855
+ return false;
856
+ }
857
+ function isJsxProducingExpression(node) {
858
+ if (node.type === AST_NODE_TYPES10.JSXElement || node.type === AST_NODE_TYPES10.JSXFragment) {
859
+ return true;
860
+ }
861
+ if (node.type === AST_NODE_TYPES10.ConditionalExpression) {
862
+ return isJsxProducingExpression(node.consequent) || isJsxProducingExpression(node.alternate);
863
+ }
864
+ if (node.type === AST_NODE_TYPES10.LogicalExpression) {
865
+ return isJsxProducingExpression(node.right);
866
+ }
867
+ if (node.type === AST_NODE_TYPES10.ArrayExpression) {
868
+ return node.elements.some((element) => {
869
+ if (!element || element.type === AST_NODE_TYPES10.SpreadElement) {
870
+ return false;
871
+ }
872
+ return isJsxProducingExpression(element);
873
+ });
874
+ }
875
+ if (node.type === AST_NODE_TYPES10.ArrowFunctionExpression || node.type === AST_NODE_TYPES10.FunctionExpression) {
876
+ return functionBodyReturnsJsx(node.body);
877
+ }
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)) {
880
+ const callback = node.arguments[0];
881
+ if (callback && (callback.type === AST_NODE_TYPES10.ArrowFunctionExpression || callback.type === AST_NODE_TYPES10.FunctionExpression)) {
882
+ return functionBodyReturnsJsx(callback.body);
883
+ }
884
+ }
885
+ }
886
+ if (node.type === AST_NODE_TYPES10.TSAsExpression || node.type === AST_NODE_TYPES10.TSSatisfiesExpression) {
887
+ return isJsxProducingExpression(node.expression);
888
+ }
889
+ return false;
890
+ }
891
+ function isPascalCase(name) {
892
+ return /^[A-Z]/.test(name);
893
+ }
894
+ function isComponentFunction2(node) {
895
+ if (node.type === AST_NODE_TYPES10.FunctionDeclaration && node.id && isPascalCase(node.id.name)) {
896
+ return true;
897
+ }
898
+ const parent = node.parent;
899
+ if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.id.type === AST_NODE_TYPES10.Identifier && isPascalCase(parent.id.name)) {
900
+ return true;
901
+ }
902
+ return false;
903
+ }
904
+ var enforceRenderNaming = createRule9({
905
+ name: "enforce-render-naming",
906
+ meta: {
907
+ type: "problem",
908
+ docs: {
909
+ description: "Enforce 'render' prefix for variables that hold or return JSX inside React components"
910
+ },
911
+ schema: [],
912
+ messages: {
913
+ missingRenderPrefix: "Variable '{{ name }}' holds JSX-producing content inside a component. Rename it to 'render{{ pascalName }}' so the intent is explicit."
914
+ }
915
+ },
916
+ defaultOptions: [],
917
+ create(context) {
918
+ const { filename } = context;
919
+ const extension = getFileExtension(filename);
920
+ if (extension !== "tsx" && extension !== "jsx") {
921
+ return {};
922
+ }
923
+ const componentStack = [];
924
+ function isInsideComponent() {
925
+ return componentStack.some((value) => value);
926
+ }
927
+ function pushFunction(node) {
928
+ componentStack.push(isComponentFunction2(node));
929
+ }
930
+ function popFunction() {
931
+ componentStack.pop();
932
+ }
933
+ return {
934
+ ArrowFunctionExpression: pushFunction,
935
+ FunctionDeclaration: pushFunction,
936
+ FunctionExpression: pushFunction,
937
+ "ArrowFunctionExpression:exit": popFunction,
938
+ "FunctionDeclaration:exit": popFunction,
939
+ "FunctionExpression:exit": popFunction,
940
+ VariableDeclarator(node) {
941
+ if (!isInsideComponent()) {
942
+ return;
943
+ }
944
+ if (node.id.type !== AST_NODE_TYPES10.Identifier) {
945
+ return;
946
+ }
947
+ if (!node.init) {
948
+ return;
949
+ }
950
+ if (!isJsxProducingExpression(node.init)) {
951
+ return;
952
+ }
953
+ const name = node.id.name;
954
+ if (hasRenderPrefix(name)) {
955
+ return;
956
+ }
957
+ const pascalName = name.charAt(0).toUpperCase() + name.slice(1);
958
+ context.report({
959
+ node: node.id,
960
+ messageId: "missingRenderPrefix",
961
+ data: { name, pascalName }
962
+ });
963
+ }
964
+ };
965
+ }
966
+ });
967
+ var enforce_render_naming_default = enforceRenderNaming;
968
+
768
969
  // src/rules/enforce-service-naming.ts
769
- import { AST_NODE_TYPES as AST_NODE_TYPES9, ESLintUtils as ESLintUtils8 } from "@typescript-eslint/utils";
770
- var createRule8 = ESLintUtils8.RuleCreator(
970
+ import { AST_NODE_TYPES as AST_NODE_TYPES11, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
971
+ var createRule10 = ESLintUtils10.RuleCreator(
771
972
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
772
973
  );
773
974
  var BANNED_PREFIXES = {
@@ -776,7 +977,7 @@ var BANNED_PREFIXES = {
776
977
  handle: ["create", "verify"],
777
978
  set: ["update", "save", "patch"]
778
979
  };
779
- var enforceServiceNaming = createRule8({
980
+ var enforceServiceNaming = createRule10({
780
981
  name: "enforce-service-naming",
781
982
  meta: {
782
983
  type: "suggestion",
@@ -819,12 +1020,12 @@ var enforceServiceNaming = createRule8({
819
1020
  };
820
1021
  return {
821
1022
  ExportNamedDeclaration(node) {
822
- if (node.declaration?.type === AST_NODE_TYPES9.FunctionDeclaration && node.declaration.id) {
1023
+ if (node.declaration?.type === AST_NODE_TYPES11.FunctionDeclaration && node.declaration.id) {
823
1024
  checkExportedFunction(node.declaration, node.declaration.id);
824
1025
  }
825
- if (node.declaration?.type === AST_NODE_TYPES9.VariableDeclaration) {
1026
+ if (node.declaration?.type === AST_NODE_TYPES11.VariableDeclaration) {
826
1027
  node.declaration.declarations.forEach((declarator) => {
827
- if (declarator.id.type === AST_NODE_TYPES9.Identifier && declarator.init?.type === AST_NODE_TYPES9.ArrowFunctionExpression) {
1028
+ if (declarator.id.type === AST_NODE_TYPES11.Identifier && declarator.init?.type === AST_NODE_TYPES11.ArrowFunctionExpression) {
828
1029
  checkExportedFunction(declarator.init, declarator.id);
829
1030
  }
830
1031
  });
@@ -835,12 +1036,52 @@ var enforceServiceNaming = createRule8({
835
1036
  });
836
1037
  var enforce_service_naming_default = enforceServiceNaming;
837
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
+
838
1079
  // src/rules/enforce-sorted-destructuring.ts
839
- import { AST_NODE_TYPES as AST_NODE_TYPES10, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
840
- var createRule9 = ESLintUtils9.RuleCreator(
1080
+ import { AST_NODE_TYPES as AST_NODE_TYPES13, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
1081
+ var createRule12 = ESLintUtils12.RuleCreator(
841
1082
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
842
1083
  );
843
- var enforceSortedDestructuring = createRule9({
1084
+ var enforceSortedDestructuring = createRule12({
844
1085
  name: "enforce-sorted-destructuring",
845
1086
  meta: {
846
1087
  type: "suggestion",
@@ -856,19 +1097,19 @@ var enforceSortedDestructuring = createRule9({
856
1097
  defaultOptions: [],
857
1098
  create(context) {
858
1099
  function getPropertyName(property) {
859
- if (property.type === AST_NODE_TYPES10.RestElement) {
1100
+ if (property.type === AST_NODE_TYPES13.RestElement) {
860
1101
  return null;
861
1102
  }
862
- if (property.key.type === AST_NODE_TYPES10.Identifier) {
1103
+ if (property.key.type === AST_NODE_TYPES13.Identifier) {
863
1104
  return property.key.name;
864
1105
  }
865
1106
  return null;
866
1107
  }
867
1108
  function hasDefaultValue(property) {
868
- return property.value.type === AST_NODE_TYPES10.AssignmentPattern && Boolean(property.value.right);
1109
+ return property.value.type === AST_NODE_TYPES13.AssignmentPattern && Boolean(property.value.right);
869
1110
  }
870
1111
  function checkVariableDeclarator(node) {
871
- if (node.id.type !== AST_NODE_TYPES10.ObjectPattern) {
1112
+ if (node.id.type !== AST_NODE_TYPES13.ObjectPattern) {
872
1113
  return;
873
1114
  }
874
1115
  const { properties } = node.id;
@@ -876,7 +1117,7 @@ var enforceSortedDestructuring = createRule9({
876
1117
  return;
877
1118
  }
878
1119
  const propertyInfo = properties.map((prop) => {
879
- if (prop.type === AST_NODE_TYPES10.RestElement) {
1120
+ if (prop.type === AST_NODE_TYPES13.RestElement) {
880
1121
  return null;
881
1122
  }
882
1123
  return {
@@ -915,20 +1156,20 @@ var enforceSortedDestructuring = createRule9({
915
1156
  var enforce_sorted_destructuring_default = enforceSortedDestructuring;
916
1157
 
917
1158
  // src/rules/enforce-type-declaration-order.ts
918
- import { AST_NODE_TYPES as AST_NODE_TYPES11, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
919
- var createRule10 = ESLintUtils10.RuleCreator(
1159
+ import { AST_NODE_TYPES as AST_NODE_TYPES14, ESLintUtils as ESLintUtils13 } from "@typescript-eslint/utils";
1160
+ var createRule13 = ESLintUtils13.RuleCreator(
920
1161
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
921
1162
  );
922
1163
  function getTypeDeclarationName(node) {
923
- if (node.type === AST_NODE_TYPES11.TSInterfaceDeclaration && node.id.type === AST_NODE_TYPES11.Identifier) {
1164
+ if (node.type === AST_NODE_TYPES14.TSInterfaceDeclaration && node.id.type === AST_NODE_TYPES14.Identifier) {
924
1165
  return { name: node.id.name, position: node.range[0] };
925
1166
  }
926
- if (node.type === AST_NODE_TYPES11.TSTypeAliasDeclaration && node.id.type === AST_NODE_TYPES11.Identifier) {
1167
+ if (node.type === AST_NODE_TYPES14.TSTypeAliasDeclaration && node.id.type === AST_NODE_TYPES14.Identifier) {
927
1168
  return { name: node.id.name, position: node.range[0] };
928
1169
  }
929
1170
  return null;
930
1171
  }
931
- var enforceTypeDeclarationOrder = createRule10({
1172
+ var enforceTypeDeclarationOrder = createRule13({
932
1173
  name: "enforce-type-declaration-order",
933
1174
  meta: {
934
1175
  type: "suggestion",
@@ -959,7 +1200,7 @@ var enforceTypeDeclarationOrder = createRule10({
959
1200
  }
960
1201
  },
961
1202
  "TSPropertySignature TSTypeReference": function checkTypeReference(node) {
962
- if (node.typeName.type !== AST_NODE_TYPES11.Identifier) {
1203
+ if (node.typeName.type !== AST_NODE_TYPES14.Identifier) {
963
1204
  return;
964
1205
  }
965
1206
  const referencedName = node.typeName.name;
@@ -996,8 +1237,8 @@ var enforceTypeDeclarationOrder = createRule10({
996
1237
  var enforce_type_declaration_order_default = enforceTypeDeclarationOrder;
997
1238
 
998
1239
  // src/rules/index-export-only.ts
999
- import { AST_NODE_TYPES as AST_NODE_TYPES12, ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
1000
- var createRule11 = ESLintUtils11.RuleCreator(
1240
+ import { AST_NODE_TYPES as AST_NODE_TYPES15, ESLintUtils as ESLintUtils14 } from "@typescript-eslint/utils";
1241
+ var createRule14 = ESLintUtils14.RuleCreator(
1001
1242
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1002
1243
  );
1003
1244
  var isIndexFile = (filename) => getBaseName(filename) === "index";
@@ -1005,26 +1246,26 @@ var isAllowedExportNamed = (node) => {
1005
1246
  if (!node.declaration) {
1006
1247
  return true;
1007
1248
  }
1008
- return node.declaration.type === AST_NODE_TYPES12.TSTypeAliasDeclaration || node.declaration.type === AST_NODE_TYPES12.TSInterfaceDeclaration;
1249
+ return node.declaration.type === AST_NODE_TYPES15.TSTypeAliasDeclaration || node.declaration.type === AST_NODE_TYPES15.TSInterfaceDeclaration;
1009
1250
  };
1010
- var isAllowedExportDefault = (node) => node.declaration.type === AST_NODE_TYPES12.Identifier;
1251
+ var isAllowedExportDefault = (node) => node.declaration.type === AST_NODE_TYPES15.Identifier;
1011
1252
  var isAllowedTopLevel = (node) => {
1012
1253
  switch (node.type) {
1013
- case AST_NODE_TYPES12.ImportDeclaration:
1014
- case AST_NODE_TYPES12.ExportAllDeclaration:
1015
- case AST_NODE_TYPES12.TSTypeAliasDeclaration:
1016
- case AST_NODE_TYPES12.TSInterfaceDeclaration:
1017
- case AST_NODE_TYPES12.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:
1018
1259
  return true;
1019
- case AST_NODE_TYPES12.ExportNamedDeclaration:
1260
+ case AST_NODE_TYPES15.ExportNamedDeclaration:
1020
1261
  return isAllowedExportNamed(node);
1021
- case AST_NODE_TYPES12.ExportDefaultDeclaration:
1262
+ case AST_NODE_TYPES15.ExportDefaultDeclaration:
1022
1263
  return isAllowedExportDefault(node);
1023
1264
  default:
1024
1265
  return false;
1025
1266
  }
1026
1267
  };
1027
- var indexExportOnly = createRule11({
1268
+ var indexExportOnly = createRule14({
1028
1269
  name: "index-export-only",
1029
1270
  meta: {
1030
1271
  type: "suggestion",
@@ -1058,11 +1299,11 @@ var indexExportOnly = createRule11({
1058
1299
  var index_export_only_default = indexExportOnly;
1059
1300
 
1060
1301
  // src/rules/jsx-newline-between-elements.ts
1061
- import { AST_NODE_TYPES as AST_NODE_TYPES13, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
1062
- var createRule12 = ESLintUtils12.RuleCreator(
1302
+ import { AST_NODE_TYPES as AST_NODE_TYPES16, ESLintUtils as ESLintUtils15 } from "@typescript-eslint/utils";
1303
+ var createRule15 = ESLintUtils15.RuleCreator(
1063
1304
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1064
1305
  );
1065
- var jsxNewlineBetweenElements = createRule12({
1306
+ var jsxNewlineBetweenElements = createRule15({
1066
1307
  name: "jsx-newline-between-elements",
1067
1308
  meta: {
1068
1309
  type: "layout",
@@ -1080,7 +1321,7 @@ var jsxNewlineBetweenElements = createRule12({
1080
1321
  create(context) {
1081
1322
  const { sourceCode } = context;
1082
1323
  function isSignificantJSXChild(node) {
1083
- return node.type === AST_NODE_TYPES13.JSXElement || node.type === AST_NODE_TYPES13.JSXFragment || node.type === AST_NODE_TYPES13.JSXExpressionContainer;
1324
+ return node.type === AST_NODE_TYPES16.JSXElement || node.type === AST_NODE_TYPES16.JSXFragment || node.type === AST_NODE_TYPES16.JSXExpressionContainer;
1084
1325
  }
1085
1326
  function isMultiLine(node) {
1086
1327
  return node.loc.start.line !== node.loc.end.line;
@@ -1129,12 +1370,194 @@ var jsxNewlineBetweenElements = createRule12({
1129
1370
  });
1130
1371
  var jsx_newline_between_elements_default = jsxNewlineBetweenElements;
1131
1372
 
1373
+ // src/rules/jsx-no-data-array.ts
1374
+ import { AST_NODE_TYPES as AST_NODE_TYPES17, ESLintUtils as ESLintUtils16 } from "@typescript-eslint/utils";
1375
+ var createRule16 = ESLintUtils16.RuleCreator(
1376
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1377
+ );
1378
+ function isObjectLikeElement(node) {
1379
+ if (!node) {
1380
+ return false;
1381
+ }
1382
+ if (node.type === AST_NODE_TYPES17.ObjectExpression) {
1383
+ return true;
1384
+ }
1385
+ if (node.type === AST_NODE_TYPES17.TSAsExpression || node.type === AST_NODE_TYPES17.TSSatisfiesExpression) {
1386
+ return isObjectLikeElement(node.expression);
1387
+ }
1388
+ return false;
1389
+ }
1390
+ function getArrayInitializer(init) {
1391
+ if (!init) {
1392
+ return null;
1393
+ }
1394
+ if (init.type === AST_NODE_TYPES17.ArrayExpression) {
1395
+ return init;
1396
+ }
1397
+ if (init.type === AST_NODE_TYPES17.TSAsExpression || init.type === AST_NODE_TYPES17.TSSatisfiesExpression) {
1398
+ return getArrayInitializer(init.expression);
1399
+ }
1400
+ return null;
1401
+ }
1402
+ var jsxNoDataArray = createRule16({
1403
+ name: "jsx-no-data-array",
1404
+ meta: {
1405
+ type: "problem",
1406
+ docs: {
1407
+ description: "Disallow top-level arrays of object literals in .tsx/.jsx files (extract to a data file)"
1408
+ },
1409
+ schema: [],
1410
+ messages: {
1411
+ noDataArray: "Top-level array of object literals belongs in a data file (e.g. *.data.ts), not a .tsx/.jsx component file. Extract '{{ name }}' to a sibling data module."
1412
+ }
1413
+ },
1414
+ defaultOptions: [],
1415
+ create(context) {
1416
+ const { filename } = context;
1417
+ const extension = getFileExtension(filename);
1418
+ if (extension !== "tsx" && extension !== "jsx") {
1419
+ return {};
1420
+ }
1421
+ return {
1422
+ "Program > VariableDeclaration > VariableDeclarator": function checkDeclarator(node) {
1423
+ const arrayInit = getArrayInitializer(node.init);
1424
+ if (!arrayInit) {
1425
+ return;
1426
+ }
1427
+ const hasObjectElement = arrayInit.elements.some((element) => isObjectLikeElement(element));
1428
+ if (!hasObjectElement) {
1429
+ return;
1430
+ }
1431
+ const name = node.id.type === AST_NODE_TYPES17.Identifier ? node.id.name : "<destructured>";
1432
+ context.report({
1433
+ node,
1434
+ messageId: "noDataArray",
1435
+ data: { name }
1436
+ });
1437
+ },
1438
+ "Program > ExportNamedDeclaration > VariableDeclaration > VariableDeclarator": function checkExportedDeclarator(node) {
1439
+ const arrayInit = getArrayInitializer(node.init);
1440
+ if (!arrayInit) {
1441
+ return;
1442
+ }
1443
+ const hasObjectElement = arrayInit.elements.some((element) => isObjectLikeElement(element));
1444
+ if (!hasObjectElement) {
1445
+ return;
1446
+ }
1447
+ const name = node.id.type === AST_NODE_TYPES17.Identifier ? node.id.name : "<destructured>";
1448
+ context.report({
1449
+ node,
1450
+ messageId: "noDataArray",
1451
+ data: { name }
1452
+ });
1453
+ }
1454
+ };
1455
+ }
1456
+ });
1457
+ var jsx_no_data_array_default = jsxNoDataArray;
1458
+
1459
+ // src/rules/jsx-no-data-object.ts
1460
+ import { AST_NODE_TYPES as AST_NODE_TYPES18, ESLintUtils as ESLintUtils17 } from "@typescript-eslint/utils";
1461
+ var createRule17 = ESLintUtils17.RuleCreator(
1462
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1463
+ );
1464
+ function unwrapAssertion(node) {
1465
+ if (!node) {
1466
+ return null;
1467
+ }
1468
+ if (node.type === AST_NODE_TYPES18.TSAsExpression || node.type === AST_NODE_TYPES18.TSSatisfiesExpression) {
1469
+ return unwrapAssertion(node.expression);
1470
+ }
1471
+ return node;
1472
+ }
1473
+ function isNestedValue(value) {
1474
+ const unwrapped = unwrapAssertion(value);
1475
+ if (!unwrapped) {
1476
+ return false;
1477
+ }
1478
+ if (unwrapped.type === AST_NODE_TYPES18.ObjectExpression) {
1479
+ return true;
1480
+ }
1481
+ if (unwrapped.type === AST_NODE_TYPES18.ArrayExpression) {
1482
+ return unwrapped.elements.some((element) => {
1483
+ if (!element || element.type === AST_NODE_TYPES18.SpreadElement) {
1484
+ return false;
1485
+ }
1486
+ const inner = unwrapAssertion(element);
1487
+ return inner?.type === AST_NODE_TYPES18.ObjectExpression || inner?.type === AST_NODE_TYPES18.ArrayExpression;
1488
+ });
1489
+ }
1490
+ return false;
1491
+ }
1492
+ function hasNestedProperty(object) {
1493
+ return object.properties.some((property) => {
1494
+ if (property.type !== AST_NODE_TYPES18.Property) {
1495
+ return false;
1496
+ }
1497
+ if (property.value.type === AST_NODE_TYPES18.AssignmentPattern) {
1498
+ return false;
1499
+ }
1500
+ return isNestedValue(property.value);
1501
+ });
1502
+ }
1503
+ function getObjectInitializer(init) {
1504
+ const unwrapped = unwrapAssertion(init);
1505
+ if (!unwrapped) {
1506
+ return null;
1507
+ }
1508
+ if (unwrapped.type === AST_NODE_TYPES18.ObjectExpression) {
1509
+ return unwrapped;
1510
+ }
1511
+ return null;
1512
+ }
1513
+ var jsxNoDataObject = createRule17({
1514
+ name: "jsx-no-data-object",
1515
+ meta: {
1516
+ type: "problem",
1517
+ docs: {
1518
+ description: "Disallow top-level nested object literals in .tsx/.jsx files (extract to a data file)"
1519
+ },
1520
+ schema: [],
1521
+ messages: {
1522
+ noDataObject: "Top-level nested object literal belongs in a data file (e.g. *.data.ts), not a .tsx/.jsx component file. Extract '{{ name }}' to a sibling data module."
1523
+ }
1524
+ },
1525
+ defaultOptions: [],
1526
+ create(context) {
1527
+ const { filename } = context;
1528
+ const extension = getFileExtension(filename);
1529
+ if (extension !== "tsx" && extension !== "jsx") {
1530
+ return {};
1531
+ }
1532
+ function checkDeclarator(node) {
1533
+ const objectInit = getObjectInitializer(node.init);
1534
+ if (!objectInit) {
1535
+ return;
1536
+ }
1537
+ if (!hasNestedProperty(objectInit)) {
1538
+ return;
1539
+ }
1540
+ const name = node.id.type === AST_NODE_TYPES18.Identifier ? node.id.name : "<destructured>";
1541
+ context.report({
1542
+ node,
1543
+ messageId: "noDataObject",
1544
+ data: { name }
1545
+ });
1546
+ }
1547
+ return {
1548
+ "Program > VariableDeclaration > VariableDeclarator": checkDeclarator,
1549
+ "Program > ExportNamedDeclaration > VariableDeclaration > VariableDeclarator": checkDeclarator
1550
+ };
1551
+ }
1552
+ });
1553
+ var jsx_no_data_object_default = jsxNoDataObject;
1554
+
1132
1555
  // src/rules/jsx-no-inline-object-prop.ts
1133
- import { AST_NODE_TYPES as AST_NODE_TYPES14, ESLintUtils as ESLintUtils13 } from "@typescript-eslint/utils";
1134
- var createRule13 = ESLintUtils13.RuleCreator(
1556
+ import { AST_NODE_TYPES as AST_NODE_TYPES19, ESLintUtils as ESLintUtils18 } from "@typescript-eslint/utils";
1557
+ var createRule18 = ESLintUtils18.RuleCreator(
1135
1558
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1136
1559
  );
1137
- var jsxNoInlineObjectProp = createRule13({
1560
+ var jsxNoInlineObjectProp = createRule18({
1138
1561
  name: "jsx-no-inline-object-prop",
1139
1562
  meta: {
1140
1563
  type: "suggestion",
@@ -1150,7 +1573,7 @@ var jsxNoInlineObjectProp = createRule13({
1150
1573
  create(context) {
1151
1574
  return {
1152
1575
  JSXAttribute(node) {
1153
- if (node.value?.type === AST_NODE_TYPES14.JSXExpressionContainer && node.value.expression.type === AST_NODE_TYPES14.ObjectExpression) {
1576
+ if (node.value?.type === AST_NODE_TYPES19.JSXExpressionContainer && node.value.expression.type === AST_NODE_TYPES19.ObjectExpression) {
1154
1577
  context.report({
1155
1578
  node: node.value,
1156
1579
  messageId: "noInlineObject"
@@ -1163,17 +1586,17 @@ var jsxNoInlineObjectProp = createRule13({
1163
1586
  var jsx_no_inline_object_prop_default = jsxNoInlineObjectProp;
1164
1587
 
1165
1588
  // src/rules/jsx-no-newline-single-line-elements.ts
1166
- import { AST_NODE_TYPES as AST_NODE_TYPES15, ESLintUtils as ESLintUtils14 } from "@typescript-eslint/utils";
1167
- var createRule14 = ESLintUtils14.RuleCreator(
1589
+ import { AST_NODE_TYPES as AST_NODE_TYPES20, ESLintUtils as ESLintUtils19 } from "@typescript-eslint/utils";
1590
+ var createRule19 = ESLintUtils19.RuleCreator(
1168
1591
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1169
1592
  );
1170
1593
  function isJSXElementOrFragment(node) {
1171
- return node.type === AST_NODE_TYPES15.JSXElement || node.type === AST_NODE_TYPES15.JSXFragment;
1594
+ return node.type === AST_NODE_TYPES20.JSXElement || node.type === AST_NODE_TYPES20.JSXFragment;
1172
1595
  }
1173
1596
  function isSingleLine(node) {
1174
1597
  return node.loc.start.line === node.loc.end.line;
1175
1598
  }
1176
- var jsxNoNewlineSingleLineElements = createRule14({
1599
+ var jsxNoNewlineSingleLineElements = createRule19({
1177
1600
  name: "jsx-no-newline-single-line-elements",
1178
1601
  meta: {
1179
1602
  type: "layout",
@@ -1191,7 +1614,7 @@ var jsxNoNewlineSingleLineElements = createRule14({
1191
1614
  const { sourceCode } = context;
1192
1615
  function checkSiblings(children) {
1193
1616
  const nonWhitespace = children.filter(
1194
- (child) => !(child.type === AST_NODE_TYPES15.JSXText && child.value.trim() === "")
1617
+ (child) => !(child.type === AST_NODE_TYPES20.JSXText && child.value.trim() === "")
1195
1618
  );
1196
1619
  nonWhitespace.forEach((next, index) => {
1197
1620
  if (index === 0) {
@@ -1242,20 +1665,137 @@ ${indent}`);
1242
1665
  var jsx_no_newline_single_line_elements_default = jsxNoNewlineSingleLineElements;
1243
1666
 
1244
1667
  // src/rules/jsx-no-non-component-function.ts
1245
- import { AST_NODE_TYPES as AST_NODE_TYPES16, ESLintUtils as ESLintUtils15 } from "@typescript-eslint/utils";
1246
- var createRule15 = ESLintUtils15.RuleCreator(
1668
+ import { AST_NODE_TYPES as AST_NODE_TYPES21, ESLintUtils as ESLintUtils20 } from "@typescript-eslint/utils";
1669
+ var createRule20 = ESLintUtils20.RuleCreator(
1247
1670
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1248
1671
  );
1249
- var jsxNoNonComponentFunction = createRule15({
1672
+ var jsxNoNonComponentFunction = createRule20({
1250
1673
  name: "jsx-no-non-component-function",
1251
1674
  meta: {
1252
1675
  type: "problem",
1253
1676
  docs: {
1254
- description: "Disallow non-component functions defined at top level in .tsx and .jsx files"
1677
+ description: "Disallow non-component functions defined at top level in .tsx and .jsx files"
1678
+ },
1679
+ schema: [],
1680
+ messages: {
1681
+ noTopLevelFunction: "Non-component functions should not be defined at top level in .tsx/.jsx files. Either move it inside the component or extract it to a separate file."
1682
+ }
1683
+ },
1684
+ defaultOptions: [],
1685
+ create(context) {
1686
+ const { filename } = context;
1687
+ const extension = getFileExtension(filename);
1688
+ if (extension !== "tsx" && extension !== "jsx") {
1689
+ return {};
1690
+ }
1691
+ function isReactComponent2(node) {
1692
+ const functionName = node.type === AST_NODE_TYPES21.FunctionDeclaration && node.id ? node.id.name : null;
1693
+ if (functionName && /^[A-Z]/.test(functionName)) {
1694
+ return true;
1695
+ }
1696
+ if (node.returnType?.typeAnnotation) {
1697
+ const returnTypeNode = node.returnType.typeAnnotation;
1698
+ if (returnTypeNode.type === AST_NODE_TYPES21.TSTypeReference && returnTypeNode.typeName.type === AST_NODE_TYPES21.Identifier) {
1699
+ const typeName = returnTypeNode.typeName.name;
1700
+ if (typeName === "JSX" || typeName === "ReactElement" || typeName === "ReactNode") {
1701
+ return true;
1702
+ }
1703
+ }
1704
+ }
1705
+ return false;
1706
+ }
1707
+ function checkTopLevelFunction(node, declaratorNode) {
1708
+ if (isReactComponent2(node)) {
1709
+ return;
1710
+ }
1711
+ const { parent } = node;
1712
+ if (!parent) {
1713
+ return;
1714
+ }
1715
+ if (parent.type === AST_NODE_TYPES21.ExportDefaultDeclaration || parent.type === AST_NODE_TYPES21.ExportNamedDeclaration) {
1716
+ return;
1717
+ }
1718
+ if (declaratorNode?.parent?.parent?.type === AST_NODE_TYPES21.ExportNamedDeclaration) {
1719
+ return;
1720
+ }
1721
+ if (declaratorNode?.id.type === AST_NODE_TYPES21.Identifier) {
1722
+ const varName = declaratorNode.id.name;
1723
+ if (/^[A-Z]/.test(varName)) {
1724
+ return;
1725
+ }
1726
+ }
1727
+ context.report({
1728
+ node: declaratorNode || node,
1729
+ messageId: "noTopLevelFunction"
1730
+ });
1731
+ }
1732
+ return {
1733
+ "Program > VariableDeclaration > VariableDeclarator > ArrowFunctionExpression": function checkArrowFunction(node) {
1734
+ const declarator = node.parent;
1735
+ checkTopLevelFunction(node, declarator);
1736
+ },
1737
+ "Program > FunctionDeclaration": function checkFunctionDeclaration(node) {
1738
+ checkTopLevelFunction(node);
1739
+ }
1740
+ };
1741
+ }
1742
+ });
1743
+ var jsx_no_non_component_function_default = jsxNoNonComponentFunction;
1744
+
1745
+ // src/rules/jsx-no-sub-interface.ts
1746
+ import { AST_NODE_TYPES as AST_NODE_TYPES22, ESLintUtils as ESLintUtils21 } from "@typescript-eslint/utils";
1747
+ var createRule21 = ESLintUtils21.RuleCreator(
1748
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1749
+ );
1750
+ var PROPS_WRAPPER_NAMES = /* @__PURE__ */ new Set(["Readonly", "Required", "Partial", "PropsWithChildren", "NoInfer"]);
1751
+ function unwrapWrapperType(node) {
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) {
1753
+ return unwrapWrapperType(node.typeArguments.params[0]);
1754
+ }
1755
+ return node;
1756
+ }
1757
+ function getMainTypeName(typeNode) {
1758
+ if (!typeNode) {
1759
+ return null;
1760
+ }
1761
+ const unwrapped = unwrapWrapperType(typeNode);
1762
+ if (unwrapped.type === AST_NODE_TYPES22.TSTypeReference && unwrapped.typeName.type === AST_NODE_TYPES22.Identifier) {
1763
+ return unwrapped.typeName.name;
1764
+ }
1765
+ return null;
1766
+ }
1767
+ function getComponentMainTypeName(node) {
1768
+ const firstParam = node.params[0];
1769
+ if (!firstParam) {
1770
+ return null;
1771
+ }
1772
+ if ("typeAnnotation" in firstParam && firstParam.typeAnnotation) {
1773
+ return getMainTypeName(firstParam.typeAnnotation.typeAnnotation);
1774
+ }
1775
+ return null;
1776
+ }
1777
+ function isPascalCase2(name) {
1778
+ return /^[A-Z]/.test(name);
1779
+ }
1780
+ function getDeclarationFromExportWrapper(node) {
1781
+ if (node.type === AST_NODE_TYPES22.ExportNamedDeclaration && node.declaration) {
1782
+ return node.declaration;
1783
+ }
1784
+ if (node.type === AST_NODE_TYPES22.ExportDefaultDeclaration) {
1785
+ return node.declaration;
1786
+ }
1787
+ return node;
1788
+ }
1789
+ var jsxNoSubInterface = createRule21({
1790
+ name: "jsx-no-sub-interface",
1791
+ meta: {
1792
+ type: "problem",
1793
+ docs: {
1794
+ description: "Disallow sub-interfaces and helper types in component files; keep only the main component props (extract the rest)"
1255
1795
  },
1256
1796
  schema: [],
1257
1797
  messages: {
1258
- noTopLevelFunction: "Non-component functions should not be defined at top level in .tsx/.jsx files. Either move it inside the component or extract it to a separate file."
1798
+ noSubInterface: "Sub-interface or helper type '{{ name }}' should not live in a component file. Extract it to a sibling module (e.g., a *.types.ts file or its own component file)."
1259
1799
  }
1260
1800
  },
1261
1801
  defaultOptions: [],
@@ -1265,75 +1805,83 @@ var jsxNoNonComponentFunction = createRule15({
1265
1805
  if (extension !== "tsx" && extension !== "jsx") {
1266
1806
  return {};
1267
1807
  }
1268
- function isReactComponent2(node) {
1269
- const functionName = node.type === AST_NODE_TYPES16.FunctionDeclaration && node.id ? node.id.name : null;
1270
- if (functionName && /^[A-Z]/.test(functionName)) {
1271
- return true;
1272
- }
1273
- if (node.returnType?.typeAnnotation) {
1274
- const returnTypeNode = node.returnType.typeAnnotation;
1275
- if (returnTypeNode.type === AST_NODE_TYPES16.TSTypeReference && returnTypeNode.typeName.type === AST_NODE_TYPES16.Identifier) {
1276
- const typeName = returnTypeNode.typeName.name;
1277
- if (typeName === "JSX" || typeName === "ReactElement" || typeName === "ReactNode") {
1278
- return true;
1808
+ return {
1809
+ Program(programNode) {
1810
+ const mainTypes = /* @__PURE__ */ new Set();
1811
+ const typeDeclarations = [];
1812
+ let componentCount = 0;
1813
+ for (const statement of programNode.body) {
1814
+ const declaration = getDeclarationFromExportWrapper(statement);
1815
+ if (declaration.type === AST_NODE_TYPES22.FunctionDeclaration && declaration.id && isPascalCase2(declaration.id.name)) {
1816
+ componentCount += 1;
1817
+ const mainType = getComponentMainTypeName(declaration);
1818
+ if (mainType) {
1819
+ mainTypes.add(mainType);
1820
+ }
1821
+ continue;
1822
+ }
1823
+ if (declaration.type === AST_NODE_TYPES22.VariableDeclaration) {
1824
+ for (const declarator of declaration.declarations) {
1825
+ if (declarator.id.type !== AST_NODE_TYPES22.Identifier) {
1826
+ continue;
1827
+ }
1828
+ if (!isPascalCase2(declarator.id.name)) {
1829
+ continue;
1830
+ }
1831
+ const init = declarator.init;
1832
+ if (init && (init.type === AST_NODE_TYPES22.ArrowFunctionExpression || init.type === AST_NODE_TYPES22.FunctionExpression)) {
1833
+ componentCount += 1;
1834
+ const mainType = getComponentMainTypeName(init);
1835
+ if (mainType) {
1836
+ mainTypes.add(mainType);
1837
+ }
1838
+ }
1839
+ }
1840
+ continue;
1841
+ }
1842
+ if (declaration.type === AST_NODE_TYPES22.TSInterfaceDeclaration) {
1843
+ typeDeclarations.push({ name: declaration.id.name, node: declaration });
1844
+ continue;
1845
+ }
1846
+ if (declaration.type === AST_NODE_TYPES22.TSTypeAliasDeclaration) {
1847
+ typeDeclarations.push({ name: declaration.id.name, node: declaration });
1848
+ continue;
1279
1849
  }
1280
1850
  }
1281
- }
1282
- return false;
1283
- }
1284
- function checkTopLevelFunction(node, declaratorNode) {
1285
- if (isReactComponent2(node)) {
1286
- return;
1287
- }
1288
- const { parent } = node;
1289
- if (!parent) {
1290
- return;
1291
- }
1292
- if (parent.type === AST_NODE_TYPES16.ExportDefaultDeclaration || parent.type === AST_NODE_TYPES16.ExportNamedDeclaration) {
1293
- return;
1294
- }
1295
- if (declaratorNode?.parent?.parent?.type === AST_NODE_TYPES16.ExportNamedDeclaration) {
1296
- return;
1297
- }
1298
- if (declaratorNode?.id.type === AST_NODE_TYPES16.Identifier) {
1299
- const varName = declaratorNode.id.name;
1300
- if (/^[A-Z]/.test(varName)) {
1851
+ if (componentCount === 0) {
1301
1852
  return;
1302
1853
  }
1303
- }
1304
- context.report({
1305
- node: declaratorNode || node,
1306
- messageId: "noTopLevelFunction"
1307
- });
1308
- }
1309
- return {
1310
- "Program > VariableDeclaration > VariableDeclarator > ArrowFunctionExpression": function checkArrowFunction(node) {
1311
- const declarator = node.parent;
1312
- checkTopLevelFunction(node, declarator);
1313
- },
1314
- "Program > FunctionDeclaration": function checkFunctionDeclaration(node) {
1315
- checkTopLevelFunction(node);
1854
+ for (const declaration of typeDeclarations) {
1855
+ if (mainTypes.has(declaration.name)) {
1856
+ continue;
1857
+ }
1858
+ context.report({
1859
+ node: declaration.node,
1860
+ messageId: "noSubInterface",
1861
+ data: { name: declaration.name }
1862
+ });
1863
+ }
1316
1864
  }
1317
1865
  };
1318
1866
  }
1319
1867
  });
1320
- var jsx_no_non_component_function_default = jsxNoNonComponentFunction;
1868
+ var jsx_no_sub_interface_default = jsxNoSubInterface;
1321
1869
 
1322
1870
  // src/rules/jsx-no-ternary-null.ts
1323
- import { AST_NODE_TYPES as AST_NODE_TYPES17, ESLintUtils as ESLintUtils16 } from "@typescript-eslint/utils";
1324
- var createRule16 = ESLintUtils16.RuleCreator(
1871
+ import { AST_NODE_TYPES as AST_NODE_TYPES23, ESLintUtils as ESLintUtils22 } from "@typescript-eslint/utils";
1872
+ var createRule22 = ESLintUtils22.RuleCreator(
1325
1873
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1326
1874
  );
1327
1875
  function isNullOrUndefined(node) {
1328
- if (node.type === AST_NODE_TYPES17.Literal && node.value === null) {
1876
+ if (node.type === AST_NODE_TYPES23.Literal && node.value === null) {
1329
1877
  return true;
1330
1878
  }
1331
- if (node.type === AST_NODE_TYPES17.Identifier && node.name === "undefined") {
1879
+ if (node.type === AST_NODE_TYPES23.Identifier && node.name === "undefined") {
1332
1880
  return true;
1333
1881
  }
1334
1882
  return false;
1335
1883
  }
1336
- var jsxNoTernaryNull = createRule16({
1884
+ var jsxNoTernaryNull = createRule22({
1337
1885
  name: "jsx-no-ternary-null",
1338
1886
  meta: {
1339
1887
  type: "suggestion",
@@ -1351,7 +1899,7 @@ var jsxNoTernaryNull = createRule16({
1351
1899
  return {
1352
1900
  JSXExpressionContainer(node) {
1353
1901
  const { expression } = node;
1354
- if (expression.type !== AST_NODE_TYPES17.ConditionalExpression) {
1902
+ if (expression.type !== AST_NODE_TYPES23.ConditionalExpression) {
1355
1903
  return;
1356
1904
  }
1357
1905
  const { test, consequent, alternate } = expression;
@@ -1383,11 +1931,11 @@ var jsxNoTernaryNull = createRule16({
1383
1931
  var jsx_no_ternary_null_default = jsxNoTernaryNull;
1384
1932
 
1385
1933
  // src/rules/jsx-no-variable-in-callback.ts
1386
- import { AST_NODE_TYPES as AST_NODE_TYPES18, ESLintUtils as ESLintUtils17 } from "@typescript-eslint/utils";
1387
- var createRule17 = ESLintUtils17.RuleCreator(
1934
+ import { AST_NODE_TYPES as AST_NODE_TYPES24, ESLintUtils as ESLintUtils23 } from "@typescript-eslint/utils";
1935
+ var createRule23 = ESLintUtils23.RuleCreator(
1388
1936
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1389
1937
  );
1390
- var jsxNoVariableInCallback = createRule17({
1938
+ var jsxNoVariableInCallback = createRule23({
1391
1939
  name: "jsx-no-variable-in-callback",
1392
1940
  meta: {
1393
1941
  type: "suggestion",
@@ -1404,7 +1952,7 @@ var jsxNoVariableInCallback = createRule17({
1404
1952
  function isInsideJSX(node) {
1405
1953
  let current = node.parent;
1406
1954
  while (current) {
1407
- if (current.type === AST_NODE_TYPES18.JSXElement || current.type === AST_NODE_TYPES18.JSXFragment) {
1955
+ if (current.type === AST_NODE_TYPES24.JSXElement || current.type === AST_NODE_TYPES24.JSXFragment) {
1408
1956
  return true;
1409
1957
  }
1410
1958
  current = current.parent;
@@ -1418,11 +1966,11 @@ var jsxNoVariableInCallback = createRule17({
1418
1966
  if (!isInsideJSX(node)) {
1419
1967
  return false;
1420
1968
  }
1421
- if (node.parent.type === AST_NODE_TYPES18.CallExpression || node.parent.type === AST_NODE_TYPES18.JSXExpressionContainer) {
1969
+ if (node.parent.type === AST_NODE_TYPES24.CallExpression || node.parent.type === AST_NODE_TYPES24.JSXExpressionContainer) {
1422
1970
  return true;
1423
1971
  }
1424
- if (node.parent.type === AST_NODE_TYPES18.ArrayExpression && node.parent.parent) {
1425
- if (node.parent.parent.type === AST_NODE_TYPES18.CallExpression || node.parent.parent.type === AST_NODE_TYPES18.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) {
1426
1974
  return true;
1427
1975
  }
1428
1976
  }
@@ -1433,11 +1981,11 @@ var jsxNoVariableInCallback = createRule17({
1433
1981
  return;
1434
1982
  }
1435
1983
  const { body } = node;
1436
- if (body.type !== AST_NODE_TYPES18.BlockStatement) {
1984
+ if (body.type !== AST_NODE_TYPES24.BlockStatement) {
1437
1985
  return;
1438
1986
  }
1439
1987
  body.body.forEach((statement) => {
1440
- if (statement.type === AST_NODE_TYPES18.VariableDeclaration) {
1988
+ if (statement.type === AST_NODE_TYPES24.VariableDeclaration) {
1441
1989
  context.report({
1442
1990
  node: statement,
1443
1991
  messageId: "noVariableInCallback"
@@ -1454,11 +2002,11 @@ var jsxNoVariableInCallback = createRule17({
1454
2002
  var jsx_no_variable_in_callback_default = jsxNoVariableInCallback;
1455
2003
 
1456
2004
  // src/rules/jsx-require-suspense.ts
1457
- import { AST_NODE_TYPES as AST_NODE_TYPES19, ESLintUtils as ESLintUtils18 } from "@typescript-eslint/utils";
1458
- var createRule18 = ESLintUtils18.RuleCreator(
2005
+ import { AST_NODE_TYPES as AST_NODE_TYPES25, ESLintUtils as ESLintUtils24 } from "@typescript-eslint/utils";
2006
+ var createRule24 = ESLintUtils24.RuleCreator(
1459
2007
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1460
2008
  );
1461
- var jsxRequireSuspense = createRule18({
2009
+ var jsxRequireSuspense = createRule24({
1462
2010
  name: "jsx-require-suspense",
1463
2011
  meta: {
1464
2012
  type: "problem",
@@ -1476,7 +2024,7 @@ var jsxRequireSuspense = createRule18({
1476
2024
  const isInsideSuspense = (node) => {
1477
2025
  let current = node.parent;
1478
2026
  while (current) {
1479
- if (current.type === AST_NODE_TYPES19.JSXElement && current.openingElement.name.type === AST_NODE_TYPES19.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") {
1480
2028
  return true;
1481
2029
  }
1482
2030
  current = current.parent;
@@ -1485,16 +2033,16 @@ var jsxRequireSuspense = createRule18({
1485
2033
  };
1486
2034
  return {
1487
2035
  VariableDeclarator(node) {
1488
- if (node.id.type === AST_NODE_TYPES19.Identifier && node.init?.type === AST_NODE_TYPES19.CallExpression) {
2036
+ if (node.id.type === AST_NODE_TYPES25.Identifier && node.init?.type === AST_NODE_TYPES25.CallExpression) {
1489
2037
  const { callee } = node.init;
1490
- const isLazyCall = callee.type === AST_NODE_TYPES19.Identifier && callee.name === "lazy" || callee.type === AST_NODE_TYPES19.MemberExpression && callee.object.type === AST_NODE_TYPES19.Identifier && callee.object.name === "React" && callee.property.type === AST_NODE_TYPES19.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";
1491
2039
  if (isLazyCall) {
1492
2040
  lazyComponents.add(node.id.name);
1493
2041
  }
1494
2042
  }
1495
2043
  },
1496
2044
  JSXOpeningElement(node) {
1497
- if (node.name.type === AST_NODE_TYPES19.JSXIdentifier) {
2045
+ if (node.name.type === AST_NODE_TYPES25.JSXIdentifier) {
1498
2046
  const componentName = node.name.name;
1499
2047
  if (lazyComponents.has(componentName) && !isInsideSuspense(node)) {
1500
2048
  context.report({
@@ -1513,11 +2061,11 @@ var jsxRequireSuspense = createRule18({
1513
2061
  var jsx_require_suspense_default = jsxRequireSuspense;
1514
2062
 
1515
2063
  // src/rules/jsx-simple-props.ts
1516
- import { AST_NODE_TYPES as AST_NODE_TYPES20, ESLintUtils as ESLintUtils19 } from "@typescript-eslint/utils";
1517
- var createRule19 = ESLintUtils19.RuleCreator(
2064
+ import { AST_NODE_TYPES as AST_NODE_TYPES26, ESLintUtils as ESLintUtils25 } from "@typescript-eslint/utils";
2065
+ var createRule25 = ESLintUtils25.RuleCreator(
1518
2066
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1519
2067
  );
1520
- var jsxSimpleProps = createRule19({
2068
+ var jsxSimpleProps = createRule25({
1521
2069
  name: "jsx-simple-props",
1522
2070
  meta: {
1523
2071
  type: "suggestion",
@@ -1532,25 +2080,25 @@ var jsxSimpleProps = createRule19({
1532
2080
  defaultOptions: [],
1533
2081
  create(context) {
1534
2082
  const allowedExpressionTypes = /* @__PURE__ */ new Set([
1535
- AST_NODE_TYPES20.Identifier,
1536
- AST_NODE_TYPES20.Literal,
1537
- AST_NODE_TYPES20.JSXElement,
1538
- AST_NODE_TYPES20.JSXFragment,
1539
- AST_NODE_TYPES20.MemberExpression,
1540
- AST_NODE_TYPES20.ArrowFunctionExpression,
1541
- AST_NODE_TYPES20.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
1542
2090
  ]);
1543
2091
  return {
1544
2092
  JSXAttribute(node) {
1545
2093
  if (!node.value) {
1546
2094
  return;
1547
2095
  }
1548
- if (node.value.type === AST_NODE_TYPES20.Literal) {
2096
+ if (node.value.type === AST_NODE_TYPES26.Literal) {
1549
2097
  return;
1550
2098
  }
1551
- if (node.value.type === AST_NODE_TYPES20.JSXExpressionContainer) {
2099
+ if (node.value.type === AST_NODE_TYPES26.JSXExpressionContainer) {
1552
2100
  const { expression } = node.value;
1553
- if (expression.type === AST_NODE_TYPES20.JSXEmptyExpression) {
2101
+ if (expression.type === AST_NODE_TYPES26.JSXEmptyExpression) {
1554
2102
  return;
1555
2103
  }
1556
2104
  if (!allowedExpressionTypes.has(expression.type)) {
@@ -1567,8 +2115,8 @@ var jsxSimpleProps = createRule19({
1567
2115
  var jsx_simple_props_default = jsxSimpleProps;
1568
2116
 
1569
2117
  // src/rules/jsx-sort-props.ts
1570
- import { AST_NODE_TYPES as AST_NODE_TYPES21, ESLintUtils as ESLintUtils20 } from "@typescript-eslint/utils";
1571
- var createRule20 = ESLintUtils20.RuleCreator(
2118
+ import { AST_NODE_TYPES as AST_NODE_TYPES27, ESLintUtils as ESLintUtils26 } from "@typescript-eslint/utils";
2119
+ var createRule26 = ESLintUtils26.RuleCreator(
1572
2120
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1573
2121
  );
1574
2122
  var TYPE_GROUP = {
@@ -1582,15 +2130,15 @@ var TYPE_GROUP = {
1582
2130
  SHORTHAND: 8
1583
2131
  };
1584
2132
  var EXPRESSION_TYPE_TO_GROUP = /* @__PURE__ */ new Map([
1585
- [AST_NODE_TYPES21.ObjectExpression, TYPE_GROUP.OBJECT_ARRAY],
1586
- [AST_NODE_TYPES21.ArrayExpression, TYPE_GROUP.OBJECT_ARRAY],
1587
- [AST_NODE_TYPES21.ArrowFunctionExpression, TYPE_GROUP.FUNCTION],
1588
- [AST_NODE_TYPES21.FunctionExpression, TYPE_GROUP.FUNCTION],
1589
- [AST_NODE_TYPES21.JSXElement, TYPE_GROUP.JSX],
1590
- [AST_NODE_TYPES21.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]
1591
2139
  ]);
1592
2140
  function isHyphenatedName(node) {
1593
- return node.name.type === AST_NODE_TYPES21.JSXIdentifier && node.name.name.includes("-");
2141
+ return node.name.type === AST_NODE_TYPES27.JSXIdentifier && node.name.name.includes("-");
1594
2142
  }
1595
2143
  function getStringGroup(node) {
1596
2144
  return isHyphenatedName(node) ? TYPE_GROUP.HYPHENATED_STRING : TYPE_GROUP.STRING;
@@ -1602,13 +2150,13 @@ function getLiteralValueGroup(value) {
1602
2150
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
1603
2151
  }
1604
2152
  function getExpressionGroup(expression) {
1605
- if (expression.type === AST_NODE_TYPES21.Literal) {
2153
+ if (expression.type === AST_NODE_TYPES27.Literal) {
1606
2154
  return getLiteralValueGroup(expression.value);
1607
2155
  }
1608
- if (expression.type === AST_NODE_TYPES21.TemplateLiteral) {
2156
+ if (expression.type === AST_NODE_TYPES27.TemplateLiteral) {
1609
2157
  return null;
1610
2158
  }
1611
- if (expression.type === AST_NODE_TYPES21.Identifier && expression.name === "undefined") {
2159
+ if (expression.type === AST_NODE_TYPES27.Identifier && expression.name === "undefined") {
1612
2160
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
1613
2161
  }
1614
2162
  return EXPRESSION_TYPE_TO_GROUP.get(expression.type) ?? TYPE_GROUP.EXPRESSION;
@@ -1617,17 +2165,17 @@ function getTypeGroup(node) {
1617
2165
  if (node.value === null) {
1618
2166
  return TYPE_GROUP.SHORTHAND;
1619
2167
  }
1620
- if (node.value.type === AST_NODE_TYPES21.Literal) {
2168
+ if (node.value.type === AST_NODE_TYPES27.Literal) {
1621
2169
  if (typeof node.value.value === "string") {
1622
2170
  return getStringGroup(node);
1623
2171
  }
1624
2172
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
1625
2173
  }
1626
- if (node.value.type !== AST_NODE_TYPES21.JSXExpressionContainer) {
2174
+ if (node.value.type !== AST_NODE_TYPES27.JSXExpressionContainer) {
1627
2175
  return null;
1628
2176
  }
1629
2177
  const { expression } = node.value;
1630
- if (expression.type === AST_NODE_TYPES21.JSXEmptyExpression) {
2178
+ if (expression.type === AST_NODE_TYPES27.JSXEmptyExpression) {
1631
2179
  return null;
1632
2180
  }
1633
2181
  const group = getExpressionGroup(expression);
@@ -1639,7 +2187,7 @@ function getTypeGroup(node) {
1639
2187
  function hasUnsortedProps(attributes) {
1640
2188
  let lastGroup = 0;
1641
2189
  return attributes.some((attribute) => {
1642
- if (attribute.type === AST_NODE_TYPES21.JSXSpreadAttribute) {
2190
+ if (attribute.type === AST_NODE_TYPES27.JSXSpreadAttribute) {
1643
2191
  lastGroup = 0;
1644
2192
  return false;
1645
2193
  }
@@ -1663,7 +2211,7 @@ function getSegments(attributes) {
1663
2211
  const result = [];
1664
2212
  let current = [];
1665
2213
  attributes.forEach((attr) => {
1666
- if (attr.type === AST_NODE_TYPES21.JSXSpreadAttribute) {
2214
+ if (attr.type === AST_NODE_TYPES27.JSXSpreadAttribute) {
1667
2215
  if (current.length > 0) {
1668
2216
  result.push(current);
1669
2217
  current = [];
@@ -1677,7 +2225,7 @@ function getSegments(attributes) {
1677
2225
  }
1678
2226
  return result;
1679
2227
  }
1680
- var jsxSortProps = createRule20({
2228
+ var jsxSortProps = createRule26({
1681
2229
  name: "jsx-sort-props",
1682
2230
  meta: {
1683
2231
  type: "suggestion",
@@ -1712,11 +2260,11 @@ var jsxSortProps = createRule20({
1712
2260
  var jsx_sort_props_default = jsxSortProps;
1713
2261
 
1714
2262
  // src/rules/jsx-spread-props-last.ts
1715
- import { AST_NODE_TYPES as AST_NODE_TYPES22, ESLintUtils as ESLintUtils21 } from "@typescript-eslint/utils";
1716
- var createRule21 = ESLintUtils21.RuleCreator(
2263
+ import { AST_NODE_TYPES as AST_NODE_TYPES28, ESLintUtils as ESLintUtils27 } from "@typescript-eslint/utils";
2264
+ var createRule27 = ESLintUtils27.RuleCreator(
1717
2265
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1718
2266
  );
1719
- var jsxSpreadPropsLast = createRule21({
2267
+ var jsxSpreadPropsLast = createRule27({
1720
2268
  name: "jsx-spread-props-last",
1721
2269
  meta: {
1722
2270
  type: "suggestion",
@@ -1735,12 +2283,12 @@ var jsxSpreadPropsLast = createRule21({
1735
2283
  const { attributes } = node;
1736
2284
  let lastNonSpreadIndex = -1;
1737
2285
  attributes.forEach((attribute, index) => {
1738
- if (attribute.type !== AST_NODE_TYPES22.JSXSpreadAttribute) {
2286
+ if (attribute.type !== AST_NODE_TYPES28.JSXSpreadAttribute) {
1739
2287
  lastNonSpreadIndex = index;
1740
2288
  }
1741
2289
  });
1742
2290
  attributes.forEach((attribute, index) => {
1743
- if (attribute.type === AST_NODE_TYPES22.JSXSpreadAttribute && index < lastNonSpreadIndex) {
2291
+ if (attribute.type === AST_NODE_TYPES28.JSXSpreadAttribute && index < lastNonSpreadIndex) {
1744
2292
  context.report({
1745
2293
  node: attribute,
1746
2294
  messageId: "spreadNotLast"
@@ -1754,12 +2302,12 @@ var jsxSpreadPropsLast = createRule21({
1754
2302
  var jsx_spread_props_last_default = jsxSpreadPropsLast;
1755
2303
 
1756
2304
  // src/rules/newline-after-multiline-block.ts
1757
- import { AST_NODE_TYPES as AST_NODE_TYPES23, ESLintUtils as ESLintUtils22 } from "@typescript-eslint/utils";
1758
- var createRule22 = ESLintUtils22.RuleCreator(
2305
+ import { AST_NODE_TYPES as AST_NODE_TYPES29, ESLintUtils as ESLintUtils28 } from "@typescript-eslint/utils";
2306
+ var createRule28 = ESLintUtils28.RuleCreator(
1759
2307
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1760
2308
  );
1761
2309
  function isImportDeclaration(node) {
1762
- return node.type === AST_NODE_TYPES23.ImportDeclaration;
2310
+ return node.type === AST_NODE_TYPES29.ImportDeclaration;
1763
2311
  }
1764
2312
  function checkStatements(statements, context) {
1765
2313
  const { sourceCode } = context;
@@ -1794,7 +2342,7 @@ function checkStatements(statements, context) {
1794
2342
  }
1795
2343
  });
1796
2344
  }
1797
- var newlineAfterMultilineBlock = createRule22({
2345
+ var newlineAfterMultilineBlock = createRule28({
1798
2346
  name: "newline-after-multiline-block",
1799
2347
  meta: {
1800
2348
  type: "layout",
@@ -1822,11 +2370,11 @@ var newlineAfterMultilineBlock = createRule22({
1822
2370
  var newline_after_multiline_block_default = newlineAfterMultilineBlock;
1823
2371
 
1824
2372
  // src/rules/newline-before-return.ts
1825
- import { AST_NODE_TYPES as AST_NODE_TYPES24, ESLintUtils as ESLintUtils23 } from "@typescript-eslint/utils";
1826
- var createRule23 = ESLintUtils23.RuleCreator(
2373
+ import { AST_NODE_TYPES as AST_NODE_TYPES30, ESLintUtils as ESLintUtils29 } from "@typescript-eslint/utils";
2374
+ var createRule29 = ESLintUtils29.RuleCreator(
1827
2375
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1828
2376
  );
1829
- var newlineBeforeReturn = createRule23({
2377
+ var newlineBeforeReturn = createRule29({
1830
2378
  name: "newline-before-return",
1831
2379
  meta: {
1832
2380
  type: "layout",
@@ -1844,7 +2392,7 @@ var newlineBeforeReturn = createRule23({
1844
2392
  const { sourceCode } = context;
1845
2393
  function checkReturnStatement(node) {
1846
2394
  const { parent } = node;
1847
- if (!parent || parent.type !== AST_NODE_TYPES24.BlockStatement) {
2395
+ if (!parent || parent.type !== AST_NODE_TYPES30.BlockStatement) {
1848
2396
  return;
1849
2397
  }
1850
2398
  const { body: statements } = parent;
@@ -1881,11 +2429,11 @@ var newlineBeforeReturn = createRule23({
1881
2429
  var newline_before_return_default = newlineBeforeReturn;
1882
2430
 
1883
2431
  // src/rules/no-complex-inline-return.ts
1884
- import { AST_NODE_TYPES as AST_NODE_TYPES25, ESLintUtils as ESLintUtils24 } from "@typescript-eslint/utils";
1885
- var createRule24 = ESLintUtils24.RuleCreator(
2432
+ import { AST_NODE_TYPES as AST_NODE_TYPES31, ESLintUtils as ESLintUtils30 } from "@typescript-eslint/utils";
2433
+ var createRule30 = ESLintUtils30.RuleCreator(
1886
2434
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1887
2435
  );
1888
- var noComplexInlineReturn = createRule24({
2436
+ var noComplexInlineReturn = createRule30({
1889
2437
  name: "no-complex-inline-return",
1890
2438
  meta: {
1891
2439
  type: "suggestion",
@@ -1901,13 +2449,13 @@ var noComplexInlineReturn = createRule24({
1901
2449
  create(context) {
1902
2450
  const isComplexExpression = (node) => {
1903
2451
  if (!node) return false;
1904
- if (node.type === AST_NODE_TYPES25.ConditionalExpression) {
2452
+ if (node.type === AST_NODE_TYPES31.ConditionalExpression) {
1905
2453
  return true;
1906
2454
  }
1907
- if (node.type === AST_NODE_TYPES25.LogicalExpression) {
2455
+ if (node.type === AST_NODE_TYPES31.LogicalExpression) {
1908
2456
  return true;
1909
2457
  }
1910
- if (node.type === AST_NODE_TYPES25.NewExpression) {
2458
+ if (node.type === AST_NODE_TYPES31.NewExpression) {
1911
2459
  return true;
1912
2460
  }
1913
2461
  return false;
@@ -1927,11 +2475,11 @@ var noComplexInlineReturn = createRule24({
1927
2475
  var no_complex_inline_return_default = noComplexInlineReturn;
1928
2476
 
1929
2477
  // src/rules/no-direct-date.ts
1930
- import { AST_NODE_TYPES as AST_NODE_TYPES26, ESLintUtils as ESLintUtils25 } from "@typescript-eslint/utils";
1931
- var createRule25 = ESLintUtils25.RuleCreator(
2478
+ import { AST_NODE_TYPES as AST_NODE_TYPES32, ESLintUtils as ESLintUtils31 } from "@typescript-eslint/utils";
2479
+ var createRule31 = ESLintUtils31.RuleCreator(
1932
2480
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1933
2481
  );
1934
- var noDirectDate = createRule25({
2482
+ var noDirectDate = createRule31({
1935
2483
  name: "no-direct-date",
1936
2484
  meta: {
1937
2485
  type: "problem",
@@ -1949,7 +2497,7 @@ var noDirectDate = createRule25({
1949
2497
  create(context) {
1950
2498
  return {
1951
2499
  NewExpression(node) {
1952
- if (node.callee.type === AST_NODE_TYPES26.Identifier && node.callee.name === "Date") {
2500
+ if (node.callee.type === AST_NODE_TYPES32.Identifier && node.callee.name === "Date") {
1953
2501
  context.report({
1954
2502
  node,
1955
2503
  messageId: "noNewDate"
@@ -1957,7 +2505,7 @@ var noDirectDate = createRule25({
1957
2505
  }
1958
2506
  },
1959
2507
  CallExpression(node) {
1960
- if (node.callee.type === AST_NODE_TYPES26.MemberExpression && node.callee.object.type === AST_NODE_TYPES26.Identifier && node.callee.object.name === "Date" && node.callee.property.type === AST_NODE_TYPES26.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) {
1961
2509
  const methodName = node.callee.property.name;
1962
2510
  if (methodName === "now") {
1963
2511
  context.report({
@@ -1980,11 +2528,11 @@ var no_direct_date_default = noDirectDate;
1980
2528
 
1981
2529
  // src/rules/no-emoji.ts
1982
2530
  import emojiRegex from "emoji-regex";
1983
- import { ESLintUtils as ESLintUtils26 } from "@typescript-eslint/utils";
1984
- var createRule26 = ESLintUtils26.RuleCreator(
2531
+ import { ESLintUtils as ESLintUtils32 } from "@typescript-eslint/utils";
2532
+ var createRule32 = ESLintUtils32.RuleCreator(
1985
2533
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1986
2534
  );
1987
- var noEmoji = createRule26({
2535
+ var noEmoji = createRule32({
1988
2536
  name: "no-emoji",
1989
2537
  meta: {
1990
2538
  type: "problem",
@@ -2018,11 +2566,11 @@ var noEmoji = createRule26({
2018
2566
  var no_emoji_default = noEmoji;
2019
2567
 
2020
2568
  // src/rules/no-env-fallback.ts
2021
- import { AST_NODE_TYPES as AST_NODE_TYPES27, ESLintUtils as ESLintUtils27 } from "@typescript-eslint/utils";
2022
- var createRule27 = ESLintUtils27.RuleCreator(
2569
+ import { AST_NODE_TYPES as AST_NODE_TYPES33, ESLintUtils as ESLintUtils33 } from "@typescript-eslint/utils";
2570
+ var createRule33 = ESLintUtils33.RuleCreator(
2023
2571
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2024
2572
  );
2025
- var noEnvFallback = createRule27({
2573
+ var noEnvFallback = createRule33({
2026
2574
  name: "no-env-fallback",
2027
2575
  meta: {
2028
2576
  type: "problem",
@@ -2037,16 +2585,16 @@ var noEnvFallback = createRule27({
2037
2585
  defaultOptions: [],
2038
2586
  create(context) {
2039
2587
  const isProcessEnvAccess = (node) => {
2040
- if (node.type !== AST_NODE_TYPES27.MemberExpression) {
2588
+ if (node.type !== AST_NODE_TYPES33.MemberExpression) {
2041
2589
  return false;
2042
2590
  }
2043
2591
  const { object } = node;
2044
- if (object.type !== AST_NODE_TYPES27.MemberExpression) {
2592
+ if (object.type !== AST_NODE_TYPES33.MemberExpression) {
2045
2593
  return false;
2046
2594
  }
2047
2595
  const processNode = object.object;
2048
2596
  const envNode = object.property;
2049
- return processNode.type === AST_NODE_TYPES27.Identifier && processNode.name === "process" && envNode.type === AST_NODE_TYPES27.Identifier && envNode.name === "env";
2597
+ return processNode.type === AST_NODE_TYPES33.Identifier && processNode.name === "process" && envNode.type === AST_NODE_TYPES33.Identifier && envNode.name === "env";
2050
2598
  };
2051
2599
  return {
2052
2600
  LogicalExpression(node) {
@@ -2071,15 +2619,15 @@ var noEnvFallback = createRule27({
2071
2619
  var no_env_fallback_default = noEnvFallback;
2072
2620
 
2073
2621
  // src/rules/no-ghost-wrapper.ts
2074
- import { AST_NODE_TYPES as AST_NODE_TYPES28, ESLintUtils as ESLintUtils28 } from "@typescript-eslint/utils";
2075
- var createRule28 = ESLintUtils28.RuleCreator(
2622
+ import { AST_NODE_TYPES as AST_NODE_TYPES34, ESLintUtils as ESLintUtils34 } from "@typescript-eslint/utils";
2623
+ var createRule34 = ESLintUtils34.RuleCreator(
2076
2624
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2077
2625
  );
2078
2626
  var GHOST_TAGS = /* @__PURE__ */ new Set(["div", "span"]);
2079
2627
  function isKeyAttribute(attribute) {
2080
- return attribute.type === AST_NODE_TYPES28.JSXAttribute && attribute.name.type === AST_NODE_TYPES28.JSXIdentifier && attribute.name.name === "key";
2628
+ return attribute.type === AST_NODE_TYPES34.JSXAttribute && attribute.name.type === AST_NODE_TYPES34.JSXIdentifier && attribute.name.name === "key";
2081
2629
  }
2082
- var noGhostWrapper = createRule28({
2630
+ var noGhostWrapper = createRule34({
2083
2631
  name: "no-ghost-wrapper",
2084
2632
  meta: {
2085
2633
  type: "problem",
@@ -2095,7 +2643,7 @@ var noGhostWrapper = createRule28({
2095
2643
  create(context) {
2096
2644
  return {
2097
2645
  JSXOpeningElement(node) {
2098
- if (node.name.type !== AST_NODE_TYPES28.JSXIdentifier) {
2646
+ if (node.name.type !== AST_NODE_TYPES34.JSXIdentifier) {
2099
2647
  return;
2100
2648
  }
2101
2649
  const tagName = node.name.name;
@@ -2116,12 +2664,92 @@ var noGhostWrapper = createRule28({
2116
2664
  });
2117
2665
  var no_ghost_wrapper_default = noGhostWrapper;
2118
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
+
2119
2747
  // src/rules/no-inline-default-export.ts
2120
- import { AST_NODE_TYPES as AST_NODE_TYPES29, ESLintUtils as ESLintUtils29 } from "@typescript-eslint/utils";
2121
- var createRule29 = ESLintUtils29.RuleCreator(
2748
+ import { AST_NODE_TYPES as AST_NODE_TYPES37, ESLintUtils as ESLintUtils37 } from "@typescript-eslint/utils";
2749
+ var createRule37 = ESLintUtils37.RuleCreator(
2122
2750
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2123
2751
  );
2124
- var noInlineDefaultExport = createRule29({
2752
+ var noInlineDefaultExport = createRule37({
2125
2753
  name: "no-inline-default-export",
2126
2754
  meta: {
2127
2755
  type: "suggestion",
@@ -2140,7 +2768,7 @@ var noInlineDefaultExport = createRule29({
2140
2768
  return {
2141
2769
  ExportDefaultDeclaration(node) {
2142
2770
  const { declaration } = node;
2143
- if (declaration.type === AST_NODE_TYPES29.FunctionDeclaration) {
2771
+ if (declaration.type === AST_NODE_TYPES37.FunctionDeclaration) {
2144
2772
  if (declaration.id) {
2145
2773
  context.report({
2146
2774
  node,
@@ -2155,7 +2783,7 @@ var noInlineDefaultExport = createRule29({
2155
2783
  });
2156
2784
  }
2157
2785
  }
2158
- if (declaration.type === AST_NODE_TYPES29.ClassDeclaration) {
2786
+ if (declaration.type === AST_NODE_TYPES37.ClassDeclaration) {
2159
2787
  if (declaration.id) {
2160
2788
  context.report({
2161
2789
  node,
@@ -2170,7 +2798,7 @@ var noInlineDefaultExport = createRule29({
2170
2798
  });
2171
2799
  }
2172
2800
  }
2173
- if (declaration.type === AST_NODE_TYPES29.ArrowFunctionExpression || declaration.type === AST_NODE_TYPES29.FunctionExpression) {
2801
+ if (declaration.type === AST_NODE_TYPES37.ArrowFunctionExpression || declaration.type === AST_NODE_TYPES37.FunctionExpression) {
2174
2802
  context.report({
2175
2803
  node,
2176
2804
  messageId: "noAnonymousDefaultExport",
@@ -2183,14 +2811,14 @@ var noInlineDefaultExport = createRule29({
2183
2811
  if (!declaration) {
2184
2812
  return;
2185
2813
  }
2186
- if (declaration.type === AST_NODE_TYPES29.FunctionDeclaration && declaration.id) {
2814
+ if (declaration.type === AST_NODE_TYPES37.FunctionDeclaration && declaration.id) {
2187
2815
  context.report({
2188
2816
  node,
2189
2817
  messageId: "noInlineNamedExport",
2190
2818
  data: { type: "function", name: declaration.id.name }
2191
2819
  });
2192
2820
  }
2193
- if (declaration.type === AST_NODE_TYPES29.ClassDeclaration && declaration.id) {
2821
+ if (declaration.type === AST_NODE_TYPES37.ClassDeclaration && declaration.id) {
2194
2822
  context.report({
2195
2823
  node,
2196
2824
  messageId: "noInlineNamedExport",
@@ -2204,27 +2832,27 @@ var noInlineDefaultExport = createRule29({
2204
2832
  var no_inline_default_export_default = noInlineDefaultExport;
2205
2833
 
2206
2834
  // src/rules/no-inline-nested-object.ts
2207
- import { AST_NODE_TYPES as AST_NODE_TYPES30, ESLintUtils as ESLintUtils30 } from "@typescript-eslint/utils";
2208
- var createRule30 = ESLintUtils30.RuleCreator(
2835
+ import { AST_NODE_TYPES as AST_NODE_TYPES38, ESLintUtils as ESLintUtils38 } from "@typescript-eslint/utils";
2836
+ var createRule38 = ESLintUtils38.RuleCreator(
2209
2837
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2210
2838
  );
2211
2839
  function isObjectOrArray(node) {
2212
- return node.type === AST_NODE_TYPES30.ObjectExpression || node.type === AST_NODE_TYPES30.ArrayExpression || node.type === AST_NODE_TYPES30.TSAsExpression;
2840
+ return node.type === AST_NODE_TYPES38.ObjectExpression || node.type === AST_NODE_TYPES38.ArrayExpression || node.type === AST_NODE_TYPES38.TSAsExpression;
2213
2841
  }
2214
2842
  function getInnerExpression(node) {
2215
- if (node.type === AST_NODE_TYPES30.TSAsExpression) {
2843
+ if (node.type === AST_NODE_TYPES38.TSAsExpression) {
2216
2844
  return getInnerExpression(node.expression);
2217
2845
  }
2218
2846
  return node;
2219
2847
  }
2220
2848
  function isNestedStructure(node) {
2221
2849
  const inner = getInnerExpression(node);
2222
- return inner.type === AST_NODE_TYPES30.ObjectExpression || inner.type === AST_NODE_TYPES30.ArrayExpression;
2850
+ return inner.type === AST_NODE_TYPES38.ObjectExpression || inner.type === AST_NODE_TYPES38.ArrayExpression;
2223
2851
  }
2224
2852
  function containsNestedStructure(node) {
2225
- if (node.type === AST_NODE_TYPES30.ObjectExpression) {
2853
+ if (node.type === AST_NODE_TYPES38.ObjectExpression) {
2226
2854
  return node.properties.some((prop) => {
2227
- if (prop.type !== AST_NODE_TYPES30.Property) return false;
2855
+ if (prop.type !== AST_NODE_TYPES38.Property) return false;
2228
2856
  return isNestedStructure(prop.value);
2229
2857
  });
2230
2858
  }
@@ -2233,7 +2861,7 @@ function containsNestedStructure(node) {
2233
2861
  return isNestedStructure(el);
2234
2862
  });
2235
2863
  }
2236
- var noInlineNestedObject = createRule30({
2864
+ var noInlineNestedObject = createRule38({
2237
2865
  name: "no-inline-nested-object",
2238
2866
  meta: {
2239
2867
  type: "layout",
@@ -2255,7 +2883,7 @@ var noInlineNestedObject = createRule30({
2255
2883
  return;
2256
2884
  }
2257
2885
  const valueNode = getInnerExpression(node.value);
2258
- if (valueNode.type !== AST_NODE_TYPES30.ObjectExpression && valueNode.type !== AST_NODE_TYPES30.ArrayExpression) {
2886
+ if (valueNode.type !== AST_NODE_TYPES38.ObjectExpression && valueNode.type !== AST_NODE_TYPES38.ArrayExpression) {
2259
2887
  return;
2260
2888
  }
2261
2889
  if (!valueNode.loc) {
@@ -2268,7 +2896,7 @@ var noInlineNestedObject = createRule30({
2268
2896
  if (!containsNestedStructure(valueNode)) {
2269
2897
  return;
2270
2898
  }
2271
- const elements = valueNode.type === AST_NODE_TYPES30.ObjectExpression ? valueNode.properties : valueNode.elements;
2899
+ const elements = valueNode.type === AST_NODE_TYPES38.ObjectExpression ? valueNode.properties : valueNode.elements;
2272
2900
  context.report({
2273
2901
  node: valueNode,
2274
2902
  messageId: "requireMultiline",
@@ -2281,7 +2909,7 @@ var noInlineNestedObject = createRule30({
2281
2909
  const indent = " ".repeat(node.loc?.start.column ?? 0);
2282
2910
  const innerIndent = `${indent} `;
2283
2911
  const elementTexts = elements.filter((el) => el !== null).map((el) => sourceCode.getText(el));
2284
- const isObject = valueNode.type === AST_NODE_TYPES30.ObjectExpression;
2912
+ const isObject = valueNode.type === AST_NODE_TYPES38.ObjectExpression;
2285
2913
  const openChar = isObject ? "{" : "[";
2286
2914
  const closeChar = isObject ? "}" : "]";
2287
2915
  const formattedElements = elementTexts.map((text) => `${innerIndent}${text},`).join("\n");
@@ -2298,20 +2926,20 @@ ${indent}${closeChar}`;
2298
2926
  var no_inline_nested_object_default = noInlineNestedObject;
2299
2927
 
2300
2928
  // src/rules/no-inline-return-properties.ts
2301
- import { AST_NODE_TYPES as AST_NODE_TYPES31, ESLintUtils as ESLintUtils31 } from "@typescript-eslint/utils";
2302
- var createRule31 = ESLintUtils31.RuleCreator(
2929
+ import { AST_NODE_TYPES as AST_NODE_TYPES39, ESLintUtils as ESLintUtils39 } from "@typescript-eslint/utils";
2930
+ var createRule39 = ESLintUtils39.RuleCreator(
2303
2931
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2304
2932
  );
2305
2933
  var isShorthandProperty = (property) => {
2306
- if (property.type === AST_NODE_TYPES31.SpreadElement) {
2934
+ if (property.type === AST_NODE_TYPES39.SpreadElement) {
2307
2935
  return true;
2308
2936
  }
2309
- if (property.type !== AST_NODE_TYPES31.Property) {
2937
+ if (property.type !== AST_NODE_TYPES39.Property) {
2310
2938
  return false;
2311
2939
  }
2312
2940
  return property.shorthand;
2313
2941
  };
2314
- var noInlineReturnProperties = createRule31({
2942
+ var noInlineReturnProperties = createRule39({
2315
2943
  name: "no-inline-return-properties",
2316
2944
  meta: {
2317
2945
  type: "suggestion",
@@ -2327,20 +2955,20 @@ var noInlineReturnProperties = createRule31({
2327
2955
  create(context) {
2328
2956
  return {
2329
2957
  ReturnStatement(node) {
2330
- if (!node.argument || node.argument.type !== AST_NODE_TYPES31.ObjectExpression) {
2958
+ if (!node.argument || node.argument.type !== AST_NODE_TYPES39.ObjectExpression) {
2331
2959
  return;
2332
2960
  }
2333
2961
  node.argument.properties.forEach((property) => {
2334
2962
  if (isShorthandProperty(property)) {
2335
2963
  return;
2336
2964
  }
2337
- if (property.type !== AST_NODE_TYPES31.Property) {
2965
+ if (property.type !== AST_NODE_TYPES39.Property) {
2338
2966
  return;
2339
2967
  }
2340
2968
  let keyName = null;
2341
- if (property.key.type === AST_NODE_TYPES31.Identifier) {
2969
+ if (property.key.type === AST_NODE_TYPES39.Identifier) {
2342
2970
  keyName = property.key.name;
2343
- } else if (property.key.type === AST_NODE_TYPES31.Literal) {
2971
+ } else if (property.key.type === AST_NODE_TYPES39.Literal) {
2344
2972
  keyName = String(property.key.value);
2345
2973
  }
2346
2974
  context.report({
@@ -2356,12 +2984,12 @@ var noInlineReturnProperties = createRule31({
2356
2984
  var no_inline_return_properties_default = noInlineReturnProperties;
2357
2985
 
2358
2986
  // src/rules/no-inline-type-import.ts
2359
- import { AST_NODE_TYPES as AST_NODE_TYPES32, ESLintUtils as ESLintUtils32 } from "@typescript-eslint/utils";
2360
- var createRule32 = ESLintUtils32.RuleCreator(
2987
+ import { AST_NODE_TYPES as AST_NODE_TYPES40, ESLintUtils as ESLintUtils40 } from "@typescript-eslint/utils";
2988
+ var createRule40 = ESLintUtils40.RuleCreator(
2361
2989
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2362
2990
  );
2363
- var isInlineTypeSpecifier = (specifier) => specifier.type === AST_NODE_TYPES32.ImportSpecifier && specifier.importKind === "type";
2364
- var noInlineTypeImport = createRule32({
2991
+ var isInlineTypeSpecifier = (specifier) => specifier.type === AST_NODE_TYPES40.ImportSpecifier && specifier.importKind === "type";
2992
+ var noInlineTypeImport = createRule40({
2365
2993
  name: "no-inline-type-import",
2366
2994
  meta: {
2367
2995
  type: "suggestion",
@@ -2398,7 +3026,7 @@ var noInlineTypeImport = createRule32({
2398
3026
  );
2399
3027
  const typeImport = `import type { ${typeSpecifierTexts.join(", ")} } from ${sourceText};`;
2400
3028
  const valueSpecifiers = node.specifiers.filter(
2401
- (specifier) => !(specifier.type === AST_NODE_TYPES32.ImportSpecifier && specifier.importKind === "type")
3029
+ (specifier) => !(specifier.type === AST_NODE_TYPES40.ImportSpecifier && specifier.importKind === "type")
2402
3030
  );
2403
3031
  if (valueSpecifiers.length === 0) {
2404
3032
  return fixer.replaceText(node, typeImport);
@@ -2406,11 +3034,11 @@ var noInlineTypeImport = createRule32({
2406
3034
  const parts = [];
2407
3035
  const namedValueSpecifiers = [];
2408
3036
  for (const specifier of valueSpecifiers) {
2409
- if (specifier.type === AST_NODE_TYPES32.ImportDefaultSpecifier) {
3037
+ if (specifier.type === AST_NODE_TYPES40.ImportDefaultSpecifier) {
2410
3038
  parts.push(specifier.local.name);
2411
- } else if (specifier.type === AST_NODE_TYPES32.ImportNamespaceSpecifier) {
3039
+ } else if (specifier.type === AST_NODE_TYPES40.ImportNamespaceSpecifier) {
2412
3040
  parts.push(`* as ${specifier.local.name}`);
2413
- } else if (specifier.type === AST_NODE_TYPES32.ImportSpecifier) {
3041
+ } else if (specifier.type === AST_NODE_TYPES40.ImportSpecifier) {
2414
3042
  namedValueSpecifiers.push(specifier);
2415
3043
  }
2416
3044
  }
@@ -2430,8 +3058,8 @@ ${typeImport}`);
2430
3058
  var no_inline_type_import_default = noInlineTypeImport;
2431
3059
 
2432
3060
  // src/rules/no-lazy-identifiers.ts
2433
- import { AST_NODE_TYPES as AST_NODE_TYPES33, ESLintUtils as ESLintUtils33 } from "@typescript-eslint/utils";
2434
- var createRule33 = ESLintUtils33.RuleCreator(
3061
+ import { AST_NODE_TYPES as AST_NODE_TYPES41, ESLintUtils as ESLintUtils41 } from "@typescript-eslint/utils";
3062
+ var createRule41 = ESLintUtils41.RuleCreator(
2435
3063
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2436
3064
  );
2437
3065
  var KEYBOARD_ROWS = ["qwertyuiop", "asdfghjkl", "zxcvbnm", "1234567890"];
@@ -2472,7 +3100,7 @@ var isLazyIdentifier = (name) => {
2472
3100
  }
2473
3101
  return false;
2474
3102
  };
2475
- var noLazyIdentifiers = createRule33({
3103
+ var noLazyIdentifiers = createRule41({
2476
3104
  name: "no-lazy-identifiers",
2477
3105
  meta: {
2478
3106
  type: "problem",
@@ -2498,27 +3126,27 @@ var noLazyIdentifiers = createRule33({
2498
3126
  });
2499
3127
  };
2500
3128
  const checkPattern = (pattern) => {
2501
- if (pattern.type === AST_NODE_TYPES33.Identifier) {
3129
+ if (pattern.type === AST_NODE_TYPES41.Identifier) {
2502
3130
  checkIdentifier(pattern);
2503
- } else if (pattern.type === AST_NODE_TYPES33.ObjectPattern) {
3131
+ } else if (pattern.type === AST_NODE_TYPES41.ObjectPattern) {
2504
3132
  pattern.properties.forEach((prop) => {
2505
- if (prop.type === AST_NODE_TYPES33.Property && prop.value.type === AST_NODE_TYPES33.Identifier) {
3133
+ if (prop.type === AST_NODE_TYPES41.Property && prop.value.type === AST_NODE_TYPES41.Identifier) {
2506
3134
  checkIdentifier(prop.value);
2507
- } else if (prop.type === AST_NODE_TYPES33.RestElement && prop.argument.type === AST_NODE_TYPES33.Identifier) {
3135
+ } else if (prop.type === AST_NODE_TYPES41.RestElement && prop.argument.type === AST_NODE_TYPES41.Identifier) {
2508
3136
  checkIdentifier(prop.argument);
2509
3137
  }
2510
3138
  });
2511
- } else if (pattern.type === AST_NODE_TYPES33.ArrayPattern) {
3139
+ } else if (pattern.type === AST_NODE_TYPES41.ArrayPattern) {
2512
3140
  pattern.elements.forEach((element) => {
2513
- if (element?.type === AST_NODE_TYPES33.Identifier) {
3141
+ if (element?.type === AST_NODE_TYPES41.Identifier) {
2514
3142
  checkIdentifier(element);
2515
- } else if (element?.type === AST_NODE_TYPES33.RestElement && element.argument.type === AST_NODE_TYPES33.Identifier) {
3143
+ } else if (element?.type === AST_NODE_TYPES41.RestElement && element.argument.type === AST_NODE_TYPES41.Identifier) {
2516
3144
  checkIdentifier(element.argument);
2517
3145
  }
2518
3146
  });
2519
- } else if (pattern.type === AST_NODE_TYPES33.AssignmentPattern && pattern.left.type === AST_NODE_TYPES33.Identifier) {
3147
+ } else if (pattern.type === AST_NODE_TYPES41.AssignmentPattern && pattern.left.type === AST_NODE_TYPES41.Identifier) {
2520
3148
  checkIdentifier(pattern.left);
2521
- } else if (pattern.type === AST_NODE_TYPES33.RestElement && pattern.argument.type === AST_NODE_TYPES33.Identifier) {
3149
+ } else if (pattern.type === AST_NODE_TYPES41.RestElement && pattern.argument.type === AST_NODE_TYPES41.Identifier) {
2522
3150
  checkIdentifier(pattern.argument);
2523
3151
  }
2524
3152
  };
@@ -2563,11 +3191,11 @@ var noLazyIdentifiers = createRule33({
2563
3191
  var no_lazy_identifiers_default = noLazyIdentifiers;
2564
3192
 
2565
3193
  // src/rules/no-logic-in-params.ts
2566
- import { AST_NODE_TYPES as AST_NODE_TYPES34, ESLintUtils as ESLintUtils34 } from "@typescript-eslint/utils";
2567
- var createRule34 = ESLintUtils34.RuleCreator(
3194
+ import { AST_NODE_TYPES as AST_NODE_TYPES42, ESLintUtils as ESLintUtils42 } from "@typescript-eslint/utils";
3195
+ var createRule42 = ESLintUtils42.RuleCreator(
2568
3196
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2569
3197
  );
2570
- var noLogicInParams = createRule34({
3198
+ var noLogicInParams = createRule42({
2571
3199
  name: "no-logic-in-params",
2572
3200
  meta: {
2573
3201
  type: "suggestion",
@@ -2582,20 +3210,20 @@ var noLogicInParams = createRule34({
2582
3210
  defaultOptions: [],
2583
3211
  create(context) {
2584
3212
  const isComplexExpression = (node) => {
2585
- if (node.type === AST_NODE_TYPES34.SpreadElement) {
3213
+ if (node.type === AST_NODE_TYPES42.SpreadElement) {
2586
3214
  return false;
2587
3215
  }
2588
- if (node.type === AST_NODE_TYPES34.ConditionalExpression) {
3216
+ if (node.type === AST_NODE_TYPES42.ConditionalExpression) {
2589
3217
  return true;
2590
3218
  }
2591
- if (node.type === AST_NODE_TYPES34.LogicalExpression) {
3219
+ if (node.type === AST_NODE_TYPES42.LogicalExpression) {
2592
3220
  return true;
2593
3221
  }
2594
- if (node.type === AST_NODE_TYPES34.BinaryExpression) {
3222
+ if (node.type === AST_NODE_TYPES42.BinaryExpression) {
2595
3223
  const logicalOperators = ["==", "===", "!=", "!==", "<", ">", "<=", ">=", "in", "instanceof"];
2596
3224
  return logicalOperators.includes(node.operator);
2597
3225
  }
2598
- if (node.type === AST_NODE_TYPES34.UnaryExpression) {
3226
+ if (node.type === AST_NODE_TYPES42.UnaryExpression) {
2599
3227
  return node.operator === "!";
2600
3228
  }
2601
3229
  return false;
@@ -2608,7 +3236,7 @@ var noLogicInParams = createRule34({
2608
3236
  messageId: "noLogicInParams"
2609
3237
  });
2610
3238
  }
2611
- if (arg.type === AST_NODE_TYPES34.ArrayExpression) {
3239
+ if (arg.type === AST_NODE_TYPES42.ArrayExpression) {
2612
3240
  arg.elements.forEach((element) => {
2613
3241
  if (element && isComplexExpression(element)) {
2614
3242
  context.report({
@@ -2633,46 +3261,46 @@ var noLogicInParams = createRule34({
2633
3261
  var no_logic_in_params_default = noLogicInParams;
2634
3262
 
2635
3263
  // src/rules/no-misleading-constant-case.ts
2636
- import { AST_NODE_TYPES as AST_NODE_TYPES35, ESLintUtils as ESLintUtils35 } from "@typescript-eslint/utils";
2637
- var createRule35 = ESLintUtils35.RuleCreator(
3264
+ import { AST_NODE_TYPES as AST_NODE_TYPES43, ESLintUtils as ESLintUtils43 } from "@typescript-eslint/utils";
3265
+ var createRule43 = ESLintUtils43.RuleCreator(
2638
3266
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2639
3267
  );
2640
3268
  var SCREAMING_SNAKE_CASE_REGEX3 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
2641
- var isAsConstAssertion = (node) => node.type === AST_NODE_TYPES35.TSAsExpression && node.typeAnnotation.type === AST_NODE_TYPES35.TSTypeReference && node.typeAnnotation.typeName.type === AST_NODE_TYPES35.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";
2642
3270
  var isStaticValue2 = (init) => {
2643
3271
  if (isAsConstAssertion(init)) {
2644
3272
  return true;
2645
3273
  }
2646
- if (init.type === AST_NODE_TYPES35.Literal) {
3274
+ if (init.type === AST_NODE_TYPES43.Literal) {
2647
3275
  return true;
2648
3276
  }
2649
- if (init.type === AST_NODE_TYPES35.UnaryExpression && init.argument.type === AST_NODE_TYPES35.Literal) {
3277
+ if (init.type === AST_NODE_TYPES43.UnaryExpression && init.argument.type === AST_NODE_TYPES43.Literal) {
2650
3278
  return true;
2651
3279
  }
2652
- if (init.type === AST_NODE_TYPES35.TemplateLiteral && init.expressions.length === 0) {
3280
+ if (init.type === AST_NODE_TYPES43.TemplateLiteral && init.expressions.length === 0) {
2653
3281
  return true;
2654
3282
  }
2655
- if (init.type === AST_NODE_TYPES35.ArrayExpression) {
2656
- return init.elements.every((el) => el !== null && el.type !== AST_NODE_TYPES35.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));
2657
3285
  }
2658
- if (init.type === AST_NODE_TYPES35.ObjectExpression) {
3286
+ if (init.type === AST_NODE_TYPES43.ObjectExpression) {
2659
3287
  return init.properties.every(
2660
- (prop) => prop.type === AST_NODE_TYPES35.Property && isStaticValue2(prop.value)
3288
+ (prop) => prop.type === AST_NODE_TYPES43.Property && isStaticValue2(prop.value)
2661
3289
  );
2662
3290
  }
2663
3291
  return false;
2664
3292
  };
2665
3293
  var isGlobalScope3 = (node) => {
2666
3294
  const { parent } = node;
2667
- if (parent.type === AST_NODE_TYPES35.Program) {
3295
+ if (parent.type === AST_NODE_TYPES43.Program) {
2668
3296
  return true;
2669
3297
  }
2670
- if (parent.type === AST_NODE_TYPES35.ExportNamedDeclaration && parent.parent?.type === AST_NODE_TYPES35.Program) {
3298
+ if (parent.type === AST_NODE_TYPES43.ExportNamedDeclaration && parent.parent?.type === AST_NODE_TYPES43.Program) {
2671
3299
  return true;
2672
3300
  }
2673
3301
  return false;
2674
3302
  };
2675
- var noMisleadingConstantCase = createRule35({
3303
+ var noMisleadingConstantCase = createRule43({
2676
3304
  name: "no-misleading-constant-case",
2677
3305
  meta: {
2678
3306
  type: "suggestion",
@@ -2691,7 +3319,7 @@ var noMisleadingConstantCase = createRule35({
2691
3319
  return {
2692
3320
  VariableDeclaration(node) {
2693
3321
  node.declarations.forEach((declarator) => {
2694
- if (declarator.id.type !== AST_NODE_TYPES35.Identifier) {
3322
+ if (declarator.id.type !== AST_NODE_TYPES43.Identifier) {
2695
3323
  return;
2696
3324
  }
2697
3325
  const { name } = declarator.id;
@@ -2732,11 +3360,11 @@ var noMisleadingConstantCase = createRule35({
2732
3360
  var no_misleading_constant_case_default = noMisleadingConstantCase;
2733
3361
 
2734
3362
  // src/rules/no-nested-interface-declaration.ts
2735
- import { AST_NODE_TYPES as AST_NODE_TYPES36, ESLintUtils as ESLintUtils36 } from "@typescript-eslint/utils";
2736
- var createRule36 = ESLintUtils36.RuleCreator(
3363
+ import { AST_NODE_TYPES as AST_NODE_TYPES44, ESLintUtils as ESLintUtils44 } from "@typescript-eslint/utils";
3364
+ var createRule44 = ESLintUtils44.RuleCreator(
2737
3365
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2738
3366
  );
2739
- var noNestedInterfaceDeclaration = createRule36({
3367
+ var noNestedInterfaceDeclaration = createRule44({
2740
3368
  name: "no-nested-interface-declaration",
2741
3369
  meta: {
2742
3370
  type: "suggestion",
@@ -2757,15 +3385,15 @@ var noNestedInterfaceDeclaration = createRule36({
2757
3385
  return;
2758
3386
  }
2759
3387
  const { typeAnnotation } = node.typeAnnotation;
2760
- if (typeAnnotation.type === AST_NODE_TYPES36.TSTypeLiteral) {
3388
+ if (typeAnnotation.type === AST_NODE_TYPES44.TSTypeLiteral) {
2761
3389
  context.report({
2762
3390
  node: typeAnnotation,
2763
3391
  messageId: "noNestedInterface"
2764
3392
  });
2765
3393
  return;
2766
3394
  }
2767
- if (typeAnnotation.type === AST_NODE_TYPES36.TSArrayType) {
2768
- if (typeAnnotation.elementType.type === AST_NODE_TYPES36.TSTypeLiteral) {
3395
+ if (typeAnnotation.type === AST_NODE_TYPES44.TSArrayType) {
3396
+ if (typeAnnotation.elementType.type === AST_NODE_TYPES44.TSTypeLiteral) {
2769
3397
  context.report({
2770
3398
  node: typeAnnotation.elementType,
2771
3399
  messageId: "noNestedInterface"
@@ -2773,9 +3401,9 @@ var noNestedInterfaceDeclaration = createRule36({
2773
3401
  }
2774
3402
  return;
2775
3403
  }
2776
- if (typeAnnotation.type === AST_NODE_TYPES36.TSTypeReference && typeAnnotation.typeArguments) {
3404
+ if (typeAnnotation.type === AST_NODE_TYPES44.TSTypeReference && typeAnnotation.typeArguments) {
2777
3405
  typeAnnotation.typeArguments.params.forEach((param) => {
2778
- if (param.type === AST_NODE_TYPES36.TSTypeLiteral) {
3406
+ if (param.type === AST_NODE_TYPES44.TSTypeLiteral) {
2779
3407
  context.report({
2780
3408
  node: param,
2781
3409
  messageId: "noNestedInterface"
@@ -2790,11 +3418,11 @@ var noNestedInterfaceDeclaration = createRule36({
2790
3418
  var no_nested_interface_declaration_default = noNestedInterfaceDeclaration;
2791
3419
 
2792
3420
  // src/rules/no-nested-ternary.ts
2793
- import { AST_NODE_TYPES as AST_NODE_TYPES37, ESLintUtils as ESLintUtils37 } from "@typescript-eslint/utils";
2794
- var createRule37 = ESLintUtils37.RuleCreator(
3421
+ import { AST_NODE_TYPES as AST_NODE_TYPES45, ESLintUtils as ESLintUtils45 } from "@typescript-eslint/utils";
3422
+ var createRule45 = ESLintUtils45.RuleCreator(
2795
3423
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2796
3424
  );
2797
- var noNestedTernary = createRule37({
3425
+ var noNestedTernary = createRule45({
2798
3426
  name: "no-nested-ternary",
2799
3427
  meta: {
2800
3428
  type: "suggestion",
@@ -2811,13 +3439,13 @@ var noNestedTernary = createRule37({
2811
3439
  return {
2812
3440
  ConditionalExpression(node) {
2813
3441
  const { consequent, alternate } = node;
2814
- if (consequent.type === AST_NODE_TYPES37.ConditionalExpression) {
3442
+ if (consequent.type === AST_NODE_TYPES45.ConditionalExpression) {
2815
3443
  context.report({
2816
3444
  node: consequent,
2817
3445
  messageId: "noNestedTernary"
2818
3446
  });
2819
3447
  }
2820
- if (alternate.type === AST_NODE_TYPES37.ConditionalExpression) {
3448
+ if (alternate.type === AST_NODE_TYPES45.ConditionalExpression) {
2821
3449
  context.report({
2822
3450
  node: alternate,
2823
3451
  messageId: "noNestedTernary"
@@ -2830,33 +3458,33 @@ var noNestedTernary = createRule37({
2830
3458
  var no_nested_ternary_default = noNestedTernary;
2831
3459
 
2832
3460
  // src/rules/no-redundant-fragment.ts
2833
- import { AST_NODE_TYPES as AST_NODE_TYPES38, ESLintUtils as ESLintUtils38 } from "@typescript-eslint/utils";
2834
- var createRule38 = ESLintUtils38.RuleCreator(
3461
+ import { AST_NODE_TYPES as AST_NODE_TYPES46, ESLintUtils as ESLintUtils46 } from "@typescript-eslint/utils";
3462
+ var createRule46 = ESLintUtils46.RuleCreator(
2835
3463
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2836
3464
  );
2837
3465
  function isFragmentName(name) {
2838
- if (name.type === AST_NODE_TYPES38.JSXIdentifier && name.name === "Fragment") {
3466
+ if (name.type === AST_NODE_TYPES46.JSXIdentifier && name.name === "Fragment") {
2839
3467
  return true;
2840
3468
  }
2841
- if (name.type === AST_NODE_TYPES38.JSXMemberExpression && name.object.type === AST_NODE_TYPES38.JSXIdentifier && name.object.name === "React" && name.property.type === AST_NODE_TYPES38.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") {
2842
3470
  return true;
2843
3471
  }
2844
3472
  return false;
2845
3473
  }
2846
3474
  function hasKeyAttribute(attributes) {
2847
3475
  return attributes.some(
2848
- (attribute) => attribute.type === AST_NODE_TYPES38.JSXAttribute && attribute.name.type === AST_NODE_TYPES38.JSXIdentifier && attribute.name.name === "key"
3476
+ (attribute) => attribute.type === AST_NODE_TYPES46.JSXAttribute && attribute.name.type === AST_NODE_TYPES46.JSXIdentifier && attribute.name.name === "key"
2849
3477
  );
2850
3478
  }
2851
3479
  function countMeaningfulChildren(children) {
2852
3480
  return children.filter((child) => {
2853
- if (child.type === AST_NODE_TYPES38.JSXText) {
3481
+ if (child.type === AST_NODE_TYPES46.JSXText) {
2854
3482
  return child.value.trim() !== "";
2855
3483
  }
2856
3484
  return true;
2857
3485
  }).length;
2858
3486
  }
2859
- var noRedundantFragment = createRule38({
3487
+ var noRedundantFragment = createRule46({
2860
3488
  name: "no-redundant-fragment",
2861
3489
  meta: {
2862
3490
  type: "problem",
@@ -2904,11 +3532,11 @@ var noRedundantFragment = createRule38({
2904
3532
  var no_redundant_fragment_default = noRedundantFragment;
2905
3533
 
2906
3534
  // src/rules/no-relative-imports.ts
2907
- import { AST_NODE_TYPES as AST_NODE_TYPES39, ESLintUtils as ESLintUtils39 } from "@typescript-eslint/utils";
2908
- var createRule39 = ESLintUtils39.RuleCreator(
3535
+ import { AST_NODE_TYPES as AST_NODE_TYPES47, ESLintUtils as ESLintUtils47 } from "@typescript-eslint/utils";
3536
+ var createRule47 = ESLintUtils47.RuleCreator(
2909
3537
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2910
3538
  );
2911
- var noRelativeImports = createRule39({
3539
+ var noRelativeImports = createRule47({
2912
3540
  name: "no-relative-imports",
2913
3541
  meta: {
2914
3542
  type: "suggestion",
@@ -2932,22 +3560,22 @@ var noRelativeImports = createRule39({
2932
3560
  };
2933
3561
  return {
2934
3562
  ImportDeclaration(node) {
2935
- if (node.source.type === AST_NODE_TYPES39.Literal && typeof node.source.value === "string") {
3563
+ if (node.source.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
2936
3564
  checkImportPath(node.source.value, node);
2937
3565
  }
2938
3566
  },
2939
3567
  ImportExpression(node) {
2940
- if (node.source.type === AST_NODE_TYPES39.Literal && typeof node.source.value === "string") {
3568
+ if (node.source.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
2941
3569
  checkImportPath(node.source.value, node);
2942
3570
  }
2943
3571
  },
2944
3572
  ExportNamedDeclaration(node) {
2945
- if (node.source?.type === AST_NODE_TYPES39.Literal && typeof node.source.value === "string") {
3573
+ if (node.source?.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
2946
3574
  checkImportPath(node.source.value, node);
2947
3575
  }
2948
3576
  },
2949
3577
  ExportAllDeclaration(node) {
2950
- if (node.source.type === AST_NODE_TYPES39.Literal && typeof node.source.value === "string") {
3578
+ if (node.source.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string") {
2951
3579
  checkImportPath(node.source.value, node);
2952
3580
  }
2953
3581
  }
@@ -2957,8 +3585,8 @@ var noRelativeImports = createRule39({
2957
3585
  var no_relative_imports_default = noRelativeImports;
2958
3586
 
2959
3587
  // src/rules/no-single-char-variables.ts
2960
- import { AST_NODE_TYPES as AST_NODE_TYPES40, ESLintUtils as ESLintUtils40 } from "@typescript-eslint/utils";
2961
- var createRule40 = ESLintUtils40.RuleCreator(
3588
+ import { AST_NODE_TYPES as AST_NODE_TYPES48, ESLintUtils as ESLintUtils48 } from "@typescript-eslint/utils";
3589
+ var createRule48 = ESLintUtils48.RuleCreator(
2962
3590
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2963
3591
  );
2964
3592
  var ALLOWED_IN_FOR_LOOPS = /* @__PURE__ */ new Set(["i", "j", "k", "n"]);
@@ -2970,7 +3598,7 @@ var isForLoopInit = (node) => {
2970
3598
  if (!parentNode) {
2971
3599
  return false;
2972
3600
  }
2973
- if (parentNode.type === AST_NODE_TYPES40.ForStatement) {
3601
+ if (parentNode.type === AST_NODE_TYPES48.ForStatement) {
2974
3602
  const { init } = parentNode;
2975
3603
  if (init && init === current) {
2976
3604
  return true;
@@ -2989,7 +3617,7 @@ var isAllowedInContext = (name, node) => {
2989
3617
  }
2990
3618
  return false;
2991
3619
  };
2992
- var noSingleCharVariables = createRule40({
3620
+ var noSingleCharVariables = createRule48({
2993
3621
  name: "no-single-char-variables",
2994
3622
  meta: {
2995
3623
  type: "suggestion",
@@ -3018,27 +3646,27 @@ var noSingleCharVariables = createRule40({
3018
3646
  });
3019
3647
  };
3020
3648
  const checkPattern = (pattern, declarationNode) => {
3021
- if (pattern.type === AST_NODE_TYPES40.Identifier) {
3649
+ if (pattern.type === AST_NODE_TYPES48.Identifier) {
3022
3650
  checkIdentifier(pattern, declarationNode);
3023
- } else if (pattern.type === AST_NODE_TYPES40.ObjectPattern) {
3651
+ } else if (pattern.type === AST_NODE_TYPES48.ObjectPattern) {
3024
3652
  pattern.properties.forEach((prop) => {
3025
- if (prop.type === AST_NODE_TYPES40.Property && prop.value.type === AST_NODE_TYPES40.Identifier) {
3653
+ if (prop.type === AST_NODE_TYPES48.Property && prop.value.type === AST_NODE_TYPES48.Identifier) {
3026
3654
  checkIdentifier(prop.value, declarationNode);
3027
- } else if (prop.type === AST_NODE_TYPES40.RestElement && prop.argument.type === AST_NODE_TYPES40.Identifier) {
3655
+ } else if (prop.type === AST_NODE_TYPES48.RestElement && prop.argument.type === AST_NODE_TYPES48.Identifier) {
3028
3656
  checkIdentifier(prop.argument, declarationNode);
3029
3657
  }
3030
3658
  });
3031
- } else if (pattern.type === AST_NODE_TYPES40.ArrayPattern) {
3659
+ } else if (pattern.type === AST_NODE_TYPES48.ArrayPattern) {
3032
3660
  pattern.elements.forEach((element) => {
3033
- if (element?.type === AST_NODE_TYPES40.Identifier) {
3661
+ if (element?.type === AST_NODE_TYPES48.Identifier) {
3034
3662
  checkIdentifier(element, declarationNode);
3035
- } else if (element?.type === AST_NODE_TYPES40.RestElement && element.argument.type === AST_NODE_TYPES40.Identifier) {
3663
+ } else if (element?.type === AST_NODE_TYPES48.RestElement && element.argument.type === AST_NODE_TYPES48.Identifier) {
3036
3664
  checkIdentifier(element.argument, declarationNode);
3037
3665
  }
3038
3666
  });
3039
- } else if (pattern.type === AST_NODE_TYPES40.AssignmentPattern && pattern.left.type === AST_NODE_TYPES40.Identifier) {
3667
+ } else if (pattern.type === AST_NODE_TYPES48.AssignmentPattern && pattern.left.type === AST_NODE_TYPES48.Identifier) {
3040
3668
  checkIdentifier(pattern.left, declarationNode);
3041
- } else if (pattern.type === AST_NODE_TYPES40.RestElement && pattern.argument.type === AST_NODE_TYPES40.Identifier) {
3669
+ } else if (pattern.type === AST_NODE_TYPES48.RestElement && pattern.argument.type === AST_NODE_TYPES48.Identifier) {
3042
3670
  checkIdentifier(pattern.argument, declarationNode);
3043
3671
  }
3044
3672
  };
@@ -3072,11 +3700,11 @@ var noSingleCharVariables = createRule40({
3072
3700
  var no_single_char_variables_default = noSingleCharVariables;
3073
3701
 
3074
3702
  // src/rules/prefer-async-await.ts
3075
- import { AST_NODE_TYPES as AST_NODE_TYPES41, ESLintUtils as ESLintUtils41 } from "@typescript-eslint/utils";
3076
- var createRule41 = ESLintUtils41.RuleCreator(
3703
+ import { AST_NODE_TYPES as AST_NODE_TYPES49, ESLintUtils as ESLintUtils49 } from "@typescript-eslint/utils";
3704
+ var createRule49 = ESLintUtils49.RuleCreator(
3077
3705
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3078
3706
  );
3079
- var preferAsyncAwait = createRule41({
3707
+ var preferAsyncAwait = createRule49({
3080
3708
  name: "prefer-async-await",
3081
3709
  meta: {
3082
3710
  type: "suggestion",
@@ -3092,7 +3720,7 @@ var preferAsyncAwait = createRule41({
3092
3720
  create(context) {
3093
3721
  return {
3094
3722
  CallExpression(node) {
3095
- if (node.callee.type === AST_NODE_TYPES41.MemberExpression && node.callee.property.type === AST_NODE_TYPES41.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") {
3096
3724
  context.report({
3097
3725
  node: node.callee.property,
3098
3726
  messageId: "preferAsyncAwait"
@@ -3105,11 +3733,11 @@ var preferAsyncAwait = createRule41({
3105
3733
  var prefer_async_await_default = preferAsyncAwait;
3106
3734
 
3107
3735
  // src/rules/prefer-destructuring-params.ts
3108
- import { AST_NODE_TYPES as AST_NODE_TYPES42, ESLintUtils as ESLintUtils42 } from "@typescript-eslint/utils";
3109
- var createRule42 = ESLintUtils42.RuleCreator(
3736
+ import { AST_NODE_TYPES as AST_NODE_TYPES50, ESLintUtils as ESLintUtils50 } from "@typescript-eslint/utils";
3737
+ var createRule50 = ESLintUtils50.RuleCreator(
3110
3738
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3111
3739
  );
3112
- var preferDestructuringParams = createRule42({
3740
+ var preferDestructuringParams = createRule50({
3113
3741
  name: "prefer-destructuring-params",
3114
3742
  meta: {
3115
3743
  type: "suggestion",
@@ -3125,18 +3753,18 @@ var preferDestructuringParams = createRule42({
3125
3753
  create(context) {
3126
3754
  const isCallbackFunction2 = (node) => {
3127
3755
  const { parent } = node;
3128
- return parent?.type === AST_NODE_TYPES42.CallExpression;
3756
+ return parent?.type === AST_NODE_TYPES50.CallExpression;
3129
3757
  };
3130
3758
  const isDeveloperFunction = (node) => {
3131
- if (node.type === AST_NODE_TYPES42.FunctionDeclaration) {
3759
+ if (node.type === AST_NODE_TYPES50.FunctionDeclaration) {
3132
3760
  return true;
3133
3761
  }
3134
- if (node.type === AST_NODE_TYPES42.FunctionExpression || node.type === AST_NODE_TYPES42.ArrowFunctionExpression) {
3762
+ if (node.type === AST_NODE_TYPES50.FunctionExpression || node.type === AST_NODE_TYPES50.ArrowFunctionExpression) {
3135
3763
  if (isCallbackFunction2(node)) {
3136
3764
  return false;
3137
3765
  }
3138
3766
  const { parent } = node;
3139
- return parent?.type === AST_NODE_TYPES42.VariableDeclarator || parent?.type === AST_NODE_TYPES42.AssignmentExpression || parent?.type === AST_NODE_TYPES42.Property || parent?.type === AST_NODE_TYPES42.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;
3140
3768
  }
3141
3769
  return false;
3142
3770
  };
@@ -3148,7 +3776,7 @@ var preferDestructuringParams = createRule42({
3148
3776
  if (!isDeveloperFunction(node)) {
3149
3777
  return;
3150
3778
  }
3151
- if (node.type === AST_NODE_TYPES42.FunctionDeclaration && node.id) {
3779
+ if (node.type === AST_NODE_TYPES50.FunctionDeclaration && node.id) {
3152
3780
  const functionName = node.id.name;
3153
3781
  if (functionName.startsWith("_") || functionName.includes("$") || /^[A-Z][a-zA-Z]*$/.test(functionName)) {
3154
3782
  return;
@@ -3158,7 +3786,7 @@ var preferDestructuringParams = createRule42({
3158
3786
  return;
3159
3787
  }
3160
3788
  const hasNonDestructuredParams = node.params.some(
3161
- (param) => param.type !== AST_NODE_TYPES42.ObjectPattern && param.type !== AST_NODE_TYPES42.RestElement
3789
+ (param) => param.type !== AST_NODE_TYPES50.ObjectPattern && param.type !== AST_NODE_TYPES50.RestElement
3162
3790
  );
3163
3791
  if (hasNonDestructuredParams) {
3164
3792
  context.report({
@@ -3177,8 +3805,8 @@ var preferDestructuringParams = createRule42({
3177
3805
  var prefer_destructuring_params_default = preferDestructuringParams;
3178
3806
 
3179
3807
  // src/rules/prefer-function-declaration.ts
3180
- import { AST_NODE_TYPES as AST_NODE_TYPES43, ESLintUtils as ESLintUtils43 } from "@typescript-eslint/utils";
3181
- var createRule43 = ESLintUtils43.RuleCreator(
3808
+ import { AST_NODE_TYPES as AST_NODE_TYPES51, ESLintUtils as ESLintUtils51 } from "@typescript-eslint/utils";
3809
+ var createRule51 = ESLintUtils51.RuleCreator(
3182
3810
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3183
3811
  );
3184
3812
  var isTsFile = (filename) => filename.endsWith(".ts") && !filename.endsWith(".d.ts");
@@ -3187,33 +3815,33 @@ var isCallbackContext = (node) => {
3187
3815
  if (!parent) {
3188
3816
  return false;
3189
3817
  }
3190
- if (parent.type === AST_NODE_TYPES43.CallExpression && parent.arguments.includes(node)) {
3818
+ if (parent.type === AST_NODE_TYPES51.CallExpression && parent.arguments.includes(node)) {
3191
3819
  return true;
3192
3820
  }
3193
- if (parent.type === AST_NODE_TYPES43.NewExpression && parent.arguments.includes(node)) {
3821
+ if (parent.type === AST_NODE_TYPES51.NewExpression && parent.arguments.includes(node)) {
3194
3822
  return true;
3195
3823
  }
3196
- if (parent.type === AST_NODE_TYPES43.ReturnStatement) {
3824
+ if (parent.type === AST_NODE_TYPES51.ReturnStatement) {
3197
3825
  return true;
3198
3826
  }
3199
- if (parent.type === AST_NODE_TYPES43.Property) {
3827
+ if (parent.type === AST_NODE_TYPES51.Property) {
3200
3828
  return true;
3201
3829
  }
3202
- if (parent.type === AST_NODE_TYPES43.ArrayExpression) {
3830
+ if (parent.type === AST_NODE_TYPES51.ArrayExpression) {
3203
3831
  return true;
3204
3832
  }
3205
- if (parent.type === AST_NODE_TYPES43.ConditionalExpression) {
3833
+ if (parent.type === AST_NODE_TYPES51.ConditionalExpression) {
3206
3834
  return true;
3207
3835
  }
3208
- if (parent.type === AST_NODE_TYPES43.LogicalExpression) {
3836
+ if (parent.type === AST_NODE_TYPES51.LogicalExpression) {
3209
3837
  return true;
3210
3838
  }
3211
- if (parent.type === AST_NODE_TYPES43.AssignmentExpression && parent.left !== node) {
3839
+ if (parent.type === AST_NODE_TYPES51.AssignmentExpression && parent.left !== node) {
3212
3840
  return true;
3213
3841
  }
3214
3842
  return false;
3215
3843
  };
3216
- var preferFunctionDeclaration = createRule43({
3844
+ var preferFunctionDeclaration = createRule51({
3217
3845
  name: "prefer-function-declaration",
3218
3846
  meta: {
3219
3847
  type: "suggestion",
@@ -3234,14 +3862,14 @@ var preferFunctionDeclaration = createRule43({
3234
3862
  }
3235
3863
  return {
3236
3864
  VariableDeclarator(node) {
3237
- if (node.id.type !== AST_NODE_TYPES43.Identifier) {
3865
+ if (node.id.type !== AST_NODE_TYPES51.Identifier) {
3238
3866
  return;
3239
3867
  }
3240
3868
  const { init } = node;
3241
3869
  if (!init) {
3242
3870
  return;
3243
3871
  }
3244
- if (init.type === AST_NODE_TYPES43.ArrowFunctionExpression) {
3872
+ if (init.type === AST_NODE_TYPES51.ArrowFunctionExpression) {
3245
3873
  if (isCallbackContext(init)) {
3246
3874
  return;
3247
3875
  }
@@ -3251,7 +3879,7 @@ var preferFunctionDeclaration = createRule43({
3251
3879
  data: { name: node.id.name }
3252
3880
  });
3253
3881
  }
3254
- if (init.type === AST_NODE_TYPES43.FunctionExpression) {
3882
+ if (init.type === AST_NODE_TYPES51.FunctionExpression) {
3255
3883
  if (isCallbackContext(init)) {
3256
3884
  return;
3257
3885
  }
@@ -3268,11 +3896,11 @@ var preferFunctionDeclaration = createRule43({
3268
3896
  var prefer_function_declaration_default = preferFunctionDeclaration;
3269
3897
 
3270
3898
  // src/rules/prefer-guard-clause.ts
3271
- import { AST_NODE_TYPES as AST_NODE_TYPES44, ESLintUtils as ESLintUtils44 } from "@typescript-eslint/utils";
3272
- var createRule44 = ESLintUtils44.RuleCreator(
3899
+ import { AST_NODE_TYPES as AST_NODE_TYPES52, ESLintUtils as ESLintUtils52 } from "@typescript-eslint/utils";
3900
+ var createRule52 = ESLintUtils52.RuleCreator(
3273
3901
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3274
3902
  );
3275
- var preferGuardClause = createRule44({
3903
+ var preferGuardClause = createRule52({
3276
3904
  name: "prefer-guard-clause",
3277
3905
  meta: {
3278
3906
  type: "suggestion",
@@ -3289,8 +3917,8 @@ var preferGuardClause = createRule44({
3289
3917
  return {
3290
3918
  IfStatement(node) {
3291
3919
  const { consequent } = node;
3292
- if (consequent.type === AST_NODE_TYPES44.BlockStatement) {
3293
- const hasNestedIf = consequent.body.some((statement) => statement.type === AST_NODE_TYPES44.IfStatement);
3920
+ if (consequent.type === AST_NODE_TYPES52.BlockStatement) {
3921
+ const hasNestedIf = consequent.body.some((statement) => statement.type === AST_NODE_TYPES52.IfStatement);
3294
3922
  if (hasNestedIf && consequent.body.length === 1) {
3295
3923
  context.report({
3296
3924
  node,
@@ -3298,7 +3926,7 @@ var preferGuardClause = createRule44({
3298
3926
  });
3299
3927
  }
3300
3928
  }
3301
- if (consequent.type === AST_NODE_TYPES44.IfStatement) {
3929
+ if (consequent.type === AST_NODE_TYPES52.IfStatement) {
3302
3930
  context.report({
3303
3931
  node,
3304
3932
  messageId: "preferGuardClause"
@@ -3311,11 +3939,11 @@ var preferGuardClause = createRule44({
3311
3939
  var prefer_guard_clause_default = preferGuardClause;
3312
3940
 
3313
3941
  // src/rules/prefer-import-type.ts
3314
- import { AST_NODE_TYPES as AST_NODE_TYPES45, ESLintUtils as ESLintUtils45 } from "@typescript-eslint/utils";
3315
- var createRule45 = ESLintUtils45.RuleCreator(
3942
+ import { AST_NODE_TYPES as AST_NODE_TYPES53, ESLintUtils as ESLintUtils53 } from "@typescript-eslint/utils";
3943
+ var createRule53 = ESLintUtils53.RuleCreator(
3316
3944
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3317
3945
  );
3318
- var preferImportType = createRule45({
3946
+ var preferImportType = createRule53({
3319
3947
  name: "prefer-import-type",
3320
3948
  meta: {
3321
3949
  type: "suggestion",
@@ -3334,22 +3962,22 @@ var preferImportType = createRule45({
3334
3962
  let current = node;
3335
3963
  while (current) {
3336
3964
  switch (current.type) {
3337
- case AST_NODE_TYPES45.TSTypeReference:
3338
- case AST_NODE_TYPES45.TSTypeAnnotation:
3339
- case AST_NODE_TYPES45.TSTypeParameterInstantiation:
3340
- case AST_NODE_TYPES45.TSInterfaceHeritage:
3341
- case AST_NODE_TYPES45.TSClassImplements:
3342
- case AST_NODE_TYPES45.TSTypeQuery:
3343
- case AST_NODE_TYPES45.TSTypeAssertion:
3344
- case AST_NODE_TYPES45.TSAsExpression:
3345
- case AST_NODE_TYPES45.TSSatisfiesExpression:
3346
- case AST_NODE_TYPES45.TSTypeAliasDeclaration:
3347
- case AST_NODE_TYPES45.TSInterfaceDeclaration:
3348
- case AST_NODE_TYPES45.TSTypeParameter:
3349
- case AST_NODE_TYPES45.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:
3350
3978
  return true;
3351
- case AST_NODE_TYPES45.MemberExpression:
3352
- case AST_NODE_TYPES45.Identifier:
3979
+ case AST_NODE_TYPES53.MemberExpression:
3980
+ case AST_NODE_TYPES53.Identifier:
3353
3981
  current = current.parent;
3354
3982
  break;
3355
3983
  default:
@@ -3379,27 +4007,27 @@ var preferImportType = createRule45({
3379
4007
  return false;
3380
4008
  }
3381
4009
  switch (parent.type) {
3382
- case AST_NODE_TYPES45.CallExpression:
3383
- case AST_NODE_TYPES45.NewExpression:
3384
- case AST_NODE_TYPES45.JSXOpeningElement:
3385
- case AST_NODE_TYPES45.JSXClosingElement:
3386
- case AST_NODE_TYPES45.MemberExpression:
3387
- case AST_NODE_TYPES45.VariableDeclarator:
3388
- case AST_NODE_TYPES45.TaggedTemplateExpression:
3389
- case AST_NODE_TYPES45.SpreadElement:
3390
- case AST_NODE_TYPES45.ExportSpecifier:
3391
- case AST_NODE_TYPES45.ArrayExpression:
3392
- case AST_NODE_TYPES45.ObjectExpression:
3393
- case AST_NODE_TYPES45.BinaryExpression:
3394
- case AST_NODE_TYPES45.LogicalExpression:
3395
- case AST_NODE_TYPES45.UnaryExpression:
3396
- case AST_NODE_TYPES45.ReturnStatement:
3397
- case AST_NODE_TYPES45.ArrowFunctionExpression:
3398
- case AST_NODE_TYPES45.ConditionalExpression:
3399
- case AST_NODE_TYPES45.AwaitExpression:
3400
- case AST_NODE_TYPES45.YieldExpression:
3401
- case AST_NODE_TYPES45.Property:
3402
- case AST_NODE_TYPES45.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:
3403
4031
  return true;
3404
4032
  default:
3405
4033
  return false;
@@ -3411,7 +4039,7 @@ var preferImportType = createRule45({
3411
4039
  return;
3412
4040
  }
3413
4041
  const hasInlineTypeSpecifier = node.specifiers.some(
3414
- (specifier) => specifier.type === AST_NODE_TYPES45.ImportSpecifier && specifier.importKind === "type"
4042
+ (specifier) => specifier.type === AST_NODE_TYPES53.ImportSpecifier && specifier.importKind === "type"
3415
4043
  );
3416
4044
  if (hasInlineTypeSpecifier) {
3417
4045
  return;
@@ -3429,13 +4057,13 @@ var preferImportType = createRule45({
3429
4057
  }
3430
4058
  const scope = context.sourceCode.getScope(node);
3431
4059
  const isTypeOnlyImport2 = node.specifiers.every((specifier) => {
3432
- if (specifier.type === AST_NODE_TYPES45.ImportDefaultSpecifier) {
4060
+ if (specifier.type === AST_NODE_TYPES53.ImportDefaultSpecifier) {
3433
4061
  return false;
3434
4062
  }
3435
- if (specifier.type === AST_NODE_TYPES45.ImportNamespaceSpecifier) {
4063
+ if (specifier.type === AST_NODE_TYPES53.ImportNamespaceSpecifier) {
3436
4064
  return false;
3437
4065
  }
3438
- if (specifier.type === AST_NODE_TYPES45.ImportSpecifier) {
4066
+ if (specifier.type === AST_NODE_TYPES53.ImportSpecifier) {
3439
4067
  const localName = specifier.local.name;
3440
4068
  return !isUsedAsValue(localName, scope);
3441
4069
  }
@@ -3461,19 +4089,19 @@ var preferImportType = createRule45({
3461
4089
  var prefer_import_type_default = preferImportType;
3462
4090
 
3463
4091
  // src/rules/prefer-inline-literal-union.ts
3464
- import { AST_NODE_TYPES as AST_NODE_TYPES46, ESLintUtils as ESLintUtils46 } from "@typescript-eslint/utils";
3465
- var createRule46 = ESLintUtils46.RuleCreator(
4092
+ import { AST_NODE_TYPES as AST_NODE_TYPES54, ESLintUtils as ESLintUtils54 } from "@typescript-eslint/utils";
4093
+ var createRule54 = ESLintUtils54.RuleCreator(
3466
4094
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3467
4095
  );
3468
4096
  function isLiteralUnionType(node) {
3469
- if (node.type !== AST_NODE_TYPES46.TSUnionType) {
4097
+ if (node.type !== AST_NODE_TYPES54.TSUnionType) {
3470
4098
  return false;
3471
4099
  }
3472
4100
  return node.types.every(
3473
- (member) => member.type === AST_NODE_TYPES46.TSLiteralType || member.type === AST_NODE_TYPES46.TSNullKeyword || member.type === AST_NODE_TYPES46.TSUndefinedKeyword
4101
+ (member) => member.type === AST_NODE_TYPES54.TSLiteralType || member.type === AST_NODE_TYPES54.TSNullKeyword || member.type === AST_NODE_TYPES54.TSUndefinedKeyword
3474
4102
  );
3475
4103
  }
3476
- var preferInlineLiteralUnion = createRule46({
4104
+ var preferInlineLiteralUnion = createRule54({
3477
4105
  name: "prefer-inline-literal-union",
3478
4106
  meta: {
3479
4107
  type: "suggestion",
@@ -3500,10 +4128,10 @@ var preferInlineLiteralUnion = createRule46({
3500
4128
  return;
3501
4129
  }
3502
4130
  const { typeAnnotation } = node.typeAnnotation;
3503
- if (typeAnnotation.type !== AST_NODE_TYPES46.TSTypeReference) {
4131
+ if (typeAnnotation.type !== AST_NODE_TYPES54.TSTypeReference) {
3504
4132
  return;
3505
4133
  }
3506
- if (typeAnnotation.typeName.type !== AST_NODE_TYPES46.Identifier) {
4134
+ if (typeAnnotation.typeName.type !== AST_NODE_TYPES54.Identifier) {
3507
4135
  return;
3508
4136
  }
3509
4137
  const aliasName = typeAnnotation.typeName.name;
@@ -3527,12 +4155,12 @@ var preferInlineLiteralUnion = createRule46({
3527
4155
  var prefer_inline_literal_union_default = preferInlineLiteralUnion;
3528
4156
 
3529
4157
  // src/rules/prefer-inline-type-export.ts
3530
- import { AST_NODE_TYPES as AST_NODE_TYPES47, ESLintUtils as ESLintUtils47 } from "@typescript-eslint/utils";
3531
- var createRule47 = ESLintUtils47.RuleCreator(
4158
+ import { AST_NODE_TYPES as AST_NODE_TYPES55, ESLintUtils as ESLintUtils55 } from "@typescript-eslint/utils";
4159
+ var createRule55 = ESLintUtils55.RuleCreator(
3532
4160
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3533
4161
  );
3534
- var isTypeDeclaration = (node) => node.type === AST_NODE_TYPES47.TSInterfaceDeclaration || node.type === AST_NODE_TYPES47.TSTypeAliasDeclaration;
3535
- var preferInlineTypeExport = createRule47({
4162
+ var isTypeDeclaration = (node) => node.type === AST_NODE_TYPES55.TSInterfaceDeclaration || node.type === AST_NODE_TYPES55.TSTypeAliasDeclaration;
4163
+ var preferInlineTypeExport = createRule55({
3536
4164
  name: "prefer-inline-type-export",
3537
4165
  meta: {
3538
4166
  type: "suggestion",
@@ -3549,12 +4177,12 @@ var preferInlineTypeExport = createRule47({
3549
4177
  create(context) {
3550
4178
  const typeDeclarations = /* @__PURE__ */ new Map();
3551
4179
  function collectDeclaration(node) {
3552
- if (node.parent.type !== AST_NODE_TYPES47.ExportNamedDeclaration) {
4180
+ if (node.parent.type !== AST_NODE_TYPES55.ExportNamedDeclaration) {
3553
4181
  typeDeclarations.set(node.id.name, node);
3554
4182
  }
3555
4183
  }
3556
4184
  function reportSpecifier(specifier, statement, declarationNode) {
3557
- if (specifier.local.type !== AST_NODE_TYPES47.Identifier) {
4185
+ if (specifier.local.type !== AST_NODE_TYPES55.Identifier) {
3558
4186
  return;
3559
4187
  }
3560
4188
  const { name } = specifier.local;
@@ -3587,16 +4215,16 @@ var preferInlineTypeExport = createRule47({
3587
4215
  return {
3588
4216
  Program(node) {
3589
4217
  node.body.forEach((statement) => {
3590
- if (statement.type === AST_NODE_TYPES47.TSInterfaceDeclaration || statement.type === AST_NODE_TYPES47.TSTypeAliasDeclaration) {
4218
+ if (statement.type === AST_NODE_TYPES55.TSInterfaceDeclaration || statement.type === AST_NODE_TYPES55.TSTypeAliasDeclaration) {
3591
4219
  collectDeclaration(statement);
3592
4220
  }
3593
4221
  });
3594
4222
  node.body.forEach((statement) => {
3595
- if (statement.type !== AST_NODE_TYPES47.ExportNamedDeclaration || statement.declaration !== null) {
4223
+ if (statement.type !== AST_NODE_TYPES55.ExportNamedDeclaration || statement.declaration !== null) {
3596
4224
  return;
3597
4225
  }
3598
4226
  statement.specifiers.forEach((specifier) => {
3599
- if (specifier.local.type !== AST_NODE_TYPES47.Identifier) {
4227
+ if (specifier.local.type !== AST_NODE_TYPES55.Identifier) {
3600
4228
  return;
3601
4229
  }
3602
4230
  const declarationNode = typeDeclarations.get(specifier.local.name);
@@ -3613,11 +4241,11 @@ var preferInlineTypeExport = createRule47({
3613
4241
  var prefer_inline_type_export_default = preferInlineTypeExport;
3614
4242
 
3615
4243
  // src/rules/prefer-interface-for-component-props.ts
3616
- import { AST_NODE_TYPES as AST_NODE_TYPES48, ESLintUtils as ESLintUtils48 } from "@typescript-eslint/utils";
3617
- var createRule48 = ESLintUtils48.RuleCreator(
4244
+ import { AST_NODE_TYPES as AST_NODE_TYPES56, ESLintUtils as ESLintUtils56 } from "@typescript-eslint/utils";
4245
+ var createRule56 = ESLintUtils56.RuleCreator(
3618
4246
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3619
4247
  );
3620
- var preferInterfaceForComponentProps = createRule48({
4248
+ var preferInterfaceForComponentProps = createRule56({
3621
4249
  name: "prefer-interface-for-component-props",
3622
4250
  meta: {
3623
4251
  type: "suggestion",
@@ -3637,13 +4265,13 @@ var preferInterfaceForComponentProps = createRule48({
3637
4265
  }
3638
4266
  return {
3639
4267
  TSTypeAliasDeclaration(node) {
3640
- if (node.id.type !== AST_NODE_TYPES48.Identifier) {
4268
+ if (node.id.type !== AST_NODE_TYPES56.Identifier) {
3641
4269
  return;
3642
4270
  }
3643
4271
  if (!node.id.name.endsWith("Props")) {
3644
4272
  return;
3645
4273
  }
3646
- if (node.typeAnnotation.type !== AST_NODE_TYPES48.TSTypeLiteral) {
4274
+ if (node.typeAnnotation.type !== AST_NODE_TYPES56.TSTypeLiteral) {
3647
4275
  return;
3648
4276
  }
3649
4277
  const { name } = node.id;
@@ -3670,11 +4298,11 @@ var preferInterfaceForComponentProps = createRule48({
3670
4298
  var prefer_interface_for_component_props_default = preferInterfaceForComponentProps;
3671
4299
 
3672
4300
  // src/rules/prefer-interface-over-inline-types.ts
3673
- import { AST_NODE_TYPES as AST_NODE_TYPES49, ESLintUtils as ESLintUtils49 } from "@typescript-eslint/utils";
3674
- var createRule49 = ESLintUtils49.RuleCreator(
4301
+ import { AST_NODE_TYPES as AST_NODE_TYPES57, ESLintUtils as ESLintUtils57 } from "@typescript-eslint/utils";
4302
+ var createRule57 = ESLintUtils57.RuleCreator(
3675
4303
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3676
4304
  );
3677
- var preferInterfaceOverInlineTypes = createRule49({
4305
+ var preferInterfaceOverInlineTypes = createRule57({
3678
4306
  name: "prefer-interface-over-inline-types",
3679
4307
  meta: {
3680
4308
  type: "suggestion",
@@ -3690,54 +4318,54 @@ var preferInterfaceOverInlineTypes = createRule49({
3690
4318
  defaultOptions: [],
3691
4319
  create(context) {
3692
4320
  function hasJSXInConditional(node) {
3693
- return node.consequent.type === AST_NODE_TYPES49.JSXElement || node.consequent.type === AST_NODE_TYPES49.JSXFragment || node.alternate.type === AST_NODE_TYPES49.JSXElement || node.alternate.type === AST_NODE_TYPES49.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;
3694
4322
  }
3695
4323
  function hasJSXInLogical(node) {
3696
- return node.right.type === AST_NODE_TYPES49.JSXElement || node.right.type === AST_NODE_TYPES49.JSXFragment;
4324
+ return node.right.type === AST_NODE_TYPES57.JSXElement || node.right.type === AST_NODE_TYPES57.JSXFragment;
3697
4325
  }
3698
4326
  function hasJSXReturn(block) {
3699
4327
  return block.body.some((stmt) => {
3700
- if (stmt.type === AST_NODE_TYPES49.ReturnStatement && stmt.argument) {
3701
- return stmt.argument.type === AST_NODE_TYPES49.JSXElement || stmt.argument.type === AST_NODE_TYPES49.JSXFragment || stmt.argument.type === AST_NODE_TYPES49.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES49.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);
3702
4330
  }
3703
4331
  return false;
3704
4332
  });
3705
4333
  }
3706
4334
  function isReactComponent2(node) {
3707
- if (node.type === AST_NODE_TYPES49.ArrowFunctionExpression) {
3708
- if (node.body.type === AST_NODE_TYPES49.JSXElement || node.body.type === AST_NODE_TYPES49.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) {
3709
4337
  return true;
3710
4338
  }
3711
- if (node.body.type === AST_NODE_TYPES49.BlockStatement) {
4339
+ if (node.body.type === AST_NODE_TYPES57.BlockStatement) {
3712
4340
  return hasJSXReturn(node.body);
3713
4341
  }
3714
- } else if (node.type === AST_NODE_TYPES49.FunctionExpression || node.type === AST_NODE_TYPES49.FunctionDeclaration) {
3715
- if (node.body && node.body.type === AST_NODE_TYPES49.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) {
3716
4344
  return hasJSXReturn(node.body);
3717
4345
  }
3718
4346
  }
3719
4347
  return false;
3720
4348
  }
3721
4349
  function isInlineTypeAnnotation(node) {
3722
- if (node.type === AST_NODE_TYPES49.TSTypeLiteral) {
4350
+ if (node.type === AST_NODE_TYPES57.TSTypeLiteral) {
3723
4351
  return true;
3724
4352
  }
3725
- if (node.type === AST_NODE_TYPES49.TSTypeReference && node.typeArguments) {
3726
- return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES49.TSTypeLiteral);
4353
+ if (node.type === AST_NODE_TYPES57.TSTypeReference && node.typeArguments) {
4354
+ return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES57.TSTypeLiteral);
3727
4355
  }
3728
- if (node.type === AST_NODE_TYPES49.TSUnionType) {
4356
+ if (node.type === AST_NODE_TYPES57.TSUnionType) {
3729
4357
  return node.types.some((type) => isInlineTypeAnnotation(type));
3730
4358
  }
3731
4359
  return false;
3732
4360
  }
3733
4361
  function hasInlineObjectType(node) {
3734
- if (node.type === AST_NODE_TYPES49.TSTypeLiteral) {
4362
+ if (node.type === AST_NODE_TYPES57.TSTypeLiteral) {
3735
4363
  return true;
3736
4364
  }
3737
- if (node.type === AST_NODE_TYPES49.TSTypeReference && node.typeArguments) {
3738
- return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES49.TSTypeLiteral);
4365
+ if (node.type === AST_NODE_TYPES57.TSTypeReference && node.typeArguments) {
4366
+ return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES57.TSTypeLiteral);
3739
4367
  }
3740
- if (node.type === AST_NODE_TYPES49.TSUnionType) {
4368
+ if (node.type === AST_NODE_TYPES57.TSUnionType) {
3741
4369
  return node.types.some((type) => hasInlineObjectType(type));
3742
4370
  }
3743
4371
  return false;
@@ -3750,7 +4378,7 @@ var preferInterfaceOverInlineTypes = createRule49({
3750
4378
  return;
3751
4379
  }
3752
4380
  const param = node.params[0];
3753
- if (param.type === AST_NODE_TYPES49.Identifier && param.typeAnnotation) {
4381
+ if (param.type === AST_NODE_TYPES57.Identifier && param.typeAnnotation) {
3754
4382
  const { typeAnnotation } = param.typeAnnotation;
3755
4383
  if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
3756
4384
  context.report({
@@ -3770,11 +4398,11 @@ var preferInterfaceOverInlineTypes = createRule49({
3770
4398
  var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
3771
4399
 
3772
4400
  // src/rules/prefer-jsx-template-literals.ts
3773
- import { AST_NODE_TYPES as AST_NODE_TYPES50, ESLintUtils as ESLintUtils50 } from "@typescript-eslint/utils";
3774
- var createRule50 = ESLintUtils50.RuleCreator(
4401
+ import { AST_NODE_TYPES as AST_NODE_TYPES58, ESLintUtils as ESLintUtils58 } from "@typescript-eslint/utils";
4402
+ var createRule58 = ESLintUtils58.RuleCreator(
3775
4403
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3776
4404
  );
3777
- var preferJSXTemplateLiterals = createRule50({
4405
+ var preferJSXTemplateLiterals = createRule58({
3778
4406
  name: "prefer-jsx-template-literals",
3779
4407
  meta: {
3780
4408
  type: "suggestion",
@@ -3843,9 +4471,9 @@ var preferJSXTemplateLiterals = createRule50({
3843
4471
  if (!child || !nextChild) {
3844
4472
  return;
3845
4473
  }
3846
- if (child.type === AST_NODE_TYPES50.JSXText && nextChild.type === AST_NODE_TYPES50.JSXExpressionContainer) {
4474
+ if (child.type === AST_NODE_TYPES58.JSXText && nextChild.type === AST_NODE_TYPES58.JSXExpressionContainer) {
3847
4475
  handleTextBeforeExpression(child, nextChild);
3848
- } else if (child.type === AST_NODE_TYPES50.JSXExpressionContainer && nextChild.type === AST_NODE_TYPES50.JSXText) {
4476
+ } else if (child.type === AST_NODE_TYPES58.JSXExpressionContainer && nextChild.type === AST_NODE_TYPES58.JSXText) {
3849
4477
  handleExpressionBeforeText(child, nextChild);
3850
4478
  }
3851
4479
  }
@@ -3858,32 +4486,32 @@ var preferJSXTemplateLiterals = createRule50({
3858
4486
  var prefer_jsx_template_literals_default = preferJSXTemplateLiterals;
3859
4487
 
3860
4488
  // src/rules/prefer-named-param-types.ts
3861
- import { AST_NODE_TYPES as AST_NODE_TYPES51, ESLintUtils as ESLintUtils51 } from "@typescript-eslint/utils";
3862
- var createRule51 = ESLintUtils51.RuleCreator(
4489
+ import { AST_NODE_TYPES as AST_NODE_TYPES59, ESLintUtils as ESLintUtils59 } from "@typescript-eslint/utils";
4490
+ var createRule59 = ESLintUtils59.RuleCreator(
3863
4491
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3864
4492
  );
3865
4493
  var returnsJsx2 = (node) => {
3866
- if (node.type === AST_NODE_TYPES51.JSXElement || node.type === AST_NODE_TYPES51.JSXFragment) {
4494
+ if (node.type === AST_NODE_TYPES59.JSXElement || node.type === AST_NODE_TYPES59.JSXFragment) {
3867
4495
  return true;
3868
4496
  }
3869
- if (node.type === AST_NODE_TYPES51.ConditionalExpression) {
4497
+ if (node.type === AST_NODE_TYPES59.ConditionalExpression) {
3870
4498
  return returnsJsx2(node.consequent) || returnsJsx2(node.alternate);
3871
4499
  }
3872
- if (node.type === AST_NODE_TYPES51.LogicalExpression) {
4500
+ if (node.type === AST_NODE_TYPES59.LogicalExpression) {
3873
4501
  return returnsJsx2(node.left) || returnsJsx2(node.right);
3874
4502
  }
3875
4503
  return false;
3876
4504
  };
3877
4505
  var bodyReturnsJsx2 = (body) => {
3878
- if (body.type !== AST_NODE_TYPES51.BlockStatement) {
4506
+ if (body.type !== AST_NODE_TYPES59.BlockStatement) {
3879
4507
  return returnsJsx2(body);
3880
4508
  }
3881
4509
  return body.body.some(
3882
- (stmt) => stmt.type === AST_NODE_TYPES51.ReturnStatement && stmt.argument !== null && returnsJsx2(stmt.argument)
4510
+ (stmt) => stmt.type === AST_NODE_TYPES59.ReturnStatement && stmt.argument !== null && returnsJsx2(stmt.argument)
3883
4511
  );
3884
4512
  };
3885
4513
  var isReactComponentFunction = (node) => bodyReturnsJsx2(node.body);
3886
- var preferNamedParamTypes = createRule51({
4514
+ var preferNamedParamTypes = createRule59({
3887
4515
  name: "prefer-named-param-types",
3888
4516
  meta: {
3889
4517
  type: "suggestion",
@@ -3898,16 +4526,16 @@ var preferNamedParamTypes = createRule51({
3898
4526
  defaultOptions: [],
3899
4527
  create(context) {
3900
4528
  function hasInlineObjectType(param) {
3901
- if (param.type === AST_NODE_TYPES51.AssignmentPattern) {
4529
+ if (param.type === AST_NODE_TYPES59.AssignmentPattern) {
3902
4530
  return hasInlineObjectType(param.left);
3903
4531
  }
3904
- if (param.type === AST_NODE_TYPES51.ObjectPattern) {
3905
- if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES51.TSTypeLiteral) {
4532
+ if (param.type === AST_NODE_TYPES59.ObjectPattern) {
4533
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES59.TSTypeLiteral) {
3906
4534
  return true;
3907
4535
  }
3908
4536
  }
3909
- if (param.type === AST_NODE_TYPES51.Identifier) {
3910
- if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES51.TSTypeLiteral) {
4537
+ if (param.type === AST_NODE_TYPES59.Identifier) {
4538
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES59.TSTypeLiteral) {
3911
4539
  return true;
3912
4540
  }
3913
4541
  }
@@ -3920,7 +4548,7 @@ var preferNamedParamTypes = createRule51({
3920
4548
  } else if ("value" in node && node.value) {
3921
4549
  params = node.value.params;
3922
4550
  }
3923
- if ((node.type === AST_NODE_TYPES51.FunctionDeclaration || node.type === AST_NODE_TYPES51.FunctionExpression || node.type === AST_NODE_TYPES51.ArrowFunctionExpression) && params.length === 1 && params[0].type === AST_NODE_TYPES51.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)) {
3924
4552
  return;
3925
4553
  }
3926
4554
  params.forEach((param) => {
@@ -3944,11 +4572,11 @@ var preferNamedParamTypes = createRule51({
3944
4572
  var prefer_named_param_types_default = preferNamedParamTypes;
3945
4573
 
3946
4574
  // src/rules/prefer-props-with-children.ts
3947
- import { AST_NODE_TYPES as AST_NODE_TYPES52, ESLintUtils as ESLintUtils52 } from "@typescript-eslint/utils";
3948
- var createRule52 = ESLintUtils52.RuleCreator(
4575
+ import { AST_NODE_TYPES as AST_NODE_TYPES60, ESLintUtils as ESLintUtils60 } from "@typescript-eslint/utils";
4576
+ var createRule60 = ESLintUtils60.RuleCreator(
3949
4577
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3950
4578
  );
3951
- var preferPropsWithChildren = createRule52({
4579
+ var preferPropsWithChildren = createRule60({
3952
4580
  name: "prefer-props-with-children",
3953
4581
  meta: {
3954
4582
  type: "suggestion",
@@ -3966,24 +4594,24 @@ var preferPropsWithChildren = createRule52({
3966
4594
  if (!typeNode) {
3967
4595
  return false;
3968
4596
  }
3969
- if (typeNode.type !== AST_NODE_TYPES52.TSTypeReference) {
4597
+ if (typeNode.type !== AST_NODE_TYPES60.TSTypeReference) {
3970
4598
  return false;
3971
4599
  }
3972
4600
  const { typeName } = typeNode;
3973
- if (typeName.type === AST_NODE_TYPES52.Identifier) {
4601
+ if (typeName.type === AST_NODE_TYPES60.Identifier) {
3974
4602
  return typeName.name === "ReactNode";
3975
4603
  }
3976
- if (typeName.type === AST_NODE_TYPES52.TSQualifiedName && typeName.left.type === AST_NODE_TYPES52.Identifier && typeName.left.name === "React" && typeName.right.type === AST_NODE_TYPES52.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") {
3977
4605
  return true;
3978
4606
  }
3979
4607
  return false;
3980
4608
  }
3981
4609
  function findChildrenReactNode(members) {
3982
4610
  for (const member of members) {
3983
- if (member.type !== AST_NODE_TYPES52.TSPropertySignature) {
4611
+ if (member.type !== AST_NODE_TYPES60.TSPropertySignature) {
3984
4612
  continue;
3985
4613
  }
3986
- if (member.key.type !== AST_NODE_TYPES52.Identifier) {
4614
+ if (member.key.type !== AST_NODE_TYPES60.Identifier) {
3987
4615
  continue;
3988
4616
  }
3989
4617
  if (member.key.name !== "children") {
@@ -4023,11 +4651,11 @@ var preferPropsWithChildren = createRule52({
4023
4651
  var prefer_props_with_children_default = preferPropsWithChildren;
4024
4652
 
4025
4653
  // src/rules/prefer-react-import-types.ts
4026
- import { AST_NODE_TYPES as AST_NODE_TYPES53, ESLintUtils as ESLintUtils53 } from "@typescript-eslint/utils";
4027
- var createRule53 = ESLintUtils53.RuleCreator(
4654
+ import { AST_NODE_TYPES as AST_NODE_TYPES61, ESLintUtils as ESLintUtils61 } from "@typescript-eslint/utils";
4655
+ var createRule61 = ESLintUtils61.RuleCreator(
4028
4656
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4029
4657
  );
4030
- var preferReactImportTypes = createRule53({
4658
+ var preferReactImportTypes = createRule61({
4031
4659
  name: "prefer-react-import-types",
4032
4660
  meta: {
4033
4661
  type: "suggestion",
@@ -4103,7 +4731,7 @@ var preferReactImportTypes = createRule53({
4103
4731
  ]);
4104
4732
  const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
4105
4733
  function checkMemberExpression(node) {
4106
- if (node.object.type === AST_NODE_TYPES53.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES53.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)) {
4107
4735
  const typeName = node.property.name;
4108
4736
  const isType = reactTypes.has(typeName);
4109
4737
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -4120,7 +4748,7 @@ var preferReactImportTypes = createRule53({
4120
4748
  return {
4121
4749
  MemberExpression: checkMemberExpression,
4122
4750
  "TSTypeReference > TSQualifiedName": (node) => {
4123
- if (node.left.type === AST_NODE_TYPES53.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES53.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)) {
4124
4752
  const typeName = node.right.name;
4125
4753
  const isType = reactTypes.has(typeName);
4126
4754
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -4140,11 +4768,11 @@ var preferReactImportTypes = createRule53({
4140
4768
  var prefer_react_import_types_default = preferReactImportTypes;
4141
4769
 
4142
4770
  // src/rules/react-props-destructure.ts
4143
- import { AST_NODE_TYPES as AST_NODE_TYPES54, ESLintUtils as ESLintUtils54 } from "@typescript-eslint/utils";
4144
- var createRule54 = ESLintUtils54.RuleCreator(
4771
+ import { AST_NODE_TYPES as AST_NODE_TYPES62, ESLintUtils as ESLintUtils62 } from "@typescript-eslint/utils";
4772
+ var createRule62 = ESLintUtils62.RuleCreator(
4145
4773
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4146
4774
  );
4147
- var reactPropsDestructure = createRule54({
4775
+ var reactPropsDestructure = createRule62({
4148
4776
  name: "react-props-destructure",
4149
4777
  meta: {
4150
4778
  type: "suggestion",
@@ -4160,29 +4788,29 @@ var reactPropsDestructure = createRule54({
4160
4788
  defaultOptions: [],
4161
4789
  create(context) {
4162
4790
  function hasJSXInConditional(node) {
4163
- return node.consequent.type === AST_NODE_TYPES54.JSXElement || node.consequent.type === AST_NODE_TYPES54.JSXFragment || node.alternate.type === AST_NODE_TYPES54.JSXElement || node.alternate.type === AST_NODE_TYPES54.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;
4164
4792
  }
4165
4793
  function hasJSXInLogical(node) {
4166
- return node.right.type === AST_NODE_TYPES54.JSXElement || node.right.type === AST_NODE_TYPES54.JSXFragment;
4794
+ return node.right.type === AST_NODE_TYPES62.JSXElement || node.right.type === AST_NODE_TYPES62.JSXFragment;
4167
4795
  }
4168
4796
  function hasJSXReturn(block) {
4169
4797
  return block.body.some((stmt) => {
4170
- if (stmt.type === AST_NODE_TYPES54.ReturnStatement && stmt.argument) {
4171
- return stmt.argument.type === AST_NODE_TYPES54.JSXElement || stmt.argument.type === AST_NODE_TYPES54.JSXFragment || stmt.argument.type === AST_NODE_TYPES54.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES54.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);
4172
4800
  }
4173
4801
  return false;
4174
4802
  });
4175
4803
  }
4176
4804
  function isReactComponent2(node) {
4177
- if (node.type === AST_NODE_TYPES54.ArrowFunctionExpression) {
4178
- if (node.body.type === AST_NODE_TYPES54.JSXElement || node.body.type === AST_NODE_TYPES54.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) {
4179
4807
  return true;
4180
4808
  }
4181
- if (node.body.type === AST_NODE_TYPES54.BlockStatement) {
4809
+ if (node.body.type === AST_NODE_TYPES62.BlockStatement) {
4182
4810
  return hasJSXReturn(node.body);
4183
4811
  }
4184
- } else if (node.type === AST_NODE_TYPES54.FunctionExpression || node.type === AST_NODE_TYPES54.FunctionDeclaration) {
4185
- if (node.body && node.body.type === AST_NODE_TYPES54.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) {
4186
4814
  return hasJSXReturn(node.body);
4187
4815
  }
4188
4816
  }
@@ -4196,9 +4824,9 @@ var reactPropsDestructure = createRule54({
4196
4824
  return;
4197
4825
  }
4198
4826
  const param = node.params[0];
4199
- if (param.type === AST_NODE_TYPES54.ObjectPattern) {
4200
- const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES54.Property).map((prop) => {
4201
- if (prop.key.type === AST_NODE_TYPES54.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) {
4202
4830
  return prop.key.name;
4203
4831
  }
4204
4832
  return null;
@@ -4225,57 +4853,57 @@ var reactPropsDestructure = createRule54({
4225
4853
  var react_props_destructure_default = reactPropsDestructure;
4226
4854
 
4227
4855
  // src/rules/require-explicit-return-type.ts
4228
- import { AST_NODE_TYPES as AST_NODE_TYPES55, ESLintUtils as ESLintUtils55 } from "@typescript-eslint/utils";
4229
- var createRule55 = ESLintUtils55.RuleCreator(
4856
+ import { AST_NODE_TYPES as AST_NODE_TYPES63, ESLintUtils as ESLintUtils63 } from "@typescript-eslint/utils";
4857
+ var createRule63 = ESLintUtils63.RuleCreator(
4230
4858
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4231
4859
  );
4232
4860
  var isReactComponent = (node) => {
4233
- if (node.type === AST_NODE_TYPES55.ArrowFunctionExpression) {
4861
+ if (node.type === AST_NODE_TYPES63.ArrowFunctionExpression) {
4234
4862
  const { parent } = node;
4235
- if (parent?.type === AST_NODE_TYPES55.VariableDeclarator) {
4863
+ if (parent?.type === AST_NODE_TYPES63.VariableDeclarator) {
4236
4864
  const { id } = parent;
4237
- if (id.type === AST_NODE_TYPES55.Identifier) {
4865
+ if (id.type === AST_NODE_TYPES63.Identifier) {
4238
4866
  return /^[A-Z]/.test(id.name);
4239
4867
  }
4240
4868
  }
4241
4869
  }
4242
- if (node.type === AST_NODE_TYPES55.FunctionDeclaration && node.id) {
4870
+ if (node.type === AST_NODE_TYPES63.FunctionDeclaration && node.id) {
4243
4871
  return /^[A-Z]/.test(node.id.name);
4244
4872
  }
4245
4873
  return false;
4246
4874
  };
4247
4875
  var isCallbackFunction = (node) => {
4248
- if (node.type === AST_NODE_TYPES55.FunctionDeclaration) {
4876
+ if (node.type === AST_NODE_TYPES63.FunctionDeclaration) {
4249
4877
  return false;
4250
4878
  }
4251
4879
  const { parent } = node;
4252
4880
  if (!parent) {
4253
4881
  return false;
4254
4882
  }
4255
- if (parent.type === AST_NODE_TYPES55.CallExpression && parent.arguments.includes(node)) {
4883
+ if (parent.type === AST_NODE_TYPES63.CallExpression && parent.arguments.includes(node)) {
4256
4884
  return true;
4257
4885
  }
4258
- if (parent.type === AST_NODE_TYPES55.Property) {
4886
+ if (parent.type === AST_NODE_TYPES63.Property) {
4259
4887
  return true;
4260
4888
  }
4261
- if (parent.type === AST_NODE_TYPES55.ArrayExpression) {
4889
+ if (parent.type === AST_NODE_TYPES63.ArrayExpression) {
4262
4890
  return true;
4263
4891
  }
4264
4892
  return false;
4265
4893
  };
4266
4894
  var getFunctionName = (node) => {
4267
- if (node.type === AST_NODE_TYPES55.FunctionDeclaration && node.id) {
4895
+ if (node.type === AST_NODE_TYPES63.FunctionDeclaration && node.id) {
4268
4896
  return node.id.name;
4269
4897
  }
4270
- if (node.type === AST_NODE_TYPES55.FunctionExpression && node.id) {
4898
+ if (node.type === AST_NODE_TYPES63.FunctionExpression && node.id) {
4271
4899
  return node.id.name;
4272
4900
  }
4273
- if ((node.type === AST_NODE_TYPES55.ArrowFunctionExpression || node.type === AST_NODE_TYPES55.FunctionExpression) && node.parent?.type === AST_NODE_TYPES55.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES55.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) {
4274
4902
  return node.parent.id.name;
4275
4903
  }
4276
4904
  return null;
4277
4905
  };
4278
- var requireExplicitReturnType = createRule55({
4906
+ var requireExplicitReturnType = createRule63({
4279
4907
  name: "require-explicit-return-type",
4280
4908
  meta: {
4281
4909
  type: "suggestion",
@@ -4324,8 +4952,8 @@ var requireExplicitReturnType = createRule55({
4324
4952
  var require_explicit_return_type_default = requireExplicitReturnType;
4325
4953
 
4326
4954
  // src/rules/sort-exports.ts
4327
- import { AST_NODE_TYPES as AST_NODE_TYPES56, ESLintUtils as ESLintUtils56 } from "@typescript-eslint/utils";
4328
- var createRule56 = ESLintUtils56.RuleCreator(
4955
+ import { AST_NODE_TYPES as AST_NODE_TYPES64, ESLintUtils as ESLintUtils64 } from "@typescript-eslint/utils";
4956
+ var createRule64 = ESLintUtils64.RuleCreator(
4329
4957
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4330
4958
  );
4331
4959
  var GROUP_NAMES = ["", "external/alias re-export", "relative re-export", "local export"];
@@ -4339,7 +4967,7 @@ function getExportGroup(node) {
4339
4967
  }
4340
4968
  return 1;
4341
4969
  }
4342
- var sortExports = createRule56({
4970
+ var sortExports = createRule64({
4343
4971
  name: "sort-exports",
4344
4972
  meta: {
4345
4973
  type: "suggestion",
@@ -4379,7 +5007,7 @@ var sortExports = createRule56({
4379
5007
  Program(node) {
4380
5008
  const exportGroups = [];
4381
5009
  node.body.forEach((statement) => {
4382
- if (statement.type !== AST_NODE_TYPES56.ExportNamedDeclaration || statement.declaration !== null) {
5010
+ if (statement.type !== AST_NODE_TYPES64.ExportNamedDeclaration || statement.declaration !== null) {
4383
5011
  if (exportGroups.length > 0) {
4384
5012
  checkOrder(exportGroups);
4385
5013
  exportGroups.length = 0;
@@ -4398,8 +5026,8 @@ var sortExports = createRule56({
4398
5026
  var sort_exports_default = sortExports;
4399
5027
 
4400
5028
  // src/rules/sort-imports.ts
4401
- import { AST_NODE_TYPES as AST_NODE_TYPES57, ESLintUtils as ESLintUtils57 } from "@typescript-eslint/utils";
4402
- var createRule57 = ESLintUtils57.RuleCreator(
5029
+ import { AST_NODE_TYPES as AST_NODE_TYPES65, ESLintUtils as ESLintUtils65 } from "@typescript-eslint/utils";
5030
+ var createRule65 = ESLintUtils65.RuleCreator(
4403
5031
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4404
5032
  );
4405
5033
  var NODE_BUILTINS = /* @__PURE__ */ new Set([
@@ -4466,7 +5094,7 @@ function getImportGroup(node) {
4466
5094
  function isTypeOnlyImport(node) {
4467
5095
  return node.importKind === "type" && node.specifiers.length > 0;
4468
5096
  }
4469
- var sortImports = createRule57({
5097
+ var sortImports = createRule65({
4470
5098
  name: "sort-imports",
4471
5099
  meta: {
4472
5100
  type: "suggestion",
@@ -4510,7 +5138,7 @@ var sortImports = createRule57({
4510
5138
  Program(node) {
4511
5139
  const importGroups = [];
4512
5140
  node.body.forEach((statement) => {
4513
- if (statement.type !== AST_NODE_TYPES57.ImportDeclaration) {
5141
+ if (statement.type !== AST_NODE_TYPES65.ImportDeclaration) {
4514
5142
  if (importGroups.length > 0) {
4515
5143
  checkOrder(importGroups);
4516
5144
  importGroups.length = 0;
@@ -4532,13 +5160,13 @@ var sortImports = createRule57({
4532
5160
  var sort_imports_default = sortImports;
4533
5161
 
4534
5162
  // src/rules/sort-type-alphabetically.ts
4535
- import { AST_NODE_TYPES as AST_NODE_TYPES58, ESLintUtils as ESLintUtils58 } from "@typescript-eslint/utils";
4536
- var createRule58 = ESLintUtils58.RuleCreator(
5163
+ import { AST_NODE_TYPES as AST_NODE_TYPES66, ESLintUtils as ESLintUtils66 } from "@typescript-eslint/utils";
5164
+ var createRule66 = ESLintUtils66.RuleCreator(
4537
5165
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4538
5166
  );
4539
5167
  function isAlphabeticallySortedWithinGroups(members) {
4540
5168
  const properties = members.filter(
4541
- (member) => member.type === AST_NODE_TYPES58.TSPropertySignature && member.key.type === AST_NODE_TYPES58.Identifier
5169
+ (member) => member.type === AST_NODE_TYPES66.TSPropertySignature && member.key.type === AST_NODE_TYPES66.Identifier
4542
5170
  );
4543
5171
  if (properties.length < 2) {
4544
5172
  return true;
@@ -4549,7 +5177,7 @@ function isAlphabeticallySortedWithinGroups(members) {
4549
5177
  const isOptionalSorted = optional.every((name, index) => index === 0 || optional[index - 1].localeCompare(name) <= 0);
4550
5178
  return isRequiredSorted && isOptionalSorted;
4551
5179
  }
4552
- var sortTypeAlphabetically = createRule58({
5180
+ var sortTypeAlphabetically = createRule66({
4553
5181
  name: "sort-type-alphabetically",
4554
5182
  meta: {
4555
5183
  type: "suggestion",
@@ -4567,7 +5195,7 @@ var sortTypeAlphabetically = createRule58({
4567
5195
  function fixMembers(fixer, members) {
4568
5196
  const { sourceCode } = context;
4569
5197
  const properties = members.filter(
4570
- (member) => member.type === AST_NODE_TYPES58.TSPropertySignature && member.key.type === AST_NODE_TYPES58.Identifier
5198
+ (member) => member.type === AST_NODE_TYPES66.TSPropertySignature && member.key.type === AST_NODE_TYPES66.Identifier
4571
5199
  );
4572
5200
  const required = properties.filter((prop) => !prop.optional);
4573
5201
  const optional = properties.filter((prop) => prop.optional);
@@ -4604,7 +5232,7 @@ var sortTypeAlphabetically = createRule58({
4604
5232
  }
4605
5233
  },
4606
5234
  TSTypeAliasDeclaration(node) {
4607
- if (node.typeAnnotation.type !== AST_NODE_TYPES58.TSTypeLiteral) {
5235
+ if (node.typeAnnotation.type !== AST_NODE_TYPES66.TSTypeLiteral) {
4608
5236
  return;
4609
5237
  }
4610
5238
  const { members } = node.typeAnnotation;
@@ -4624,13 +5252,13 @@ var sortTypeAlphabetically = createRule58({
4624
5252
  var sort_type_alphabetically_default = sortTypeAlphabetically;
4625
5253
 
4626
5254
  // src/rules/sort-type-required-first.ts
4627
- import { AST_NODE_TYPES as AST_NODE_TYPES59, ESLintUtils as ESLintUtils59 } from "@typescript-eslint/utils";
4628
- var createRule59 = ESLintUtils59.RuleCreator(
5255
+ import { AST_NODE_TYPES as AST_NODE_TYPES67, ESLintUtils as ESLintUtils67 } from "@typescript-eslint/utils";
5256
+ var createRule67 = ESLintUtils67.RuleCreator(
4629
5257
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4630
5258
  );
4631
5259
  function isRequiredBeforeOptional(members) {
4632
5260
  const properties = members.filter(
4633
- (member) => member.type === AST_NODE_TYPES59.TSPropertySignature && member.key.type === AST_NODE_TYPES59.Identifier
5261
+ (member) => member.type === AST_NODE_TYPES67.TSPropertySignature && member.key.type === AST_NODE_TYPES67.Identifier
4634
5262
  );
4635
5263
  if (properties.length < 2) {
4636
5264
  return true;
@@ -4641,7 +5269,7 @@ function isRequiredBeforeOptional(members) {
4641
5269
  }
4642
5270
  return properties.slice(firstOptionalIndex).every((prop) => prop.optional);
4643
5271
  }
4644
- var sortTypeRequiredFirst = createRule59({
5272
+ var sortTypeRequiredFirst = createRule67({
4645
5273
  name: "sort-type-required-first",
4646
5274
  meta: {
4647
5275
  type: "suggestion",
@@ -4659,7 +5287,7 @@ var sortTypeRequiredFirst = createRule59({
4659
5287
  function fixMembers(fixer, members) {
4660
5288
  const { sourceCode } = context;
4661
5289
  const properties = members.filter(
4662
- (member) => member.type === AST_NODE_TYPES59.TSPropertySignature && member.key.type === AST_NODE_TYPES59.Identifier
5290
+ (member) => member.type === AST_NODE_TYPES67.TSPropertySignature && member.key.type === AST_NODE_TYPES67.Identifier
4663
5291
  );
4664
5292
  const required = properties.filter((prop) => !prop.optional);
4665
5293
  const optional = properties.filter((prop) => prop.optional);
@@ -4680,7 +5308,7 @@ var sortTypeRequiredFirst = createRule59({
4680
5308
  }
4681
5309
  },
4682
5310
  TSTypeAliasDeclaration(node) {
4683
- if (node.typeAnnotation.type !== AST_NODE_TYPES59.TSTypeLiteral) {
5311
+ if (node.typeAnnotation.type !== AST_NODE_TYPES67.TSTypeLiteral) {
4684
5312
  return;
4685
5313
  }
4686
5314
  const { members } = node.typeAnnotation;
@@ -4708,18 +5336,24 @@ var rules = {
4708
5336
  "boolean-naming-prefix": boolean_naming_prefix_default,
4709
5337
  "enforce-camel-case": enforce_camel_case_default,
4710
5338
  "enforce-constant-case": enforce_constant_case_default,
5339
+ "enforce-hook-filename": enforce_hook_filename_default,
4711
5340
  "enforce-hook-naming": enforce_hook_naming_default,
4712
5341
  "enforce-property-case": enforce_property_case_default,
4713
5342
  "enforce-props-suffix": enforce_props_suffix_default,
4714
5343
  "enforce-readonly-component-props": enforce_readonly_component_props_default,
5344
+ "enforce-render-naming": enforce_render_naming_default,
4715
5345
  "enforce-service-naming": enforce_service_naming_default,
5346
+ "enforce-test-filename": enforce_test_filename_default,
4716
5347
  "enforce-sorted-destructuring": enforce_sorted_destructuring_default,
4717
5348
  "enforce-type-declaration-order": enforce_type_declaration_order_default,
4718
5349
  "index-export-only": index_export_only_default,
4719
5350
  "jsx-newline-between-elements": jsx_newline_between_elements_default,
5351
+ "jsx-no-data-array": jsx_no_data_array_default,
5352
+ "jsx-no-data-object": jsx_no_data_object_default,
4720
5353
  "jsx-no-inline-object-prop": jsx_no_inline_object_prop_default,
4721
5354
  "jsx-no-newline-single-line-elements": jsx_no_newline_single_line_elements_default,
4722
5355
  "jsx-no-non-component-function": jsx_no_non_component_function_default,
5356
+ "jsx-no-sub-interface": jsx_no_sub_interface_default,
4723
5357
  "jsx-no-ternary-null": jsx_no_ternary_null_default,
4724
5358
  "jsx-no-variable-in-callback": jsx_no_variable_in_callback_default,
4725
5359
  "jsx-require-suspense": jsx_require_suspense_default,
@@ -4733,6 +5367,8 @@ var rules = {
4733
5367
  "no-emoji": no_emoji_default,
4734
5368
  "no-env-fallback": no_env_fallback_default,
4735
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,
4736
5372
  "no-inline-default-export": no_inline_default_export_default,
4737
5373
  "no-inline-nested-object": no_inline_nested_object_default,
4738
5374
  "no-inline-return-properties": no_inline_return_properties_default,
@@ -4773,9 +5409,11 @@ var baseRules = {
4773
5409
  "nextfriday/boolean-naming-prefix": "warn",
4774
5410
  "nextfriday/enforce-camel-case": "warn",
4775
5411
  "nextfriday/enforce-constant-case": "warn",
5412
+ "nextfriday/enforce-hook-filename": "warn",
4776
5413
  "nextfriday/enforce-hook-naming": "warn",
4777
5414
  "nextfriday/enforce-property-case": "warn",
4778
5415
  "nextfriday/enforce-service-naming": "warn",
5416
+ "nextfriday/enforce-test-filename": "warn",
4779
5417
  "nextfriday/enforce-sorted-destructuring": "warn",
4780
5418
  "nextfriday/enforce-type-declaration-order": "warn",
4781
5419
  "nextfriday/index-export-only": "warn",
@@ -4815,9 +5453,11 @@ var baseRecommendedRules = {
4815
5453
  "nextfriday/boolean-naming-prefix": "error",
4816
5454
  "nextfriday/enforce-camel-case": "error",
4817
5455
  "nextfriday/enforce-constant-case": "error",
5456
+ "nextfriday/enforce-hook-filename": "error",
4818
5457
  "nextfriday/enforce-hook-naming": "error",
4819
5458
  "nextfriday/enforce-property-case": "error",
4820
5459
  "nextfriday/enforce-service-naming": "error",
5460
+ "nextfriday/enforce-test-filename": "error",
4821
5461
  "nextfriday/enforce-sorted-destructuring": "error",
4822
5462
  "nextfriday/enforce-type-declaration-order": "error",
4823
5463
  "nextfriday/index-export-only": "error",
@@ -4856,10 +5496,14 @@ var baseRecommendedRules = {
4856
5496
  var jsxRules = {
4857
5497
  "nextfriday/enforce-props-suffix": "warn",
4858
5498
  "nextfriday/enforce-readonly-component-props": "warn",
5499
+ "nextfriday/enforce-render-naming": "warn",
4859
5500
  "nextfriday/jsx-newline-between-elements": "warn",
5501
+ "nextfriday/jsx-no-data-array": "warn",
5502
+ "nextfriday/jsx-no-data-object": "warn",
4860
5503
  "nextfriday/jsx-no-inline-object-prop": "warn",
4861
5504
  "nextfriday/jsx-no-newline-single-line-elements": "warn",
4862
5505
  "nextfriday/jsx-no-non-component-function": "warn",
5506
+ "nextfriday/jsx-no-sub-interface": "warn",
4863
5507
  "nextfriday/jsx-no-ternary-null": "warn",
4864
5508
  "nextfriday/jsx-no-variable-in-callback": "warn",
4865
5509
  "nextfriday/jsx-require-suspense": "warn",
@@ -4877,10 +5521,14 @@ var jsxRules = {
4877
5521
  var jsxRecommendedRules = {
4878
5522
  "nextfriday/enforce-props-suffix": "error",
4879
5523
  "nextfriday/enforce-readonly-component-props": "error",
5524
+ "nextfriday/enforce-render-naming": "error",
4880
5525
  "nextfriday/jsx-newline-between-elements": "error",
5526
+ "nextfriday/jsx-no-data-array": "error",
5527
+ "nextfriday/jsx-no-data-object": "error",
4881
5528
  "nextfriday/jsx-no-inline-object-prop": "error",
4882
5529
  "nextfriday/jsx-no-newline-single-line-elements": "error",
4883
5530
  "nextfriday/jsx-no-non-component-function": "error",
5531
+ "nextfriday/jsx-no-sub-interface": "error",
4884
5532
  "nextfriday/jsx-no-ternary-null": "error",
4885
5533
  "nextfriday/jsx-no-variable-in-callback": "error",
4886
5534
  "nextfriday/jsx-require-suspense": "error",