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.cjs CHANGED
@@ -40,7 +40,7 @@ module.exports = __toCommonJS(index_exports);
40
40
  // package.json
41
41
  var package_default = {
42
42
  name: "eslint-plugin-nextfriday",
43
- version: "4.1.0",
43
+ version: "4.3.0",
44
44
  description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
45
45
  keywords: [
46
46
  "eslint",
@@ -525,13 +525,64 @@ var enforceConstantCase = createRule3({
525
525
  });
526
526
  var enforce_constant_case_default = enforceConstantCase;
527
527
 
528
- // src/rules/enforce-hook-naming.ts
528
+ // src/rules/enforce-hook-filename.ts
529
529
  var import_path = __toESM(require("path"), 1);
530
530
  var import_utils6 = require("@typescript-eslint/utils");
531
531
  var createRule4 = import_utils6.ESLintUtils.RuleCreator(
532
532
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
533
533
  );
534
- var enforceHookNaming = createRule4({
534
+ var enforceHookFilename = createRule4({
535
+ name: "enforce-hook-filename",
536
+ meta: {
537
+ type: "suggestion",
538
+ docs: {
539
+ description: "Enforce that files exporting custom hooks are named *.hook.ts or *.hooks.ts"
540
+ },
541
+ messages: {
542
+ requireHookFilename: "'{{ name }}' is a custom hook and must be exported from a *.hook.ts or *.hooks.ts file."
543
+ },
544
+ schema: []
545
+ },
546
+ defaultOptions: [],
547
+ create(context) {
548
+ const basename2 = import_path.default.basename(context.filename);
549
+ const isHookFile = basename2.endsWith(".hook.ts") || basename2.endsWith(".hooks.ts");
550
+ if (isHookFile) return {};
551
+ function reportIfHook(name, node) {
552
+ if (name.startsWith("use") && name.length > 3 && /^use[A-Z]/.test(name)) {
553
+ context.report({ node, messageId: "requireHookFilename", data: { name } });
554
+ }
555
+ }
556
+ return {
557
+ ExportNamedDeclaration(node) {
558
+ if (node.declaration?.type === import_utils6.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id) {
559
+ reportIfHook(node.declaration.id.name, node.declaration.id);
560
+ }
561
+ if (node.declaration?.type === import_utils6.AST_NODE_TYPES.VariableDeclaration) {
562
+ for (const declarator of node.declaration.declarations) {
563
+ if (declarator.id.type === import_utils6.AST_NODE_TYPES.Identifier && declarator.init !== null && (declarator.init.type === import_utils6.AST_NODE_TYPES.ArrowFunctionExpression || declarator.init.type === import_utils6.AST_NODE_TYPES.FunctionExpression)) {
564
+ reportIfHook(declarator.id.name, declarator.id);
565
+ }
566
+ }
567
+ }
568
+ },
569
+ ExportDefaultDeclaration(node) {
570
+ if (node.declaration.type === import_utils6.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id !== null) {
571
+ reportIfHook(node.declaration.id.name, node.declaration.id);
572
+ }
573
+ }
574
+ };
575
+ }
576
+ });
577
+ var enforce_hook_filename_default = enforceHookFilename;
578
+
579
+ // src/rules/enforce-hook-naming.ts
580
+ var import_path2 = __toESM(require("path"), 1);
581
+ var import_utils7 = require("@typescript-eslint/utils");
582
+ var createRule5 = import_utils7.ESLintUtils.RuleCreator(
583
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
584
+ );
585
+ var enforceHookNaming = createRule5({
535
586
  name: "enforce-hook-naming",
536
587
  meta: {
537
588
  type: "suggestion",
@@ -547,7 +598,7 @@ var enforceHookNaming = createRule4({
547
598
  defaultOptions: [],
548
599
  create(context) {
549
600
  const { filename } = context;
550
- const basename2 = import_path.default.basename(filename);
601
+ const basename2 = import_path2.default.basename(filename);
551
602
  const isHookFile = basename2.endsWith(".hook.ts") || basename2.endsWith(".hooks.ts");
552
603
  if (!isHookFile) {
553
604
  return {};
@@ -570,22 +621,22 @@ var enforceHookNaming = createRule4({
570
621
  };
571
622
  return {
572
623
  ExportNamedDeclaration(node) {
573
- if (node.declaration?.type === import_utils6.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id) {
624
+ if (node.declaration?.type === import_utils7.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id) {
574
625
  checkFunctionName(node.declaration.id.name, node.declaration.id, "missingUsePrefix");
575
626
  }
576
- if (node.declaration?.type === import_utils6.AST_NODE_TYPES.VariableDeclaration) {
627
+ if (node.declaration?.type === import_utils7.AST_NODE_TYPES.VariableDeclaration) {
577
628
  node.declaration.declarations.forEach((declarator) => {
578
- if (declarator.id.type === import_utils6.AST_NODE_TYPES.Identifier) {
629
+ if (declarator.id.type === import_utils7.AST_NODE_TYPES.Identifier) {
579
630
  checkFunctionName(declarator.id.name, declarator.id, "missingUsePrefix");
580
631
  }
581
632
  });
582
633
  }
583
634
  },
584
635
  ExportDefaultDeclaration(node) {
585
- if (node.declaration.type === import_utils6.AST_NODE_TYPES.Identifier) {
636
+ if (node.declaration.type === import_utils7.AST_NODE_TYPES.Identifier) {
586
637
  checkFunctionName(node.declaration.name, node.declaration, "defaultExportMissingUsePrefix");
587
638
  }
588
- if (node.declaration.type === import_utils6.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id) {
639
+ if (node.declaration.type === import_utils7.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id) {
589
640
  checkFunctionName(node.declaration.id.name, node.declaration.id, "defaultExportMissingUsePrefix");
590
641
  }
591
642
  }
@@ -595,26 +646,26 @@ var enforceHookNaming = createRule4({
595
646
  var enforce_hook_naming_default = enforceHookNaming;
596
647
 
597
648
  // src/rules/enforce-property-case.ts
598
- var import_utils7 = require("@typescript-eslint/utils");
599
- var createRule5 = import_utils7.ESLintUtils.RuleCreator(
649
+ var import_utils8 = require("@typescript-eslint/utils");
650
+ var createRule6 = import_utils8.ESLintUtils.RuleCreator(
600
651
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
601
652
  );
602
653
  var SNAKE_CASE_REGEX3 = /^[a-z]+_[a-z0-9_]*$/;
603
654
  var SCREAMING_SNAKE_CASE_REGEX2 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
604
655
  var isInsideAsConst = (node) => {
605
656
  const { parent } = node;
606
- if (parent.type === import_utils7.AST_NODE_TYPES.TSAsExpression && parent.typeAnnotation.type === import_utils7.AST_NODE_TYPES.TSTypeReference && parent.typeAnnotation.typeName.type === import_utils7.AST_NODE_TYPES.Identifier && parent.typeAnnotation.typeName.name === "const") {
657
+ if (parent.type === import_utils8.AST_NODE_TYPES.TSAsExpression && parent.typeAnnotation.type === import_utils8.AST_NODE_TYPES.TSTypeReference && parent.typeAnnotation.typeName.type === import_utils8.AST_NODE_TYPES.Identifier && parent.typeAnnotation.typeName.name === "const") {
607
658
  return true;
608
659
  }
609
- if (parent.type === import_utils7.AST_NODE_TYPES.ArrayExpression) {
660
+ if (parent.type === import_utils8.AST_NODE_TYPES.ArrayExpression) {
610
661
  const grandparent = parent.parent;
611
- if (grandparent?.type === import_utils7.AST_NODE_TYPES.TSAsExpression && grandparent.typeAnnotation.type === import_utils7.AST_NODE_TYPES.TSTypeReference && grandparent.typeAnnotation.typeName.type === import_utils7.AST_NODE_TYPES.Identifier && grandparent.typeAnnotation.typeName.name === "const") {
662
+ if (grandparent?.type === import_utils8.AST_NODE_TYPES.TSAsExpression && grandparent.typeAnnotation.type === import_utils8.AST_NODE_TYPES.TSTypeReference && grandparent.typeAnnotation.typeName.type === import_utils8.AST_NODE_TYPES.Identifier && grandparent.typeAnnotation.typeName.name === "const") {
612
663
  return true;
613
664
  }
614
665
  }
615
666
  return false;
616
667
  };
617
- var enforcePropertyCase = createRule5({
668
+ var enforcePropertyCase = createRule6({
618
669
  name: "enforce-property-case",
619
670
  meta: {
620
671
  type: "suggestion",
@@ -630,7 +681,7 @@ var enforcePropertyCase = createRule5({
630
681
  create(context) {
631
682
  return {
632
683
  Property(node) {
633
- if (node.parent.type !== import_utils7.AST_NODE_TYPES.ObjectExpression) {
684
+ if (node.parent.type !== import_utils8.AST_NODE_TYPES.ObjectExpression) {
634
685
  return;
635
686
  }
636
687
  if (isInsideAsConst(node.parent)) {
@@ -639,7 +690,7 @@ var enforcePropertyCase = createRule5({
639
690
  if (node.computed) {
640
691
  return;
641
692
  }
642
- if (node.key.type !== import_utils7.AST_NODE_TYPES.Identifier) {
693
+ if (node.key.type !== import_utils8.AST_NODE_TYPES.Identifier) {
643
694
  return;
644
695
  }
645
696
  const { name } = node.key;
@@ -657,12 +708,12 @@ var enforcePropertyCase = createRule5({
657
708
  var enforce_property_case_default = enforcePropertyCase;
658
709
 
659
710
  // src/rules/enforce-props-suffix.ts
660
- var import_path2 = __toESM(require("path"), 1);
661
- var import_utils8 = require("@typescript-eslint/utils");
662
- var createRule6 = import_utils8.ESLintUtils.RuleCreator(
711
+ var import_path3 = __toESM(require("path"), 1);
712
+ var import_utils9 = require("@typescript-eslint/utils");
713
+ var createRule7 = import_utils9.ESLintUtils.RuleCreator(
663
714
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
664
715
  );
665
- var enforcePropsSuffix = createRule6({
716
+ var enforcePropsSuffix = createRule7({
666
717
  name: "enforce-props-suffix",
667
718
  meta: {
668
719
  type: "suggestion",
@@ -677,7 +728,7 @@ var enforcePropsSuffix = createRule6({
677
728
  defaultOptions: [],
678
729
  create(context) {
679
730
  const { filename } = context;
680
- const ext = import_path2.default.extname(filename);
731
+ const ext = import_path3.default.extname(filename);
681
732
  const isComponentFile = ext === ".tsx" || ext === ".jsx";
682
733
  if (!isComponentFile) {
683
734
  return {};
@@ -696,13 +747,13 @@ var enforcePropsSuffix = createRule6({
696
747
  };
697
748
  return {
698
749
  TSInterfaceDeclaration(node) {
699
- if (node.id.type === import_utils8.AST_NODE_TYPES.Identifier) {
750
+ if (node.id.type === import_utils9.AST_NODE_TYPES.Identifier) {
700
751
  checkTypeName(node.id.name, node.id);
701
752
  }
702
753
  },
703
754
  TSTypeAliasDeclaration(node) {
704
- if (node.id.type === import_utils8.AST_NODE_TYPES.Identifier) {
705
- if (node.typeAnnotation.type === import_utils8.AST_NODE_TYPES.TSTypeLiteral) {
755
+ if (node.id.type === import_utils9.AST_NODE_TYPES.Identifier) {
756
+ if (node.typeAnnotation.type === import_utils9.AST_NODE_TYPES.TSTypeLiteral) {
706
757
  checkTypeName(node.id.name, node.id);
707
758
  }
708
759
  }
@@ -713,11 +764,11 @@ var enforcePropsSuffix = createRule6({
713
764
  var enforce_props_suffix_default = enforcePropsSuffix;
714
765
 
715
766
  // src/rules/enforce-readonly-component-props.ts
716
- var import_utils9 = require("@typescript-eslint/utils");
717
- var createRule7 = import_utils9.ESLintUtils.RuleCreator(
767
+ var import_utils10 = require("@typescript-eslint/utils");
768
+ var createRule8 = import_utils10.ESLintUtils.RuleCreator(
718
769
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
719
770
  );
720
- var enforceReadonlyComponentProps = createRule7({
771
+ var enforceReadonlyComponentProps = createRule8({
721
772
  name: "enforce-readonly-component-props",
722
773
  meta: {
723
774
  type: "suggestion",
@@ -733,40 +784,40 @@ var enforceReadonlyComponentProps = createRule7({
733
784
  defaultOptions: [],
734
785
  create(context) {
735
786
  function hasJSXInConditional(node) {
736
- return node.consequent.type === import_utils9.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils9.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils9.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils9.AST_NODE_TYPES.JSXFragment;
787
+ return node.consequent.type === import_utils10.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils10.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils10.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils10.AST_NODE_TYPES.JSXFragment;
737
788
  }
738
789
  function hasJSXInLogical(node) {
739
- return node.right.type === import_utils9.AST_NODE_TYPES.JSXElement || node.right.type === import_utils9.AST_NODE_TYPES.JSXFragment;
790
+ return node.right.type === import_utils10.AST_NODE_TYPES.JSXElement || node.right.type === import_utils10.AST_NODE_TYPES.JSXFragment;
740
791
  }
741
792
  function hasJSXReturn(block) {
742
793
  return block.body.some((stmt) => {
743
- if (stmt.type === import_utils9.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
744
- return stmt.argument.type === import_utils9.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils9.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils9.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils9.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
794
+ if (stmt.type === import_utils10.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
795
+ return stmt.argument.type === import_utils10.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils10.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils10.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils10.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
745
796
  }
746
797
  return false;
747
798
  });
748
799
  }
749
800
  function isReactComponent2(node) {
750
- if (node.type === import_utils9.AST_NODE_TYPES.ArrowFunctionExpression) {
751
- if (node.body.type === import_utils9.AST_NODE_TYPES.JSXElement || node.body.type === import_utils9.AST_NODE_TYPES.JSXFragment) {
801
+ if (node.type === import_utils10.AST_NODE_TYPES.ArrowFunctionExpression) {
802
+ if (node.body.type === import_utils10.AST_NODE_TYPES.JSXElement || node.body.type === import_utils10.AST_NODE_TYPES.JSXFragment) {
752
803
  return true;
753
804
  }
754
- if (node.body.type === import_utils9.AST_NODE_TYPES.BlockStatement) {
805
+ if (node.body.type === import_utils10.AST_NODE_TYPES.BlockStatement) {
755
806
  return hasJSXReturn(node.body);
756
807
  }
757
- } else if (node.type === import_utils9.AST_NODE_TYPES.FunctionExpression || node.type === import_utils9.AST_NODE_TYPES.FunctionDeclaration) {
758
- if (node.body && node.body.type === import_utils9.AST_NODE_TYPES.BlockStatement) {
808
+ } else if (node.type === import_utils10.AST_NODE_TYPES.FunctionExpression || node.type === import_utils10.AST_NODE_TYPES.FunctionDeclaration) {
809
+ if (node.body && node.body.type === import_utils10.AST_NODE_TYPES.BlockStatement) {
759
810
  return hasJSXReturn(node.body);
760
811
  }
761
812
  }
762
813
  return false;
763
814
  }
764
815
  function isNamedType(node) {
765
- return node.type === import_utils9.AST_NODE_TYPES.TSTypeReference;
816
+ return node.type === import_utils10.AST_NODE_TYPES.TSTypeReference;
766
817
  }
767
818
  function isAlreadyReadonly(node) {
768
- if (node.type === import_utils9.AST_NODE_TYPES.TSTypeReference && node.typeName) {
769
- if (node.typeName.type === import_utils9.AST_NODE_TYPES.Identifier && node.typeName.name === "Readonly") {
819
+ if (node.type === import_utils10.AST_NODE_TYPES.TSTypeReference && node.typeName) {
820
+ if (node.typeName.type === import_utils10.AST_NODE_TYPES.Identifier && node.typeName.name === "Readonly") {
770
821
  return true;
771
822
  }
772
823
  }
@@ -780,7 +831,7 @@ var enforceReadonlyComponentProps = createRule7({
780
831
  return;
781
832
  }
782
833
  const param = node.params[0];
783
- if (param.type === import_utils9.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
834
+ if (param.type === import_utils10.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
784
835
  const { typeAnnotation } = param.typeAnnotation;
785
836
  if (isNamedType(typeAnnotation) && !isAlreadyReadonly(typeAnnotation)) {
786
837
  const { sourceCode } = context;
@@ -804,9 +855,159 @@ var enforceReadonlyComponentProps = createRule7({
804
855
  });
805
856
  var enforce_readonly_component_props_default = enforceReadonlyComponentProps;
806
857
 
858
+ // src/rules/enforce-render-naming.ts
859
+ var import_utils11 = require("@typescript-eslint/utils");
860
+ var createRule9 = import_utils11.ESLintUtils.RuleCreator(
861
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
862
+ );
863
+ var ARRAY_RETURNING_METHODS = /* @__PURE__ */ new Set(["map", "flatMap", "filter"]);
864
+ function hasRenderPrefix(name) {
865
+ if (!name.startsWith("render")) {
866
+ return false;
867
+ }
868
+ if (name.length === "render".length) {
869
+ return true;
870
+ }
871
+ const nextChar = name["render".length];
872
+ return nextChar === nextChar.toUpperCase() && nextChar !== nextChar.toLowerCase();
873
+ }
874
+ function functionBodyReturnsJsx(body) {
875
+ if (body.type === import_utils11.AST_NODE_TYPES.JSXElement || body.type === import_utils11.AST_NODE_TYPES.JSXFragment) {
876
+ return true;
877
+ }
878
+ if (body.type === import_utils11.AST_NODE_TYPES.ConditionalExpression) {
879
+ return isJsxProducingExpression(body.consequent) || isJsxProducingExpression(body.alternate);
880
+ }
881
+ if (body.type === import_utils11.AST_NODE_TYPES.LogicalExpression) {
882
+ return isJsxProducingExpression(body.right);
883
+ }
884
+ if (body.type !== import_utils11.AST_NODE_TYPES.BlockStatement) {
885
+ return false;
886
+ }
887
+ for (const statement of body.body) {
888
+ if (statement.type === import_utils11.AST_NODE_TYPES.ReturnStatement && statement.argument) {
889
+ if (isJsxProducingExpression(statement.argument)) {
890
+ return true;
891
+ }
892
+ }
893
+ }
894
+ return false;
895
+ }
896
+ function isJsxProducingExpression(node) {
897
+ if (node.type === import_utils11.AST_NODE_TYPES.JSXElement || node.type === import_utils11.AST_NODE_TYPES.JSXFragment) {
898
+ return true;
899
+ }
900
+ if (node.type === import_utils11.AST_NODE_TYPES.ConditionalExpression) {
901
+ return isJsxProducingExpression(node.consequent) || isJsxProducingExpression(node.alternate);
902
+ }
903
+ if (node.type === import_utils11.AST_NODE_TYPES.LogicalExpression) {
904
+ return isJsxProducingExpression(node.right);
905
+ }
906
+ if (node.type === import_utils11.AST_NODE_TYPES.ArrayExpression) {
907
+ return node.elements.some((element) => {
908
+ if (!element || element.type === import_utils11.AST_NODE_TYPES.SpreadElement) {
909
+ return false;
910
+ }
911
+ return isJsxProducingExpression(element);
912
+ });
913
+ }
914
+ if (node.type === import_utils11.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils11.AST_NODE_TYPES.FunctionExpression) {
915
+ return functionBodyReturnsJsx(node.body);
916
+ }
917
+ if (node.type === import_utils11.AST_NODE_TYPES.CallExpression) {
918
+ if (node.callee.type === import_utils11.AST_NODE_TYPES.MemberExpression && node.callee.property.type === import_utils11.AST_NODE_TYPES.Identifier && ARRAY_RETURNING_METHODS.has(node.callee.property.name)) {
919
+ const callback = node.arguments[0];
920
+ if (callback && (callback.type === import_utils11.AST_NODE_TYPES.ArrowFunctionExpression || callback.type === import_utils11.AST_NODE_TYPES.FunctionExpression)) {
921
+ return functionBodyReturnsJsx(callback.body);
922
+ }
923
+ }
924
+ }
925
+ if (node.type === import_utils11.AST_NODE_TYPES.TSAsExpression || node.type === import_utils11.AST_NODE_TYPES.TSSatisfiesExpression) {
926
+ return isJsxProducingExpression(node.expression);
927
+ }
928
+ return false;
929
+ }
930
+ function isPascalCase(name) {
931
+ return /^[A-Z]/.test(name);
932
+ }
933
+ function isComponentFunction2(node) {
934
+ if (node.type === import_utils11.AST_NODE_TYPES.FunctionDeclaration && node.id && isPascalCase(node.id.name)) {
935
+ return true;
936
+ }
937
+ const parent = node.parent;
938
+ if (parent?.type === import_utils11.AST_NODE_TYPES.VariableDeclarator && parent.id.type === import_utils11.AST_NODE_TYPES.Identifier && isPascalCase(parent.id.name)) {
939
+ return true;
940
+ }
941
+ return false;
942
+ }
943
+ var enforceRenderNaming = createRule9({
944
+ name: "enforce-render-naming",
945
+ meta: {
946
+ type: "problem",
947
+ docs: {
948
+ description: "Enforce 'render' prefix for variables that hold or return JSX inside React components"
949
+ },
950
+ schema: [],
951
+ messages: {
952
+ missingRenderPrefix: "Variable '{{ name }}' holds JSX-producing content inside a component. Rename it to 'render{{ pascalName }}' so the intent is explicit."
953
+ }
954
+ },
955
+ defaultOptions: [],
956
+ create(context) {
957
+ const { filename } = context;
958
+ const extension = getFileExtension(filename);
959
+ if (extension !== "tsx" && extension !== "jsx") {
960
+ return {};
961
+ }
962
+ const componentStack = [];
963
+ function isInsideComponent() {
964
+ return componentStack.some((value) => value);
965
+ }
966
+ function pushFunction(node) {
967
+ componentStack.push(isComponentFunction2(node));
968
+ }
969
+ function popFunction() {
970
+ componentStack.pop();
971
+ }
972
+ return {
973
+ ArrowFunctionExpression: pushFunction,
974
+ FunctionDeclaration: pushFunction,
975
+ FunctionExpression: pushFunction,
976
+ "ArrowFunctionExpression:exit": popFunction,
977
+ "FunctionDeclaration:exit": popFunction,
978
+ "FunctionExpression:exit": popFunction,
979
+ VariableDeclarator(node) {
980
+ if (!isInsideComponent()) {
981
+ return;
982
+ }
983
+ if (node.id.type !== import_utils11.AST_NODE_TYPES.Identifier) {
984
+ return;
985
+ }
986
+ if (!node.init) {
987
+ return;
988
+ }
989
+ if (!isJsxProducingExpression(node.init)) {
990
+ return;
991
+ }
992
+ const name = node.id.name;
993
+ if (hasRenderPrefix(name)) {
994
+ return;
995
+ }
996
+ const pascalName = name.charAt(0).toUpperCase() + name.slice(1);
997
+ context.report({
998
+ node: node.id,
999
+ messageId: "missingRenderPrefix",
1000
+ data: { name, pascalName }
1001
+ });
1002
+ }
1003
+ };
1004
+ }
1005
+ });
1006
+ var enforce_render_naming_default = enforceRenderNaming;
1007
+
807
1008
  // src/rules/enforce-service-naming.ts
808
- var import_utils10 = require("@typescript-eslint/utils");
809
- var createRule8 = import_utils10.ESLintUtils.RuleCreator(
1009
+ var import_utils13 = require("@typescript-eslint/utils");
1010
+ var createRule10 = import_utils13.ESLintUtils.RuleCreator(
810
1011
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
811
1012
  );
812
1013
  var BANNED_PREFIXES = {
@@ -815,7 +1016,7 @@ var BANNED_PREFIXES = {
815
1016
  handle: ["create", "verify"],
816
1017
  set: ["update", "save", "patch"]
817
1018
  };
818
- var enforceServiceNaming = createRule8({
1019
+ var enforceServiceNaming = createRule10({
819
1020
  name: "enforce-service-naming",
820
1021
  meta: {
821
1022
  type: "suggestion",
@@ -858,12 +1059,12 @@ var enforceServiceNaming = createRule8({
858
1059
  };
859
1060
  return {
860
1061
  ExportNamedDeclaration(node) {
861
- if (node.declaration?.type === import_utils10.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id) {
1062
+ if (node.declaration?.type === import_utils13.AST_NODE_TYPES.FunctionDeclaration && node.declaration.id) {
862
1063
  checkExportedFunction(node.declaration, node.declaration.id);
863
1064
  }
864
- if (node.declaration?.type === import_utils10.AST_NODE_TYPES.VariableDeclaration) {
1065
+ if (node.declaration?.type === import_utils13.AST_NODE_TYPES.VariableDeclaration) {
865
1066
  node.declaration.declarations.forEach((declarator) => {
866
- if (declarator.id.type === import_utils10.AST_NODE_TYPES.Identifier && declarator.init?.type === import_utils10.AST_NODE_TYPES.ArrowFunctionExpression) {
1067
+ if (declarator.id.type === import_utils13.AST_NODE_TYPES.Identifier && declarator.init?.type === import_utils13.AST_NODE_TYPES.ArrowFunctionExpression) {
867
1068
  checkExportedFunction(declarator.init, declarator.id);
868
1069
  }
869
1070
  });
@@ -874,12 +1075,52 @@ var enforceServiceNaming = createRule8({
874
1075
  });
875
1076
  var enforce_service_naming_default = enforceServiceNaming;
876
1077
 
1078
+ // src/rules/enforce-test-filename.ts
1079
+ var import_path4 = __toESM(require("path"), 1);
1080
+ var import_utils14 = require("@typescript-eslint/utils");
1081
+ var createRule11 = import_utils14.ESLintUtils.RuleCreator(
1082
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1083
+ );
1084
+ var TEST_GLOBALS = /* @__PURE__ */ new Set(["describe", "it", "test", "beforeEach", "beforeAll", "afterEach", "afterAll"]);
1085
+ var enforceTestFilename = createRule11({
1086
+ name: "enforce-test-filename",
1087
+ meta: {
1088
+ type: "suggestion",
1089
+ docs: {
1090
+ description: "Enforce that files containing test code are named *.test.ts or *.test.tsx"
1091
+ },
1092
+ messages: {
1093
+ requireTestFilename: "Files containing test code must be named *.test.ts or *.test.tsx."
1094
+ },
1095
+ schema: []
1096
+ },
1097
+ defaultOptions: [],
1098
+ create(context) {
1099
+ const basename2 = import_path4.default.basename(context.filename);
1100
+ const isTestFile = basename2.endsWith(".test.ts") || basename2.endsWith(".test.tsx");
1101
+ if (isTestFile) return {};
1102
+ function isTestGlobalCall(node) {
1103
+ return node.callee.type === import_utils14.AST_NODE_TYPES.Identifier && TEST_GLOBALS.has(node.callee.name);
1104
+ }
1105
+ let reported = false;
1106
+ return {
1107
+ CallExpression(node) {
1108
+ if (reported) return;
1109
+ if (!isTestGlobalCall(node)) return;
1110
+ reported = true;
1111
+ context.report({ node, messageId: "requireTestFilename" });
1112
+ }
1113
+ };
1114
+ }
1115
+ });
1116
+ var enforce_test_filename_default = enforceTestFilename;
1117
+
877
1118
  // src/rules/enforce-sorted-destructuring.ts
878
- var import_utils11 = require("@typescript-eslint/utils");
879
- var createRule9 = import_utils11.ESLintUtils.RuleCreator(
1119
+ var import_utils15 = require("@typescript-eslint/utils");
1120
+ var createRule12 = import_utils15.ESLintUtils.RuleCreator(
880
1121
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
881
1122
  );
882
- var enforceSortedDestructuring = createRule9({
1123
+ var enforceSortedDestructuring = createRule12({
883
1124
  name: "enforce-sorted-destructuring",
884
1125
  meta: {
885
1126
  type: "suggestion",
@@ -895,19 +1136,19 @@ var enforceSortedDestructuring = createRule9({
895
1136
  defaultOptions: [],
896
1137
  create(context) {
897
1138
  function getPropertyName(property) {
898
- if (property.type === import_utils11.AST_NODE_TYPES.RestElement) {
1139
+ if (property.type === import_utils15.AST_NODE_TYPES.RestElement) {
899
1140
  return null;
900
1141
  }
901
- if (property.key.type === import_utils11.AST_NODE_TYPES.Identifier) {
1142
+ if (property.key.type === import_utils15.AST_NODE_TYPES.Identifier) {
902
1143
  return property.key.name;
903
1144
  }
904
1145
  return null;
905
1146
  }
906
1147
  function hasDefaultValue(property) {
907
- return property.value.type === import_utils11.AST_NODE_TYPES.AssignmentPattern && Boolean(property.value.right);
1148
+ return property.value.type === import_utils15.AST_NODE_TYPES.AssignmentPattern && Boolean(property.value.right);
908
1149
  }
909
1150
  function checkVariableDeclarator(node) {
910
- if (node.id.type !== import_utils11.AST_NODE_TYPES.ObjectPattern) {
1151
+ if (node.id.type !== import_utils15.AST_NODE_TYPES.ObjectPattern) {
911
1152
  return;
912
1153
  }
913
1154
  const { properties } = node.id;
@@ -915,7 +1156,7 @@ var enforceSortedDestructuring = createRule9({
915
1156
  return;
916
1157
  }
917
1158
  const propertyInfo = properties.map((prop) => {
918
- if (prop.type === import_utils11.AST_NODE_TYPES.RestElement) {
1159
+ if (prop.type === import_utils15.AST_NODE_TYPES.RestElement) {
919
1160
  return null;
920
1161
  }
921
1162
  return {
@@ -954,20 +1195,20 @@ var enforceSortedDestructuring = createRule9({
954
1195
  var enforce_sorted_destructuring_default = enforceSortedDestructuring;
955
1196
 
956
1197
  // src/rules/enforce-type-declaration-order.ts
957
- var import_utils12 = require("@typescript-eslint/utils");
958
- var createRule10 = import_utils12.ESLintUtils.RuleCreator(
1198
+ var import_utils16 = require("@typescript-eslint/utils");
1199
+ var createRule13 = import_utils16.ESLintUtils.RuleCreator(
959
1200
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
960
1201
  );
961
1202
  function getTypeDeclarationName(node) {
962
- if (node.type === import_utils12.AST_NODE_TYPES.TSInterfaceDeclaration && node.id.type === import_utils12.AST_NODE_TYPES.Identifier) {
1203
+ if (node.type === import_utils16.AST_NODE_TYPES.TSInterfaceDeclaration && node.id.type === import_utils16.AST_NODE_TYPES.Identifier) {
963
1204
  return { name: node.id.name, position: node.range[0] };
964
1205
  }
965
- if (node.type === import_utils12.AST_NODE_TYPES.TSTypeAliasDeclaration && node.id.type === import_utils12.AST_NODE_TYPES.Identifier) {
1206
+ if (node.type === import_utils16.AST_NODE_TYPES.TSTypeAliasDeclaration && node.id.type === import_utils16.AST_NODE_TYPES.Identifier) {
966
1207
  return { name: node.id.name, position: node.range[0] };
967
1208
  }
968
1209
  return null;
969
1210
  }
970
- var enforceTypeDeclarationOrder = createRule10({
1211
+ var enforceTypeDeclarationOrder = createRule13({
971
1212
  name: "enforce-type-declaration-order",
972
1213
  meta: {
973
1214
  type: "suggestion",
@@ -998,7 +1239,7 @@ var enforceTypeDeclarationOrder = createRule10({
998
1239
  }
999
1240
  },
1000
1241
  "TSPropertySignature TSTypeReference": function checkTypeReference(node) {
1001
- if (node.typeName.type !== import_utils12.AST_NODE_TYPES.Identifier) {
1242
+ if (node.typeName.type !== import_utils16.AST_NODE_TYPES.Identifier) {
1002
1243
  return;
1003
1244
  }
1004
1245
  const referencedName = node.typeName.name;
@@ -1035,8 +1276,8 @@ var enforceTypeDeclarationOrder = createRule10({
1035
1276
  var enforce_type_declaration_order_default = enforceTypeDeclarationOrder;
1036
1277
 
1037
1278
  // src/rules/index-export-only.ts
1038
- var import_utils13 = require("@typescript-eslint/utils");
1039
- var createRule11 = import_utils13.ESLintUtils.RuleCreator(
1279
+ var import_utils17 = require("@typescript-eslint/utils");
1280
+ var createRule14 = import_utils17.ESLintUtils.RuleCreator(
1040
1281
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1041
1282
  );
1042
1283
  var isIndexFile = (filename) => getBaseName(filename) === "index";
@@ -1044,26 +1285,26 @@ var isAllowedExportNamed = (node) => {
1044
1285
  if (!node.declaration) {
1045
1286
  return true;
1046
1287
  }
1047
- return node.declaration.type === import_utils13.AST_NODE_TYPES.TSTypeAliasDeclaration || node.declaration.type === import_utils13.AST_NODE_TYPES.TSInterfaceDeclaration;
1288
+ return node.declaration.type === import_utils17.AST_NODE_TYPES.TSTypeAliasDeclaration || node.declaration.type === import_utils17.AST_NODE_TYPES.TSInterfaceDeclaration;
1048
1289
  };
1049
- var isAllowedExportDefault = (node) => node.declaration.type === import_utils13.AST_NODE_TYPES.Identifier;
1290
+ var isAllowedExportDefault = (node) => node.declaration.type === import_utils17.AST_NODE_TYPES.Identifier;
1050
1291
  var isAllowedTopLevel = (node) => {
1051
1292
  switch (node.type) {
1052
- case import_utils13.AST_NODE_TYPES.ImportDeclaration:
1053
- case import_utils13.AST_NODE_TYPES.ExportAllDeclaration:
1054
- case import_utils13.AST_NODE_TYPES.TSTypeAliasDeclaration:
1055
- case import_utils13.AST_NODE_TYPES.TSInterfaceDeclaration:
1056
- case import_utils13.AST_NODE_TYPES.TSImportEqualsDeclaration:
1293
+ case import_utils17.AST_NODE_TYPES.ImportDeclaration:
1294
+ case import_utils17.AST_NODE_TYPES.ExportAllDeclaration:
1295
+ case import_utils17.AST_NODE_TYPES.TSTypeAliasDeclaration:
1296
+ case import_utils17.AST_NODE_TYPES.TSInterfaceDeclaration:
1297
+ case import_utils17.AST_NODE_TYPES.TSImportEqualsDeclaration:
1057
1298
  return true;
1058
- case import_utils13.AST_NODE_TYPES.ExportNamedDeclaration:
1299
+ case import_utils17.AST_NODE_TYPES.ExportNamedDeclaration:
1059
1300
  return isAllowedExportNamed(node);
1060
- case import_utils13.AST_NODE_TYPES.ExportDefaultDeclaration:
1301
+ case import_utils17.AST_NODE_TYPES.ExportDefaultDeclaration:
1061
1302
  return isAllowedExportDefault(node);
1062
1303
  default:
1063
1304
  return false;
1064
1305
  }
1065
1306
  };
1066
- var indexExportOnly = createRule11({
1307
+ var indexExportOnly = createRule14({
1067
1308
  name: "index-export-only",
1068
1309
  meta: {
1069
1310
  type: "suggestion",
@@ -1097,11 +1338,11 @@ var indexExportOnly = createRule11({
1097
1338
  var index_export_only_default = indexExportOnly;
1098
1339
 
1099
1340
  // src/rules/jsx-newline-between-elements.ts
1100
- var import_utils15 = require("@typescript-eslint/utils");
1101
- var createRule12 = import_utils15.ESLintUtils.RuleCreator(
1341
+ var import_utils19 = require("@typescript-eslint/utils");
1342
+ var createRule15 = import_utils19.ESLintUtils.RuleCreator(
1102
1343
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1103
1344
  );
1104
- var jsxNewlineBetweenElements = createRule12({
1345
+ var jsxNewlineBetweenElements = createRule15({
1105
1346
  name: "jsx-newline-between-elements",
1106
1347
  meta: {
1107
1348
  type: "layout",
@@ -1119,7 +1360,7 @@ var jsxNewlineBetweenElements = createRule12({
1119
1360
  create(context) {
1120
1361
  const { sourceCode } = context;
1121
1362
  function isSignificantJSXChild(node) {
1122
- return node.type === import_utils15.AST_NODE_TYPES.JSXElement || node.type === import_utils15.AST_NODE_TYPES.JSXFragment || node.type === import_utils15.AST_NODE_TYPES.JSXExpressionContainer;
1363
+ return node.type === import_utils19.AST_NODE_TYPES.JSXElement || node.type === import_utils19.AST_NODE_TYPES.JSXFragment || node.type === import_utils19.AST_NODE_TYPES.JSXExpressionContainer;
1123
1364
  }
1124
1365
  function isMultiLine(node) {
1125
1366
  return node.loc.start.line !== node.loc.end.line;
@@ -1168,12 +1409,194 @@ var jsxNewlineBetweenElements = createRule12({
1168
1409
  });
1169
1410
  var jsx_newline_between_elements_default = jsxNewlineBetweenElements;
1170
1411
 
1412
+ // src/rules/jsx-no-data-array.ts
1413
+ var import_utils20 = require("@typescript-eslint/utils");
1414
+ var createRule16 = import_utils20.ESLintUtils.RuleCreator(
1415
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1416
+ );
1417
+ function isObjectLikeElement(node) {
1418
+ if (!node) {
1419
+ return false;
1420
+ }
1421
+ if (node.type === import_utils20.AST_NODE_TYPES.ObjectExpression) {
1422
+ return true;
1423
+ }
1424
+ if (node.type === import_utils20.AST_NODE_TYPES.TSAsExpression || node.type === import_utils20.AST_NODE_TYPES.TSSatisfiesExpression) {
1425
+ return isObjectLikeElement(node.expression);
1426
+ }
1427
+ return false;
1428
+ }
1429
+ function getArrayInitializer(init) {
1430
+ if (!init) {
1431
+ return null;
1432
+ }
1433
+ if (init.type === import_utils20.AST_NODE_TYPES.ArrayExpression) {
1434
+ return init;
1435
+ }
1436
+ if (init.type === import_utils20.AST_NODE_TYPES.TSAsExpression || init.type === import_utils20.AST_NODE_TYPES.TSSatisfiesExpression) {
1437
+ return getArrayInitializer(init.expression);
1438
+ }
1439
+ return null;
1440
+ }
1441
+ var jsxNoDataArray = createRule16({
1442
+ name: "jsx-no-data-array",
1443
+ meta: {
1444
+ type: "problem",
1445
+ docs: {
1446
+ description: "Disallow top-level arrays of object literals in .tsx/.jsx files (extract to a data file)"
1447
+ },
1448
+ schema: [],
1449
+ messages: {
1450
+ 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."
1451
+ }
1452
+ },
1453
+ defaultOptions: [],
1454
+ create(context) {
1455
+ const { filename } = context;
1456
+ const extension = getFileExtension(filename);
1457
+ if (extension !== "tsx" && extension !== "jsx") {
1458
+ return {};
1459
+ }
1460
+ return {
1461
+ "Program > VariableDeclaration > VariableDeclarator": function checkDeclarator(node) {
1462
+ const arrayInit = getArrayInitializer(node.init);
1463
+ if (!arrayInit) {
1464
+ return;
1465
+ }
1466
+ const hasObjectElement = arrayInit.elements.some((element) => isObjectLikeElement(element));
1467
+ if (!hasObjectElement) {
1468
+ return;
1469
+ }
1470
+ const name = node.id.type === import_utils20.AST_NODE_TYPES.Identifier ? node.id.name : "<destructured>";
1471
+ context.report({
1472
+ node,
1473
+ messageId: "noDataArray",
1474
+ data: { name }
1475
+ });
1476
+ },
1477
+ "Program > ExportNamedDeclaration > VariableDeclaration > VariableDeclarator": function checkExportedDeclarator(node) {
1478
+ const arrayInit = getArrayInitializer(node.init);
1479
+ if (!arrayInit) {
1480
+ return;
1481
+ }
1482
+ const hasObjectElement = arrayInit.elements.some((element) => isObjectLikeElement(element));
1483
+ if (!hasObjectElement) {
1484
+ return;
1485
+ }
1486
+ const name = node.id.type === import_utils20.AST_NODE_TYPES.Identifier ? node.id.name : "<destructured>";
1487
+ context.report({
1488
+ node,
1489
+ messageId: "noDataArray",
1490
+ data: { name }
1491
+ });
1492
+ }
1493
+ };
1494
+ }
1495
+ });
1496
+ var jsx_no_data_array_default = jsxNoDataArray;
1497
+
1498
+ // src/rules/jsx-no-data-object.ts
1499
+ var import_utils22 = require("@typescript-eslint/utils");
1500
+ var createRule17 = import_utils22.ESLintUtils.RuleCreator(
1501
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1502
+ );
1503
+ function unwrapAssertion(node) {
1504
+ if (!node) {
1505
+ return null;
1506
+ }
1507
+ if (node.type === import_utils22.AST_NODE_TYPES.TSAsExpression || node.type === import_utils22.AST_NODE_TYPES.TSSatisfiesExpression) {
1508
+ return unwrapAssertion(node.expression);
1509
+ }
1510
+ return node;
1511
+ }
1512
+ function isNestedValue(value) {
1513
+ const unwrapped = unwrapAssertion(value);
1514
+ if (!unwrapped) {
1515
+ return false;
1516
+ }
1517
+ if (unwrapped.type === import_utils22.AST_NODE_TYPES.ObjectExpression) {
1518
+ return true;
1519
+ }
1520
+ if (unwrapped.type === import_utils22.AST_NODE_TYPES.ArrayExpression) {
1521
+ return unwrapped.elements.some((element) => {
1522
+ if (!element || element.type === import_utils22.AST_NODE_TYPES.SpreadElement) {
1523
+ return false;
1524
+ }
1525
+ const inner = unwrapAssertion(element);
1526
+ return inner?.type === import_utils22.AST_NODE_TYPES.ObjectExpression || inner?.type === import_utils22.AST_NODE_TYPES.ArrayExpression;
1527
+ });
1528
+ }
1529
+ return false;
1530
+ }
1531
+ function hasNestedProperty(object) {
1532
+ return object.properties.some((property) => {
1533
+ if (property.type !== import_utils22.AST_NODE_TYPES.Property) {
1534
+ return false;
1535
+ }
1536
+ if (property.value.type === import_utils22.AST_NODE_TYPES.AssignmentPattern) {
1537
+ return false;
1538
+ }
1539
+ return isNestedValue(property.value);
1540
+ });
1541
+ }
1542
+ function getObjectInitializer(init) {
1543
+ const unwrapped = unwrapAssertion(init);
1544
+ if (!unwrapped) {
1545
+ return null;
1546
+ }
1547
+ if (unwrapped.type === import_utils22.AST_NODE_TYPES.ObjectExpression) {
1548
+ return unwrapped;
1549
+ }
1550
+ return null;
1551
+ }
1552
+ var jsxNoDataObject = createRule17({
1553
+ name: "jsx-no-data-object",
1554
+ meta: {
1555
+ type: "problem",
1556
+ docs: {
1557
+ description: "Disallow top-level nested object literals in .tsx/.jsx files (extract to a data file)"
1558
+ },
1559
+ schema: [],
1560
+ messages: {
1561
+ 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."
1562
+ }
1563
+ },
1564
+ defaultOptions: [],
1565
+ create(context) {
1566
+ const { filename } = context;
1567
+ const extension = getFileExtension(filename);
1568
+ if (extension !== "tsx" && extension !== "jsx") {
1569
+ return {};
1570
+ }
1571
+ function checkDeclarator(node) {
1572
+ const objectInit = getObjectInitializer(node.init);
1573
+ if (!objectInit) {
1574
+ return;
1575
+ }
1576
+ if (!hasNestedProperty(objectInit)) {
1577
+ return;
1578
+ }
1579
+ const name = node.id.type === import_utils22.AST_NODE_TYPES.Identifier ? node.id.name : "<destructured>";
1580
+ context.report({
1581
+ node,
1582
+ messageId: "noDataObject",
1583
+ data: { name }
1584
+ });
1585
+ }
1586
+ return {
1587
+ "Program > VariableDeclaration > VariableDeclarator": checkDeclarator,
1588
+ "Program > ExportNamedDeclaration > VariableDeclaration > VariableDeclarator": checkDeclarator
1589
+ };
1590
+ }
1591
+ });
1592
+ var jsx_no_data_object_default = jsxNoDataObject;
1593
+
1171
1594
  // src/rules/jsx-no-inline-object-prop.ts
1172
- var import_utils16 = require("@typescript-eslint/utils");
1173
- var createRule13 = import_utils16.ESLintUtils.RuleCreator(
1595
+ var import_utils24 = require("@typescript-eslint/utils");
1596
+ var createRule18 = import_utils24.ESLintUtils.RuleCreator(
1174
1597
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1175
1598
  );
1176
- var jsxNoInlineObjectProp = createRule13({
1599
+ var jsxNoInlineObjectProp = createRule18({
1177
1600
  name: "jsx-no-inline-object-prop",
1178
1601
  meta: {
1179
1602
  type: "suggestion",
@@ -1189,7 +1612,7 @@ var jsxNoInlineObjectProp = createRule13({
1189
1612
  create(context) {
1190
1613
  return {
1191
1614
  JSXAttribute(node) {
1192
- if (node.value?.type === import_utils16.AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === import_utils16.AST_NODE_TYPES.ObjectExpression) {
1615
+ if (node.value?.type === import_utils24.AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === import_utils24.AST_NODE_TYPES.ObjectExpression) {
1193
1616
  context.report({
1194
1617
  node: node.value,
1195
1618
  messageId: "noInlineObject"
@@ -1202,17 +1625,17 @@ var jsxNoInlineObjectProp = createRule13({
1202
1625
  var jsx_no_inline_object_prop_default = jsxNoInlineObjectProp;
1203
1626
 
1204
1627
  // src/rules/jsx-no-newline-single-line-elements.ts
1205
- var import_utils17 = require("@typescript-eslint/utils");
1206
- var createRule14 = import_utils17.ESLintUtils.RuleCreator(
1628
+ var import_utils25 = require("@typescript-eslint/utils");
1629
+ var createRule19 = import_utils25.ESLintUtils.RuleCreator(
1207
1630
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1208
1631
  );
1209
1632
  function isJSXElementOrFragment(node) {
1210
- return node.type === import_utils17.AST_NODE_TYPES.JSXElement || node.type === import_utils17.AST_NODE_TYPES.JSXFragment;
1633
+ return node.type === import_utils25.AST_NODE_TYPES.JSXElement || node.type === import_utils25.AST_NODE_TYPES.JSXFragment;
1211
1634
  }
1212
1635
  function isSingleLine(node) {
1213
1636
  return node.loc.start.line === node.loc.end.line;
1214
1637
  }
1215
- var jsxNoNewlineSingleLineElements = createRule14({
1638
+ var jsxNoNewlineSingleLineElements = createRule19({
1216
1639
  name: "jsx-no-newline-single-line-elements",
1217
1640
  meta: {
1218
1641
  type: "layout",
@@ -1230,7 +1653,7 @@ var jsxNoNewlineSingleLineElements = createRule14({
1230
1653
  const { sourceCode } = context;
1231
1654
  function checkSiblings(children) {
1232
1655
  const nonWhitespace = children.filter(
1233
- (child) => !(child.type === import_utils17.AST_NODE_TYPES.JSXText && child.value.trim() === "")
1656
+ (child) => !(child.type === import_utils25.AST_NODE_TYPES.JSXText && child.value.trim() === "")
1234
1657
  );
1235
1658
  nonWhitespace.forEach((next, index) => {
1236
1659
  if (index === 0) {
@@ -1281,11 +1704,11 @@ ${indent}`);
1281
1704
  var jsx_no_newline_single_line_elements_default = jsxNoNewlineSingleLineElements;
1282
1705
 
1283
1706
  // src/rules/jsx-no-non-component-function.ts
1284
- var import_utils18 = require("@typescript-eslint/utils");
1285
- var createRule15 = import_utils18.ESLintUtils.RuleCreator(
1707
+ var import_utils26 = require("@typescript-eslint/utils");
1708
+ var createRule20 = import_utils26.ESLintUtils.RuleCreator(
1286
1709
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1287
1710
  );
1288
- var jsxNoNonComponentFunction = createRule15({
1711
+ var jsxNoNonComponentFunction = createRule20({
1289
1712
  name: "jsx-no-non-component-function",
1290
1713
  meta: {
1291
1714
  type: "problem",
@@ -1305,13 +1728,13 @@ var jsxNoNonComponentFunction = createRule15({
1305
1728
  return {};
1306
1729
  }
1307
1730
  function isReactComponent2(node) {
1308
- const functionName = node.type === import_utils18.AST_NODE_TYPES.FunctionDeclaration && node.id ? node.id.name : null;
1731
+ const functionName = node.type === import_utils26.AST_NODE_TYPES.FunctionDeclaration && node.id ? node.id.name : null;
1309
1732
  if (functionName && /^[A-Z]/.test(functionName)) {
1310
1733
  return true;
1311
1734
  }
1312
1735
  if (node.returnType?.typeAnnotation) {
1313
1736
  const returnTypeNode = node.returnType.typeAnnotation;
1314
- if (returnTypeNode.type === import_utils18.AST_NODE_TYPES.TSTypeReference && returnTypeNode.typeName.type === import_utils18.AST_NODE_TYPES.Identifier) {
1737
+ if (returnTypeNode.type === import_utils26.AST_NODE_TYPES.TSTypeReference && returnTypeNode.typeName.type === import_utils26.AST_NODE_TYPES.Identifier) {
1315
1738
  const typeName = returnTypeNode.typeName.name;
1316
1739
  if (typeName === "JSX" || typeName === "ReactElement" || typeName === "ReactNode") {
1317
1740
  return true;
@@ -1328,13 +1751,13 @@ var jsxNoNonComponentFunction = createRule15({
1328
1751
  if (!parent) {
1329
1752
  return;
1330
1753
  }
1331
- if (parent.type === import_utils18.AST_NODE_TYPES.ExportDefaultDeclaration || parent.type === import_utils18.AST_NODE_TYPES.ExportNamedDeclaration) {
1754
+ if (parent.type === import_utils26.AST_NODE_TYPES.ExportDefaultDeclaration || parent.type === import_utils26.AST_NODE_TYPES.ExportNamedDeclaration) {
1332
1755
  return;
1333
1756
  }
1334
- if (declaratorNode?.parent?.parent?.type === import_utils18.AST_NODE_TYPES.ExportNamedDeclaration) {
1757
+ if (declaratorNode?.parent?.parent?.type === import_utils26.AST_NODE_TYPES.ExportNamedDeclaration) {
1335
1758
  return;
1336
1759
  }
1337
- if (declaratorNode?.id.type === import_utils18.AST_NODE_TYPES.Identifier) {
1760
+ if (declaratorNode?.id.type === import_utils26.AST_NODE_TYPES.Identifier) {
1338
1761
  const varName = declaratorNode.id.name;
1339
1762
  if (/^[A-Z]/.test(varName)) {
1340
1763
  return;
@@ -1358,21 +1781,146 @@ var jsxNoNonComponentFunction = createRule15({
1358
1781
  });
1359
1782
  var jsx_no_non_component_function_default = jsxNoNonComponentFunction;
1360
1783
 
1784
+ // src/rules/jsx-no-sub-interface.ts
1785
+ var import_utils28 = require("@typescript-eslint/utils");
1786
+ var createRule21 = import_utils28.ESLintUtils.RuleCreator(
1787
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1788
+ );
1789
+ var PROPS_WRAPPER_NAMES = /* @__PURE__ */ new Set(["Readonly", "Required", "Partial", "PropsWithChildren", "NoInfer"]);
1790
+ function unwrapWrapperType(node) {
1791
+ if (node.type === import_utils28.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils28.AST_NODE_TYPES.Identifier && PROPS_WRAPPER_NAMES.has(node.typeName.name) && node.typeArguments && node.typeArguments.params.length > 0) {
1792
+ return unwrapWrapperType(node.typeArguments.params[0]);
1793
+ }
1794
+ return node;
1795
+ }
1796
+ function getMainTypeName(typeNode) {
1797
+ if (!typeNode) {
1798
+ return null;
1799
+ }
1800
+ const unwrapped = unwrapWrapperType(typeNode);
1801
+ if (unwrapped.type === import_utils28.AST_NODE_TYPES.TSTypeReference && unwrapped.typeName.type === import_utils28.AST_NODE_TYPES.Identifier) {
1802
+ return unwrapped.typeName.name;
1803
+ }
1804
+ return null;
1805
+ }
1806
+ function getComponentMainTypeName(node) {
1807
+ const firstParam = node.params[0];
1808
+ if (!firstParam) {
1809
+ return null;
1810
+ }
1811
+ if ("typeAnnotation" in firstParam && firstParam.typeAnnotation) {
1812
+ return getMainTypeName(firstParam.typeAnnotation.typeAnnotation);
1813
+ }
1814
+ return null;
1815
+ }
1816
+ function isPascalCase2(name) {
1817
+ return /^[A-Z]/.test(name);
1818
+ }
1819
+ function getDeclarationFromExportWrapper(node) {
1820
+ if (node.type === import_utils28.AST_NODE_TYPES.ExportNamedDeclaration && node.declaration) {
1821
+ return node.declaration;
1822
+ }
1823
+ if (node.type === import_utils28.AST_NODE_TYPES.ExportDefaultDeclaration) {
1824
+ return node.declaration;
1825
+ }
1826
+ return node;
1827
+ }
1828
+ var jsxNoSubInterface = createRule21({
1829
+ name: "jsx-no-sub-interface",
1830
+ meta: {
1831
+ type: "problem",
1832
+ docs: {
1833
+ description: "Disallow sub-interfaces and helper types in component files; keep only the main component props (extract the rest)"
1834
+ },
1835
+ schema: [],
1836
+ messages: {
1837
+ 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)."
1838
+ }
1839
+ },
1840
+ defaultOptions: [],
1841
+ create(context) {
1842
+ const { filename } = context;
1843
+ const extension = getFileExtension(filename);
1844
+ if (extension !== "tsx" && extension !== "jsx") {
1845
+ return {};
1846
+ }
1847
+ return {
1848
+ Program(programNode) {
1849
+ const mainTypes = /* @__PURE__ */ new Set();
1850
+ const typeDeclarations = [];
1851
+ let componentCount = 0;
1852
+ for (const statement of programNode.body) {
1853
+ const declaration = getDeclarationFromExportWrapper(statement);
1854
+ if (declaration.type === import_utils28.AST_NODE_TYPES.FunctionDeclaration && declaration.id && isPascalCase2(declaration.id.name)) {
1855
+ componentCount += 1;
1856
+ const mainType = getComponentMainTypeName(declaration);
1857
+ if (mainType) {
1858
+ mainTypes.add(mainType);
1859
+ }
1860
+ continue;
1861
+ }
1862
+ if (declaration.type === import_utils28.AST_NODE_TYPES.VariableDeclaration) {
1863
+ for (const declarator of declaration.declarations) {
1864
+ if (declarator.id.type !== import_utils28.AST_NODE_TYPES.Identifier) {
1865
+ continue;
1866
+ }
1867
+ if (!isPascalCase2(declarator.id.name)) {
1868
+ continue;
1869
+ }
1870
+ const init = declarator.init;
1871
+ if (init && (init.type === import_utils28.AST_NODE_TYPES.ArrowFunctionExpression || init.type === import_utils28.AST_NODE_TYPES.FunctionExpression)) {
1872
+ componentCount += 1;
1873
+ const mainType = getComponentMainTypeName(init);
1874
+ if (mainType) {
1875
+ mainTypes.add(mainType);
1876
+ }
1877
+ }
1878
+ }
1879
+ continue;
1880
+ }
1881
+ if (declaration.type === import_utils28.AST_NODE_TYPES.TSInterfaceDeclaration) {
1882
+ typeDeclarations.push({ name: declaration.id.name, node: declaration });
1883
+ continue;
1884
+ }
1885
+ if (declaration.type === import_utils28.AST_NODE_TYPES.TSTypeAliasDeclaration) {
1886
+ typeDeclarations.push({ name: declaration.id.name, node: declaration });
1887
+ continue;
1888
+ }
1889
+ }
1890
+ if (componentCount === 0) {
1891
+ return;
1892
+ }
1893
+ for (const declaration of typeDeclarations) {
1894
+ if (mainTypes.has(declaration.name)) {
1895
+ continue;
1896
+ }
1897
+ context.report({
1898
+ node: declaration.node,
1899
+ messageId: "noSubInterface",
1900
+ data: { name: declaration.name }
1901
+ });
1902
+ }
1903
+ }
1904
+ };
1905
+ }
1906
+ });
1907
+ var jsx_no_sub_interface_default = jsxNoSubInterface;
1908
+
1361
1909
  // src/rules/jsx-no-ternary-null.ts
1362
- var import_utils20 = require("@typescript-eslint/utils");
1363
- var createRule16 = import_utils20.ESLintUtils.RuleCreator(
1910
+ var import_utils30 = require("@typescript-eslint/utils");
1911
+ var createRule22 = import_utils30.ESLintUtils.RuleCreator(
1364
1912
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1365
1913
  );
1366
1914
  function isNullOrUndefined(node) {
1367
- if (node.type === import_utils20.AST_NODE_TYPES.Literal && node.value === null) {
1915
+ if (node.type === import_utils30.AST_NODE_TYPES.Literal && node.value === null) {
1368
1916
  return true;
1369
1917
  }
1370
- if (node.type === import_utils20.AST_NODE_TYPES.Identifier && node.name === "undefined") {
1918
+ if (node.type === import_utils30.AST_NODE_TYPES.Identifier && node.name === "undefined") {
1371
1919
  return true;
1372
1920
  }
1373
1921
  return false;
1374
1922
  }
1375
- var jsxNoTernaryNull = createRule16({
1923
+ var jsxNoTernaryNull = createRule22({
1376
1924
  name: "jsx-no-ternary-null",
1377
1925
  meta: {
1378
1926
  type: "suggestion",
@@ -1390,7 +1938,7 @@ var jsxNoTernaryNull = createRule16({
1390
1938
  return {
1391
1939
  JSXExpressionContainer(node) {
1392
1940
  const { expression } = node;
1393
- if (expression.type !== import_utils20.AST_NODE_TYPES.ConditionalExpression) {
1941
+ if (expression.type !== import_utils30.AST_NODE_TYPES.ConditionalExpression) {
1394
1942
  return;
1395
1943
  }
1396
1944
  const { test, consequent, alternate } = expression;
@@ -1422,11 +1970,11 @@ var jsxNoTernaryNull = createRule16({
1422
1970
  var jsx_no_ternary_null_default = jsxNoTernaryNull;
1423
1971
 
1424
1972
  // src/rules/jsx-no-variable-in-callback.ts
1425
- var import_utils21 = require("@typescript-eslint/utils");
1426
- var createRule17 = import_utils21.ESLintUtils.RuleCreator(
1973
+ var import_utils31 = require("@typescript-eslint/utils");
1974
+ var createRule23 = import_utils31.ESLintUtils.RuleCreator(
1427
1975
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1428
1976
  );
1429
- var jsxNoVariableInCallback = createRule17({
1977
+ var jsxNoVariableInCallback = createRule23({
1430
1978
  name: "jsx-no-variable-in-callback",
1431
1979
  meta: {
1432
1980
  type: "suggestion",
@@ -1443,7 +1991,7 @@ var jsxNoVariableInCallback = createRule17({
1443
1991
  function isInsideJSX(node) {
1444
1992
  let current = node.parent;
1445
1993
  while (current) {
1446
- if (current.type === import_utils21.AST_NODE_TYPES.JSXElement || current.type === import_utils21.AST_NODE_TYPES.JSXFragment) {
1994
+ if (current.type === import_utils31.AST_NODE_TYPES.JSXElement || current.type === import_utils31.AST_NODE_TYPES.JSXFragment) {
1447
1995
  return true;
1448
1996
  }
1449
1997
  current = current.parent;
@@ -1457,11 +2005,11 @@ var jsxNoVariableInCallback = createRule17({
1457
2005
  if (!isInsideJSX(node)) {
1458
2006
  return false;
1459
2007
  }
1460
- if (node.parent.type === import_utils21.AST_NODE_TYPES.CallExpression || node.parent.type === import_utils21.AST_NODE_TYPES.JSXExpressionContainer) {
2008
+ if (node.parent.type === import_utils31.AST_NODE_TYPES.CallExpression || node.parent.type === import_utils31.AST_NODE_TYPES.JSXExpressionContainer) {
1461
2009
  return true;
1462
2010
  }
1463
- if (node.parent.type === import_utils21.AST_NODE_TYPES.ArrayExpression && node.parent.parent) {
1464
- if (node.parent.parent.type === import_utils21.AST_NODE_TYPES.CallExpression || node.parent.parent.type === import_utils21.AST_NODE_TYPES.JSXExpressionContainer) {
2011
+ if (node.parent.type === import_utils31.AST_NODE_TYPES.ArrayExpression && node.parent.parent) {
2012
+ if (node.parent.parent.type === import_utils31.AST_NODE_TYPES.CallExpression || node.parent.parent.type === import_utils31.AST_NODE_TYPES.JSXExpressionContainer) {
1465
2013
  return true;
1466
2014
  }
1467
2015
  }
@@ -1472,11 +2020,11 @@ var jsxNoVariableInCallback = createRule17({
1472
2020
  return;
1473
2021
  }
1474
2022
  const { body } = node;
1475
- if (body.type !== import_utils21.AST_NODE_TYPES.BlockStatement) {
2023
+ if (body.type !== import_utils31.AST_NODE_TYPES.BlockStatement) {
1476
2024
  return;
1477
2025
  }
1478
2026
  body.body.forEach((statement) => {
1479
- if (statement.type === import_utils21.AST_NODE_TYPES.VariableDeclaration) {
2027
+ if (statement.type === import_utils31.AST_NODE_TYPES.VariableDeclaration) {
1480
2028
  context.report({
1481
2029
  node: statement,
1482
2030
  messageId: "noVariableInCallback"
@@ -1493,11 +2041,11 @@ var jsxNoVariableInCallback = createRule17({
1493
2041
  var jsx_no_variable_in_callback_default = jsxNoVariableInCallback;
1494
2042
 
1495
2043
  // src/rules/jsx-require-suspense.ts
1496
- var import_utils22 = require("@typescript-eslint/utils");
1497
- var createRule18 = import_utils22.ESLintUtils.RuleCreator(
2044
+ var import_utils32 = require("@typescript-eslint/utils");
2045
+ var createRule24 = import_utils32.ESLintUtils.RuleCreator(
1498
2046
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1499
2047
  );
1500
- var jsxRequireSuspense = createRule18({
2048
+ var jsxRequireSuspense = createRule24({
1501
2049
  name: "jsx-require-suspense",
1502
2050
  meta: {
1503
2051
  type: "problem",
@@ -1515,7 +2063,7 @@ var jsxRequireSuspense = createRule18({
1515
2063
  const isInsideSuspense = (node) => {
1516
2064
  let current = node.parent;
1517
2065
  while (current) {
1518
- if (current.type === import_utils22.AST_NODE_TYPES.JSXElement && current.openingElement.name.type === import_utils22.AST_NODE_TYPES.JSXIdentifier && current.openingElement.name.name === "Suspense") {
2066
+ if (current.type === import_utils32.AST_NODE_TYPES.JSXElement && current.openingElement.name.type === import_utils32.AST_NODE_TYPES.JSXIdentifier && current.openingElement.name.name === "Suspense") {
1519
2067
  return true;
1520
2068
  }
1521
2069
  current = current.parent;
@@ -1524,16 +2072,16 @@ var jsxRequireSuspense = createRule18({
1524
2072
  };
1525
2073
  return {
1526
2074
  VariableDeclarator(node) {
1527
- if (node.id.type === import_utils22.AST_NODE_TYPES.Identifier && node.init?.type === import_utils22.AST_NODE_TYPES.CallExpression) {
2075
+ if (node.id.type === import_utils32.AST_NODE_TYPES.Identifier && node.init?.type === import_utils32.AST_NODE_TYPES.CallExpression) {
1528
2076
  const { callee } = node.init;
1529
- const isLazyCall = callee.type === import_utils22.AST_NODE_TYPES.Identifier && callee.name === "lazy" || callee.type === import_utils22.AST_NODE_TYPES.MemberExpression && callee.object.type === import_utils22.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === import_utils22.AST_NODE_TYPES.Identifier && callee.property.name === "lazy";
2077
+ const isLazyCall = callee.type === import_utils32.AST_NODE_TYPES.Identifier && callee.name === "lazy" || callee.type === import_utils32.AST_NODE_TYPES.MemberExpression && callee.object.type === import_utils32.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === import_utils32.AST_NODE_TYPES.Identifier && callee.property.name === "lazy";
1530
2078
  if (isLazyCall) {
1531
2079
  lazyComponents.add(node.id.name);
1532
2080
  }
1533
2081
  }
1534
2082
  },
1535
2083
  JSXOpeningElement(node) {
1536
- if (node.name.type === import_utils22.AST_NODE_TYPES.JSXIdentifier) {
2084
+ if (node.name.type === import_utils32.AST_NODE_TYPES.JSXIdentifier) {
1537
2085
  const componentName = node.name.name;
1538
2086
  if (lazyComponents.has(componentName) && !isInsideSuspense(node)) {
1539
2087
  context.report({
@@ -1552,11 +2100,11 @@ var jsxRequireSuspense = createRule18({
1552
2100
  var jsx_require_suspense_default = jsxRequireSuspense;
1553
2101
 
1554
2102
  // src/rules/jsx-simple-props.ts
1555
- var import_utils23 = require("@typescript-eslint/utils");
1556
- var createRule19 = import_utils23.ESLintUtils.RuleCreator(
2103
+ var import_utils33 = require("@typescript-eslint/utils");
2104
+ var createRule25 = import_utils33.ESLintUtils.RuleCreator(
1557
2105
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1558
2106
  );
1559
- var jsxSimpleProps = createRule19({
2107
+ var jsxSimpleProps = createRule25({
1560
2108
  name: "jsx-simple-props",
1561
2109
  meta: {
1562
2110
  type: "suggestion",
@@ -1571,25 +2119,25 @@ var jsxSimpleProps = createRule19({
1571
2119
  defaultOptions: [],
1572
2120
  create(context) {
1573
2121
  const allowedExpressionTypes = /* @__PURE__ */ new Set([
1574
- import_utils23.AST_NODE_TYPES.Identifier,
1575
- import_utils23.AST_NODE_TYPES.Literal,
1576
- import_utils23.AST_NODE_TYPES.JSXElement,
1577
- import_utils23.AST_NODE_TYPES.JSXFragment,
1578
- import_utils23.AST_NODE_TYPES.MemberExpression,
1579
- import_utils23.AST_NODE_TYPES.ArrowFunctionExpression,
1580
- import_utils23.AST_NODE_TYPES.FunctionExpression
2122
+ import_utils33.AST_NODE_TYPES.Identifier,
2123
+ import_utils33.AST_NODE_TYPES.Literal,
2124
+ import_utils33.AST_NODE_TYPES.JSXElement,
2125
+ import_utils33.AST_NODE_TYPES.JSXFragment,
2126
+ import_utils33.AST_NODE_TYPES.MemberExpression,
2127
+ import_utils33.AST_NODE_TYPES.ArrowFunctionExpression,
2128
+ import_utils33.AST_NODE_TYPES.FunctionExpression
1581
2129
  ]);
1582
2130
  return {
1583
2131
  JSXAttribute(node) {
1584
2132
  if (!node.value) {
1585
2133
  return;
1586
2134
  }
1587
- if (node.value.type === import_utils23.AST_NODE_TYPES.Literal) {
2135
+ if (node.value.type === import_utils33.AST_NODE_TYPES.Literal) {
1588
2136
  return;
1589
2137
  }
1590
- if (node.value.type === import_utils23.AST_NODE_TYPES.JSXExpressionContainer) {
2138
+ if (node.value.type === import_utils33.AST_NODE_TYPES.JSXExpressionContainer) {
1591
2139
  const { expression } = node.value;
1592
- if (expression.type === import_utils23.AST_NODE_TYPES.JSXEmptyExpression) {
2140
+ if (expression.type === import_utils33.AST_NODE_TYPES.JSXEmptyExpression) {
1593
2141
  return;
1594
2142
  }
1595
2143
  if (!allowedExpressionTypes.has(expression.type)) {
@@ -1606,8 +2154,8 @@ var jsxSimpleProps = createRule19({
1606
2154
  var jsx_simple_props_default = jsxSimpleProps;
1607
2155
 
1608
2156
  // src/rules/jsx-sort-props.ts
1609
- var import_utils24 = require("@typescript-eslint/utils");
1610
- var createRule20 = import_utils24.ESLintUtils.RuleCreator(
2157
+ var import_utils34 = require("@typescript-eslint/utils");
2158
+ var createRule26 = import_utils34.ESLintUtils.RuleCreator(
1611
2159
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1612
2160
  );
1613
2161
  var TYPE_GROUP = {
@@ -1621,15 +2169,15 @@ var TYPE_GROUP = {
1621
2169
  SHORTHAND: 8
1622
2170
  };
1623
2171
  var EXPRESSION_TYPE_TO_GROUP = /* @__PURE__ */ new Map([
1624
- [import_utils24.AST_NODE_TYPES.ObjectExpression, TYPE_GROUP.OBJECT_ARRAY],
1625
- [import_utils24.AST_NODE_TYPES.ArrayExpression, TYPE_GROUP.OBJECT_ARRAY],
1626
- [import_utils24.AST_NODE_TYPES.ArrowFunctionExpression, TYPE_GROUP.FUNCTION],
1627
- [import_utils24.AST_NODE_TYPES.FunctionExpression, TYPE_GROUP.FUNCTION],
1628
- [import_utils24.AST_NODE_TYPES.JSXElement, TYPE_GROUP.JSX],
1629
- [import_utils24.AST_NODE_TYPES.JSXFragment, TYPE_GROUP.JSX]
2172
+ [import_utils34.AST_NODE_TYPES.ObjectExpression, TYPE_GROUP.OBJECT_ARRAY],
2173
+ [import_utils34.AST_NODE_TYPES.ArrayExpression, TYPE_GROUP.OBJECT_ARRAY],
2174
+ [import_utils34.AST_NODE_TYPES.ArrowFunctionExpression, TYPE_GROUP.FUNCTION],
2175
+ [import_utils34.AST_NODE_TYPES.FunctionExpression, TYPE_GROUP.FUNCTION],
2176
+ [import_utils34.AST_NODE_TYPES.JSXElement, TYPE_GROUP.JSX],
2177
+ [import_utils34.AST_NODE_TYPES.JSXFragment, TYPE_GROUP.JSX]
1630
2178
  ]);
1631
2179
  function isHyphenatedName(node) {
1632
- return node.name.type === import_utils24.AST_NODE_TYPES.JSXIdentifier && node.name.name.includes("-");
2180
+ return node.name.type === import_utils34.AST_NODE_TYPES.JSXIdentifier && node.name.name.includes("-");
1633
2181
  }
1634
2182
  function getStringGroup(node) {
1635
2183
  return isHyphenatedName(node) ? TYPE_GROUP.HYPHENATED_STRING : TYPE_GROUP.STRING;
@@ -1641,13 +2189,13 @@ function getLiteralValueGroup(value) {
1641
2189
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
1642
2190
  }
1643
2191
  function getExpressionGroup(expression) {
1644
- if (expression.type === import_utils24.AST_NODE_TYPES.Literal) {
2192
+ if (expression.type === import_utils34.AST_NODE_TYPES.Literal) {
1645
2193
  return getLiteralValueGroup(expression.value);
1646
2194
  }
1647
- if (expression.type === import_utils24.AST_NODE_TYPES.TemplateLiteral) {
2195
+ if (expression.type === import_utils34.AST_NODE_TYPES.TemplateLiteral) {
1648
2196
  return null;
1649
2197
  }
1650
- if (expression.type === import_utils24.AST_NODE_TYPES.Identifier && expression.name === "undefined") {
2198
+ if (expression.type === import_utils34.AST_NODE_TYPES.Identifier && expression.name === "undefined") {
1651
2199
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
1652
2200
  }
1653
2201
  return EXPRESSION_TYPE_TO_GROUP.get(expression.type) ?? TYPE_GROUP.EXPRESSION;
@@ -1656,17 +2204,17 @@ function getTypeGroup(node) {
1656
2204
  if (node.value === null) {
1657
2205
  return TYPE_GROUP.SHORTHAND;
1658
2206
  }
1659
- if (node.value.type === import_utils24.AST_NODE_TYPES.Literal) {
2207
+ if (node.value.type === import_utils34.AST_NODE_TYPES.Literal) {
1660
2208
  if (typeof node.value.value === "string") {
1661
2209
  return getStringGroup(node);
1662
2210
  }
1663
2211
  return TYPE_GROUP.NUMBER_BOOLEAN_NULL;
1664
2212
  }
1665
- if (node.value.type !== import_utils24.AST_NODE_TYPES.JSXExpressionContainer) {
2213
+ if (node.value.type !== import_utils34.AST_NODE_TYPES.JSXExpressionContainer) {
1666
2214
  return null;
1667
2215
  }
1668
2216
  const { expression } = node.value;
1669
- if (expression.type === import_utils24.AST_NODE_TYPES.JSXEmptyExpression) {
2217
+ if (expression.type === import_utils34.AST_NODE_TYPES.JSXEmptyExpression) {
1670
2218
  return null;
1671
2219
  }
1672
2220
  const group = getExpressionGroup(expression);
@@ -1678,7 +2226,7 @@ function getTypeGroup(node) {
1678
2226
  function hasUnsortedProps(attributes) {
1679
2227
  let lastGroup = 0;
1680
2228
  return attributes.some((attribute) => {
1681
- if (attribute.type === import_utils24.AST_NODE_TYPES.JSXSpreadAttribute) {
2229
+ if (attribute.type === import_utils34.AST_NODE_TYPES.JSXSpreadAttribute) {
1682
2230
  lastGroup = 0;
1683
2231
  return false;
1684
2232
  }
@@ -1702,7 +2250,7 @@ function getSegments(attributes) {
1702
2250
  const result = [];
1703
2251
  let current = [];
1704
2252
  attributes.forEach((attr) => {
1705
- if (attr.type === import_utils24.AST_NODE_TYPES.JSXSpreadAttribute) {
2253
+ if (attr.type === import_utils34.AST_NODE_TYPES.JSXSpreadAttribute) {
1706
2254
  if (current.length > 0) {
1707
2255
  result.push(current);
1708
2256
  current = [];
@@ -1716,7 +2264,7 @@ function getSegments(attributes) {
1716
2264
  }
1717
2265
  return result;
1718
2266
  }
1719
- var jsxSortProps = createRule20({
2267
+ var jsxSortProps = createRule26({
1720
2268
  name: "jsx-sort-props",
1721
2269
  meta: {
1722
2270
  type: "suggestion",
@@ -1751,11 +2299,11 @@ var jsxSortProps = createRule20({
1751
2299
  var jsx_sort_props_default = jsxSortProps;
1752
2300
 
1753
2301
  // src/rules/jsx-spread-props-last.ts
1754
- var import_utils25 = require("@typescript-eslint/utils");
1755
- var createRule21 = import_utils25.ESLintUtils.RuleCreator(
2302
+ var import_utils35 = require("@typescript-eslint/utils");
2303
+ var createRule27 = import_utils35.ESLintUtils.RuleCreator(
1756
2304
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1757
2305
  );
1758
- var jsxSpreadPropsLast = createRule21({
2306
+ var jsxSpreadPropsLast = createRule27({
1759
2307
  name: "jsx-spread-props-last",
1760
2308
  meta: {
1761
2309
  type: "suggestion",
@@ -1774,12 +2322,12 @@ var jsxSpreadPropsLast = createRule21({
1774
2322
  const { attributes } = node;
1775
2323
  let lastNonSpreadIndex = -1;
1776
2324
  attributes.forEach((attribute, index) => {
1777
- if (attribute.type !== import_utils25.AST_NODE_TYPES.JSXSpreadAttribute) {
2325
+ if (attribute.type !== import_utils35.AST_NODE_TYPES.JSXSpreadAttribute) {
1778
2326
  lastNonSpreadIndex = index;
1779
2327
  }
1780
2328
  });
1781
2329
  attributes.forEach((attribute, index) => {
1782
- if (attribute.type === import_utils25.AST_NODE_TYPES.JSXSpreadAttribute && index < lastNonSpreadIndex) {
2330
+ if (attribute.type === import_utils35.AST_NODE_TYPES.JSXSpreadAttribute && index < lastNonSpreadIndex) {
1783
2331
  context.report({
1784
2332
  node: attribute,
1785
2333
  messageId: "spreadNotLast"
@@ -1793,12 +2341,12 @@ var jsxSpreadPropsLast = createRule21({
1793
2341
  var jsx_spread_props_last_default = jsxSpreadPropsLast;
1794
2342
 
1795
2343
  // src/rules/newline-after-multiline-block.ts
1796
- var import_utils26 = require("@typescript-eslint/utils");
1797
- var createRule22 = import_utils26.ESLintUtils.RuleCreator(
2344
+ var import_utils36 = require("@typescript-eslint/utils");
2345
+ var createRule28 = import_utils36.ESLintUtils.RuleCreator(
1798
2346
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1799
2347
  );
1800
2348
  function isImportDeclaration(node) {
1801
- return node.type === import_utils26.AST_NODE_TYPES.ImportDeclaration;
2349
+ return node.type === import_utils36.AST_NODE_TYPES.ImportDeclaration;
1802
2350
  }
1803
2351
  function checkStatements(statements, context) {
1804
2352
  const { sourceCode } = context;
@@ -1833,7 +2381,7 @@ function checkStatements(statements, context) {
1833
2381
  }
1834
2382
  });
1835
2383
  }
1836
- var newlineAfterMultilineBlock = createRule22({
2384
+ var newlineAfterMultilineBlock = createRule28({
1837
2385
  name: "newline-after-multiline-block",
1838
2386
  meta: {
1839
2387
  type: "layout",
@@ -1861,11 +2409,11 @@ var newlineAfterMultilineBlock = createRule22({
1861
2409
  var newline_after_multiline_block_default = newlineAfterMultilineBlock;
1862
2410
 
1863
2411
  // src/rules/newline-before-return.ts
1864
- var import_utils27 = require("@typescript-eslint/utils");
1865
- var createRule23 = import_utils27.ESLintUtils.RuleCreator(
2412
+ var import_utils37 = require("@typescript-eslint/utils");
2413
+ var createRule29 = import_utils37.ESLintUtils.RuleCreator(
1866
2414
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1867
2415
  );
1868
- var newlineBeforeReturn = createRule23({
2416
+ var newlineBeforeReturn = createRule29({
1869
2417
  name: "newline-before-return",
1870
2418
  meta: {
1871
2419
  type: "layout",
@@ -1883,7 +2431,7 @@ var newlineBeforeReturn = createRule23({
1883
2431
  const { sourceCode } = context;
1884
2432
  function checkReturnStatement(node) {
1885
2433
  const { parent } = node;
1886
- if (!parent || parent.type !== import_utils27.AST_NODE_TYPES.BlockStatement) {
2434
+ if (!parent || parent.type !== import_utils37.AST_NODE_TYPES.BlockStatement) {
1887
2435
  return;
1888
2436
  }
1889
2437
  const { body: statements } = parent;
@@ -1920,11 +2468,11 @@ var newlineBeforeReturn = createRule23({
1920
2468
  var newline_before_return_default = newlineBeforeReturn;
1921
2469
 
1922
2470
  // src/rules/no-complex-inline-return.ts
1923
- var import_utils28 = require("@typescript-eslint/utils");
1924
- var createRule24 = import_utils28.ESLintUtils.RuleCreator(
2471
+ var import_utils38 = require("@typescript-eslint/utils");
2472
+ var createRule30 = import_utils38.ESLintUtils.RuleCreator(
1925
2473
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1926
2474
  );
1927
- var noComplexInlineReturn = createRule24({
2475
+ var noComplexInlineReturn = createRule30({
1928
2476
  name: "no-complex-inline-return",
1929
2477
  meta: {
1930
2478
  type: "suggestion",
@@ -1940,13 +2488,13 @@ var noComplexInlineReturn = createRule24({
1940
2488
  create(context) {
1941
2489
  const isComplexExpression = (node) => {
1942
2490
  if (!node) return false;
1943
- if (node.type === import_utils28.AST_NODE_TYPES.ConditionalExpression) {
2491
+ if (node.type === import_utils38.AST_NODE_TYPES.ConditionalExpression) {
1944
2492
  return true;
1945
2493
  }
1946
- if (node.type === import_utils28.AST_NODE_TYPES.LogicalExpression) {
2494
+ if (node.type === import_utils38.AST_NODE_TYPES.LogicalExpression) {
1947
2495
  return true;
1948
2496
  }
1949
- if (node.type === import_utils28.AST_NODE_TYPES.NewExpression) {
2497
+ if (node.type === import_utils38.AST_NODE_TYPES.NewExpression) {
1950
2498
  return true;
1951
2499
  }
1952
2500
  return false;
@@ -1966,11 +2514,11 @@ var noComplexInlineReturn = createRule24({
1966
2514
  var no_complex_inline_return_default = noComplexInlineReturn;
1967
2515
 
1968
2516
  // src/rules/no-direct-date.ts
1969
- var import_utils29 = require("@typescript-eslint/utils");
1970
- var createRule25 = import_utils29.ESLintUtils.RuleCreator(
2517
+ var import_utils39 = require("@typescript-eslint/utils");
2518
+ var createRule31 = import_utils39.ESLintUtils.RuleCreator(
1971
2519
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1972
2520
  );
1973
- var noDirectDate = createRule25({
2521
+ var noDirectDate = createRule31({
1974
2522
  name: "no-direct-date",
1975
2523
  meta: {
1976
2524
  type: "problem",
@@ -1988,7 +2536,7 @@ var noDirectDate = createRule25({
1988
2536
  create(context) {
1989
2537
  return {
1990
2538
  NewExpression(node) {
1991
- if (node.callee.type === import_utils29.AST_NODE_TYPES.Identifier && node.callee.name === "Date") {
2539
+ if (node.callee.type === import_utils39.AST_NODE_TYPES.Identifier && node.callee.name === "Date") {
1992
2540
  context.report({
1993
2541
  node,
1994
2542
  messageId: "noNewDate"
@@ -1996,7 +2544,7 @@ var noDirectDate = createRule25({
1996
2544
  }
1997
2545
  },
1998
2546
  CallExpression(node) {
1999
- if (node.callee.type === import_utils29.AST_NODE_TYPES.MemberExpression && node.callee.object.type === import_utils29.AST_NODE_TYPES.Identifier && node.callee.object.name === "Date" && node.callee.property.type === import_utils29.AST_NODE_TYPES.Identifier) {
2547
+ if (node.callee.type === import_utils39.AST_NODE_TYPES.MemberExpression && node.callee.object.type === import_utils39.AST_NODE_TYPES.Identifier && node.callee.object.name === "Date" && node.callee.property.type === import_utils39.AST_NODE_TYPES.Identifier) {
2000
2548
  const methodName = node.callee.property.name;
2001
2549
  if (methodName === "now") {
2002
2550
  context.report({
@@ -2019,11 +2567,11 @@ var no_direct_date_default = noDirectDate;
2019
2567
 
2020
2568
  // src/rules/no-emoji.ts
2021
2569
  var import_emoji_regex = __toESM(require("emoji-regex"), 1);
2022
- var import_utils30 = require("@typescript-eslint/utils");
2023
- var createRule26 = import_utils30.ESLintUtils.RuleCreator(
2570
+ var import_utils40 = require("@typescript-eslint/utils");
2571
+ var createRule32 = import_utils40.ESLintUtils.RuleCreator(
2024
2572
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2025
2573
  );
2026
- var noEmoji = createRule26({
2574
+ var noEmoji = createRule32({
2027
2575
  name: "no-emoji",
2028
2576
  meta: {
2029
2577
  type: "problem",
@@ -2057,11 +2605,11 @@ var noEmoji = createRule26({
2057
2605
  var no_emoji_default = noEmoji;
2058
2606
 
2059
2607
  // src/rules/no-env-fallback.ts
2060
- var import_utils31 = require("@typescript-eslint/utils");
2061
- var createRule27 = import_utils31.ESLintUtils.RuleCreator(
2608
+ var import_utils41 = require("@typescript-eslint/utils");
2609
+ var createRule33 = import_utils41.ESLintUtils.RuleCreator(
2062
2610
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2063
2611
  );
2064
- var noEnvFallback = createRule27({
2612
+ var noEnvFallback = createRule33({
2065
2613
  name: "no-env-fallback",
2066
2614
  meta: {
2067
2615
  type: "problem",
@@ -2076,16 +2624,16 @@ var noEnvFallback = createRule27({
2076
2624
  defaultOptions: [],
2077
2625
  create(context) {
2078
2626
  const isProcessEnvAccess = (node) => {
2079
- if (node.type !== import_utils31.AST_NODE_TYPES.MemberExpression) {
2627
+ if (node.type !== import_utils41.AST_NODE_TYPES.MemberExpression) {
2080
2628
  return false;
2081
2629
  }
2082
2630
  const { object } = node;
2083
- if (object.type !== import_utils31.AST_NODE_TYPES.MemberExpression) {
2631
+ if (object.type !== import_utils41.AST_NODE_TYPES.MemberExpression) {
2084
2632
  return false;
2085
2633
  }
2086
2634
  const processNode = object.object;
2087
2635
  const envNode = object.property;
2088
- return processNode.type === import_utils31.AST_NODE_TYPES.Identifier && processNode.name === "process" && envNode.type === import_utils31.AST_NODE_TYPES.Identifier && envNode.name === "env";
2636
+ return processNode.type === import_utils41.AST_NODE_TYPES.Identifier && processNode.name === "process" && envNode.type === import_utils41.AST_NODE_TYPES.Identifier && envNode.name === "env";
2089
2637
  };
2090
2638
  return {
2091
2639
  LogicalExpression(node) {
@@ -2110,15 +2658,15 @@ var noEnvFallback = createRule27({
2110
2658
  var no_env_fallback_default = noEnvFallback;
2111
2659
 
2112
2660
  // src/rules/no-ghost-wrapper.ts
2113
- var import_utils32 = require("@typescript-eslint/utils");
2114
- var createRule28 = import_utils32.ESLintUtils.RuleCreator(
2661
+ var import_utils42 = require("@typescript-eslint/utils");
2662
+ var createRule34 = import_utils42.ESLintUtils.RuleCreator(
2115
2663
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2116
2664
  );
2117
2665
  var GHOST_TAGS = /* @__PURE__ */ new Set(["div", "span"]);
2118
2666
  function isKeyAttribute(attribute) {
2119
- return attribute.type === import_utils32.AST_NODE_TYPES.JSXAttribute && attribute.name.type === import_utils32.AST_NODE_TYPES.JSXIdentifier && attribute.name.name === "key";
2667
+ return attribute.type === import_utils42.AST_NODE_TYPES.JSXAttribute && attribute.name.type === import_utils42.AST_NODE_TYPES.JSXIdentifier && attribute.name.name === "key";
2120
2668
  }
2121
- var noGhostWrapper = createRule28({
2669
+ var noGhostWrapper = createRule34({
2122
2670
  name: "no-ghost-wrapper",
2123
2671
  meta: {
2124
2672
  type: "problem",
@@ -2134,7 +2682,7 @@ var noGhostWrapper = createRule28({
2134
2682
  create(context) {
2135
2683
  return {
2136
2684
  JSXOpeningElement(node) {
2137
- if (node.name.type !== import_utils32.AST_NODE_TYPES.JSXIdentifier) {
2685
+ if (node.name.type !== import_utils42.AST_NODE_TYPES.JSXIdentifier) {
2138
2686
  return;
2139
2687
  }
2140
2688
  const tagName = node.name.name;
@@ -2155,12 +2703,92 @@ var noGhostWrapper = createRule28({
2155
2703
  });
2156
2704
  var no_ghost_wrapper_default = noGhostWrapper;
2157
2705
 
2706
+ // src/rules/no-helper-function-in-hook.ts
2707
+ var import_utils43 = require("@typescript-eslint/utils");
2708
+ var createRule35 = import_utils43.ESLintUtils.RuleCreator(
2709
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2710
+ );
2711
+ var noHelperFunctionInHook = createRule35({
2712
+ name: "no-helper-function-in-hook",
2713
+ meta: {
2714
+ type: "suggestion",
2715
+ docs: {
2716
+ description: "Disallow non-hook helper function definitions in hook files"
2717
+ },
2718
+ messages: {
2719
+ noHelperFunction: "Helper functions must not be defined in hook files. Extract to a separate utility file."
2720
+ },
2721
+ schema: []
2722
+ },
2723
+ defaultOptions: [],
2724
+ create(context) {
2725
+ function isAtProgramLevel(node) {
2726
+ const { parent } = node;
2727
+ if (parent === void 0) return false;
2728
+ if (parent.type === import_utils43.AST_NODE_TYPES.Program) return true;
2729
+ if (parent.type !== import_utils43.AST_NODE_TYPES.ExportNamedDeclaration) return false;
2730
+ return parent.parent?.type === import_utils43.AST_NODE_TYPES.Program;
2731
+ }
2732
+ return {
2733
+ FunctionDeclaration(node) {
2734
+ if (!isAtProgramLevel(node)) return;
2735
+ if (node.id !== null && node.id.name.startsWith("use")) return;
2736
+ context.report({ node, messageId: "noHelperFunction" });
2737
+ },
2738
+ VariableDeclarator(node) {
2739
+ if (node.parent.type !== import_utils43.AST_NODE_TYPES.VariableDeclaration) return;
2740
+ if (!isAtProgramLevel(node.parent)) return;
2741
+ if (node.init === null || node.init.type !== import_utils43.AST_NODE_TYPES.ArrowFunctionExpression && node.init.type !== import_utils43.AST_NODE_TYPES.FunctionExpression)
2742
+ return;
2743
+ if (node.id.type === import_utils43.AST_NODE_TYPES.Identifier && node.id.name.startsWith("use")) return;
2744
+ context.report({ node, messageId: "noHelperFunction" });
2745
+ }
2746
+ };
2747
+ }
2748
+ });
2749
+ var no_helper_function_in_hook_default = noHelperFunctionInHook;
2750
+
2751
+ // src/rules/no-helper-function-in-test.ts
2752
+ var import_utils44 = require("@typescript-eslint/utils");
2753
+ var createRule36 = import_utils44.ESLintUtils.RuleCreator(
2754
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2755
+ );
2756
+ var noHelperFunctionInTest = createRule36({
2757
+ name: "no-helper-function-in-test",
2758
+ meta: {
2759
+ type: "suggestion",
2760
+ docs: {
2761
+ description: "Disallow helper function definitions in test files"
2762
+ },
2763
+ messages: {
2764
+ noHelperFunction: "Helper functions must not be defined in test files. Extract to a separate utility file."
2765
+ },
2766
+ schema: []
2767
+ },
2768
+ defaultOptions: [],
2769
+ create(context) {
2770
+ return {
2771
+ FunctionDeclaration(node) {
2772
+ if (node.parent.type === import_utils44.AST_NODE_TYPES.Program) {
2773
+ context.report({ node, messageId: "noHelperFunction" });
2774
+ }
2775
+ },
2776
+ VariableDeclarator(node) {
2777
+ if (node.parent.type === import_utils44.AST_NODE_TYPES.VariableDeclaration && node.parent.parent.type === import_utils44.AST_NODE_TYPES.Program && node.init !== null && (node.init.type === import_utils44.AST_NODE_TYPES.ArrowFunctionExpression || node.init.type === import_utils44.AST_NODE_TYPES.FunctionExpression)) {
2778
+ context.report({ node, messageId: "noHelperFunction" });
2779
+ }
2780
+ }
2781
+ };
2782
+ }
2783
+ });
2784
+ var no_helper_function_in_test_default = noHelperFunctionInTest;
2785
+
2158
2786
  // src/rules/no-inline-default-export.ts
2159
- var import_utils33 = require("@typescript-eslint/utils");
2160
- var createRule29 = import_utils33.ESLintUtils.RuleCreator(
2787
+ var import_utils45 = require("@typescript-eslint/utils");
2788
+ var createRule37 = import_utils45.ESLintUtils.RuleCreator(
2161
2789
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2162
2790
  );
2163
- var noInlineDefaultExport = createRule29({
2791
+ var noInlineDefaultExport = createRule37({
2164
2792
  name: "no-inline-default-export",
2165
2793
  meta: {
2166
2794
  type: "suggestion",
@@ -2179,7 +2807,7 @@ var noInlineDefaultExport = createRule29({
2179
2807
  return {
2180
2808
  ExportDefaultDeclaration(node) {
2181
2809
  const { declaration } = node;
2182
- if (declaration.type === import_utils33.AST_NODE_TYPES.FunctionDeclaration) {
2810
+ if (declaration.type === import_utils45.AST_NODE_TYPES.FunctionDeclaration) {
2183
2811
  if (declaration.id) {
2184
2812
  context.report({
2185
2813
  node,
@@ -2194,7 +2822,7 @@ var noInlineDefaultExport = createRule29({
2194
2822
  });
2195
2823
  }
2196
2824
  }
2197
- if (declaration.type === import_utils33.AST_NODE_TYPES.ClassDeclaration) {
2825
+ if (declaration.type === import_utils45.AST_NODE_TYPES.ClassDeclaration) {
2198
2826
  if (declaration.id) {
2199
2827
  context.report({
2200
2828
  node,
@@ -2209,7 +2837,7 @@ var noInlineDefaultExport = createRule29({
2209
2837
  });
2210
2838
  }
2211
2839
  }
2212
- if (declaration.type === import_utils33.AST_NODE_TYPES.ArrowFunctionExpression || declaration.type === import_utils33.AST_NODE_TYPES.FunctionExpression) {
2840
+ if (declaration.type === import_utils45.AST_NODE_TYPES.ArrowFunctionExpression || declaration.type === import_utils45.AST_NODE_TYPES.FunctionExpression) {
2213
2841
  context.report({
2214
2842
  node,
2215
2843
  messageId: "noAnonymousDefaultExport",
@@ -2222,14 +2850,14 @@ var noInlineDefaultExport = createRule29({
2222
2850
  if (!declaration) {
2223
2851
  return;
2224
2852
  }
2225
- if (declaration.type === import_utils33.AST_NODE_TYPES.FunctionDeclaration && declaration.id) {
2853
+ if (declaration.type === import_utils45.AST_NODE_TYPES.FunctionDeclaration && declaration.id) {
2226
2854
  context.report({
2227
2855
  node,
2228
2856
  messageId: "noInlineNamedExport",
2229
2857
  data: { type: "function", name: declaration.id.name }
2230
2858
  });
2231
2859
  }
2232
- if (declaration.type === import_utils33.AST_NODE_TYPES.ClassDeclaration && declaration.id) {
2860
+ if (declaration.type === import_utils45.AST_NODE_TYPES.ClassDeclaration && declaration.id) {
2233
2861
  context.report({
2234
2862
  node,
2235
2863
  messageId: "noInlineNamedExport",
@@ -2243,27 +2871,27 @@ var noInlineDefaultExport = createRule29({
2243
2871
  var no_inline_default_export_default = noInlineDefaultExport;
2244
2872
 
2245
2873
  // src/rules/no-inline-nested-object.ts
2246
- var import_utils34 = require("@typescript-eslint/utils");
2247
- var createRule30 = import_utils34.ESLintUtils.RuleCreator(
2874
+ var import_utils46 = require("@typescript-eslint/utils");
2875
+ var createRule38 = import_utils46.ESLintUtils.RuleCreator(
2248
2876
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2249
2877
  );
2250
2878
  function isObjectOrArray(node) {
2251
- return node.type === import_utils34.AST_NODE_TYPES.ObjectExpression || node.type === import_utils34.AST_NODE_TYPES.ArrayExpression || node.type === import_utils34.AST_NODE_TYPES.TSAsExpression;
2879
+ return node.type === import_utils46.AST_NODE_TYPES.ObjectExpression || node.type === import_utils46.AST_NODE_TYPES.ArrayExpression || node.type === import_utils46.AST_NODE_TYPES.TSAsExpression;
2252
2880
  }
2253
2881
  function getInnerExpression(node) {
2254
- if (node.type === import_utils34.AST_NODE_TYPES.TSAsExpression) {
2882
+ if (node.type === import_utils46.AST_NODE_TYPES.TSAsExpression) {
2255
2883
  return getInnerExpression(node.expression);
2256
2884
  }
2257
2885
  return node;
2258
2886
  }
2259
2887
  function isNestedStructure(node) {
2260
2888
  const inner = getInnerExpression(node);
2261
- return inner.type === import_utils34.AST_NODE_TYPES.ObjectExpression || inner.type === import_utils34.AST_NODE_TYPES.ArrayExpression;
2889
+ return inner.type === import_utils46.AST_NODE_TYPES.ObjectExpression || inner.type === import_utils46.AST_NODE_TYPES.ArrayExpression;
2262
2890
  }
2263
2891
  function containsNestedStructure(node) {
2264
- if (node.type === import_utils34.AST_NODE_TYPES.ObjectExpression) {
2892
+ if (node.type === import_utils46.AST_NODE_TYPES.ObjectExpression) {
2265
2893
  return node.properties.some((prop) => {
2266
- if (prop.type !== import_utils34.AST_NODE_TYPES.Property) return false;
2894
+ if (prop.type !== import_utils46.AST_NODE_TYPES.Property) return false;
2267
2895
  return isNestedStructure(prop.value);
2268
2896
  });
2269
2897
  }
@@ -2272,7 +2900,7 @@ function containsNestedStructure(node) {
2272
2900
  return isNestedStructure(el);
2273
2901
  });
2274
2902
  }
2275
- var noInlineNestedObject = createRule30({
2903
+ var noInlineNestedObject = createRule38({
2276
2904
  name: "no-inline-nested-object",
2277
2905
  meta: {
2278
2906
  type: "layout",
@@ -2294,7 +2922,7 @@ var noInlineNestedObject = createRule30({
2294
2922
  return;
2295
2923
  }
2296
2924
  const valueNode = getInnerExpression(node.value);
2297
- if (valueNode.type !== import_utils34.AST_NODE_TYPES.ObjectExpression && valueNode.type !== import_utils34.AST_NODE_TYPES.ArrayExpression) {
2925
+ if (valueNode.type !== import_utils46.AST_NODE_TYPES.ObjectExpression && valueNode.type !== import_utils46.AST_NODE_TYPES.ArrayExpression) {
2298
2926
  return;
2299
2927
  }
2300
2928
  if (!valueNode.loc) {
@@ -2307,7 +2935,7 @@ var noInlineNestedObject = createRule30({
2307
2935
  if (!containsNestedStructure(valueNode)) {
2308
2936
  return;
2309
2937
  }
2310
- const elements = valueNode.type === import_utils34.AST_NODE_TYPES.ObjectExpression ? valueNode.properties : valueNode.elements;
2938
+ const elements = valueNode.type === import_utils46.AST_NODE_TYPES.ObjectExpression ? valueNode.properties : valueNode.elements;
2311
2939
  context.report({
2312
2940
  node: valueNode,
2313
2941
  messageId: "requireMultiline",
@@ -2320,7 +2948,7 @@ var noInlineNestedObject = createRule30({
2320
2948
  const indent = " ".repeat(node.loc?.start.column ?? 0);
2321
2949
  const innerIndent = `${indent} `;
2322
2950
  const elementTexts = elements.filter((el) => el !== null).map((el) => sourceCode.getText(el));
2323
- const isObject = valueNode.type === import_utils34.AST_NODE_TYPES.ObjectExpression;
2951
+ const isObject = valueNode.type === import_utils46.AST_NODE_TYPES.ObjectExpression;
2324
2952
  const openChar = isObject ? "{" : "[";
2325
2953
  const closeChar = isObject ? "}" : "]";
2326
2954
  const formattedElements = elementTexts.map((text) => `${innerIndent}${text},`).join("\n");
@@ -2337,20 +2965,20 @@ ${indent}${closeChar}`;
2337
2965
  var no_inline_nested_object_default = noInlineNestedObject;
2338
2966
 
2339
2967
  // src/rules/no-inline-return-properties.ts
2340
- var import_utils35 = require("@typescript-eslint/utils");
2341
- var createRule31 = import_utils35.ESLintUtils.RuleCreator(
2968
+ var import_utils47 = require("@typescript-eslint/utils");
2969
+ var createRule39 = import_utils47.ESLintUtils.RuleCreator(
2342
2970
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2343
2971
  );
2344
2972
  var isShorthandProperty = (property) => {
2345
- if (property.type === import_utils35.AST_NODE_TYPES.SpreadElement) {
2973
+ if (property.type === import_utils47.AST_NODE_TYPES.SpreadElement) {
2346
2974
  return true;
2347
2975
  }
2348
- if (property.type !== import_utils35.AST_NODE_TYPES.Property) {
2976
+ if (property.type !== import_utils47.AST_NODE_TYPES.Property) {
2349
2977
  return false;
2350
2978
  }
2351
2979
  return property.shorthand;
2352
2980
  };
2353
- var noInlineReturnProperties = createRule31({
2981
+ var noInlineReturnProperties = createRule39({
2354
2982
  name: "no-inline-return-properties",
2355
2983
  meta: {
2356
2984
  type: "suggestion",
@@ -2366,20 +2994,20 @@ var noInlineReturnProperties = createRule31({
2366
2994
  create(context) {
2367
2995
  return {
2368
2996
  ReturnStatement(node) {
2369
- if (!node.argument || node.argument.type !== import_utils35.AST_NODE_TYPES.ObjectExpression) {
2997
+ if (!node.argument || node.argument.type !== import_utils47.AST_NODE_TYPES.ObjectExpression) {
2370
2998
  return;
2371
2999
  }
2372
3000
  node.argument.properties.forEach((property) => {
2373
3001
  if (isShorthandProperty(property)) {
2374
3002
  return;
2375
3003
  }
2376
- if (property.type !== import_utils35.AST_NODE_TYPES.Property) {
3004
+ if (property.type !== import_utils47.AST_NODE_TYPES.Property) {
2377
3005
  return;
2378
3006
  }
2379
3007
  let keyName = null;
2380
- if (property.key.type === import_utils35.AST_NODE_TYPES.Identifier) {
3008
+ if (property.key.type === import_utils47.AST_NODE_TYPES.Identifier) {
2381
3009
  keyName = property.key.name;
2382
- } else if (property.key.type === import_utils35.AST_NODE_TYPES.Literal) {
3010
+ } else if (property.key.type === import_utils47.AST_NODE_TYPES.Literal) {
2383
3011
  keyName = String(property.key.value);
2384
3012
  }
2385
3013
  context.report({
@@ -2395,12 +3023,12 @@ var noInlineReturnProperties = createRule31({
2395
3023
  var no_inline_return_properties_default = noInlineReturnProperties;
2396
3024
 
2397
3025
  // src/rules/no-inline-type-import.ts
2398
- var import_utils36 = require("@typescript-eslint/utils");
2399
- var createRule32 = import_utils36.ESLintUtils.RuleCreator(
3026
+ var import_utils48 = require("@typescript-eslint/utils");
3027
+ var createRule40 = import_utils48.ESLintUtils.RuleCreator(
2400
3028
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2401
3029
  );
2402
- var isInlineTypeSpecifier = (specifier) => specifier.type === import_utils36.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type";
2403
- var noInlineTypeImport = createRule32({
3030
+ var isInlineTypeSpecifier = (specifier) => specifier.type === import_utils48.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type";
3031
+ var noInlineTypeImport = createRule40({
2404
3032
  name: "no-inline-type-import",
2405
3033
  meta: {
2406
3034
  type: "suggestion",
@@ -2437,7 +3065,7 @@ var noInlineTypeImport = createRule32({
2437
3065
  );
2438
3066
  const typeImport = `import type { ${typeSpecifierTexts.join(", ")} } from ${sourceText};`;
2439
3067
  const valueSpecifiers = node.specifiers.filter(
2440
- (specifier) => !(specifier.type === import_utils36.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type")
3068
+ (specifier) => !(specifier.type === import_utils48.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type")
2441
3069
  );
2442
3070
  if (valueSpecifiers.length === 0) {
2443
3071
  return fixer.replaceText(node, typeImport);
@@ -2445,11 +3073,11 @@ var noInlineTypeImport = createRule32({
2445
3073
  const parts = [];
2446
3074
  const namedValueSpecifiers = [];
2447
3075
  for (const specifier of valueSpecifiers) {
2448
- if (specifier.type === import_utils36.AST_NODE_TYPES.ImportDefaultSpecifier) {
3076
+ if (specifier.type === import_utils48.AST_NODE_TYPES.ImportDefaultSpecifier) {
2449
3077
  parts.push(specifier.local.name);
2450
- } else if (specifier.type === import_utils36.AST_NODE_TYPES.ImportNamespaceSpecifier) {
3078
+ } else if (specifier.type === import_utils48.AST_NODE_TYPES.ImportNamespaceSpecifier) {
2451
3079
  parts.push(`* as ${specifier.local.name}`);
2452
- } else if (specifier.type === import_utils36.AST_NODE_TYPES.ImportSpecifier) {
3080
+ } else if (specifier.type === import_utils48.AST_NODE_TYPES.ImportSpecifier) {
2453
3081
  namedValueSpecifiers.push(specifier);
2454
3082
  }
2455
3083
  }
@@ -2469,8 +3097,8 @@ ${typeImport}`);
2469
3097
  var no_inline_type_import_default = noInlineTypeImport;
2470
3098
 
2471
3099
  // src/rules/no-lazy-identifiers.ts
2472
- var import_utils37 = require("@typescript-eslint/utils");
2473
- var createRule33 = import_utils37.ESLintUtils.RuleCreator(
3100
+ var import_utils49 = require("@typescript-eslint/utils");
3101
+ var createRule41 = import_utils49.ESLintUtils.RuleCreator(
2474
3102
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2475
3103
  );
2476
3104
  var KEYBOARD_ROWS = ["qwertyuiop", "asdfghjkl", "zxcvbnm", "1234567890"];
@@ -2511,7 +3139,7 @@ var isLazyIdentifier = (name) => {
2511
3139
  }
2512
3140
  return false;
2513
3141
  };
2514
- var noLazyIdentifiers = createRule33({
3142
+ var noLazyIdentifiers = createRule41({
2515
3143
  name: "no-lazy-identifiers",
2516
3144
  meta: {
2517
3145
  type: "problem",
@@ -2537,27 +3165,27 @@ var noLazyIdentifiers = createRule33({
2537
3165
  });
2538
3166
  };
2539
3167
  const checkPattern = (pattern) => {
2540
- if (pattern.type === import_utils37.AST_NODE_TYPES.Identifier) {
3168
+ if (pattern.type === import_utils49.AST_NODE_TYPES.Identifier) {
2541
3169
  checkIdentifier(pattern);
2542
- } else if (pattern.type === import_utils37.AST_NODE_TYPES.ObjectPattern) {
3170
+ } else if (pattern.type === import_utils49.AST_NODE_TYPES.ObjectPattern) {
2543
3171
  pattern.properties.forEach((prop) => {
2544
- if (prop.type === import_utils37.AST_NODE_TYPES.Property && prop.value.type === import_utils37.AST_NODE_TYPES.Identifier) {
3172
+ if (prop.type === import_utils49.AST_NODE_TYPES.Property && prop.value.type === import_utils49.AST_NODE_TYPES.Identifier) {
2545
3173
  checkIdentifier(prop.value);
2546
- } else if (prop.type === import_utils37.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils37.AST_NODE_TYPES.Identifier) {
3174
+ } else if (prop.type === import_utils49.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils49.AST_NODE_TYPES.Identifier) {
2547
3175
  checkIdentifier(prop.argument);
2548
3176
  }
2549
3177
  });
2550
- } else if (pattern.type === import_utils37.AST_NODE_TYPES.ArrayPattern) {
3178
+ } else if (pattern.type === import_utils49.AST_NODE_TYPES.ArrayPattern) {
2551
3179
  pattern.elements.forEach((element) => {
2552
- if (element?.type === import_utils37.AST_NODE_TYPES.Identifier) {
3180
+ if (element?.type === import_utils49.AST_NODE_TYPES.Identifier) {
2553
3181
  checkIdentifier(element);
2554
- } else if (element?.type === import_utils37.AST_NODE_TYPES.RestElement && element.argument.type === import_utils37.AST_NODE_TYPES.Identifier) {
3182
+ } else if (element?.type === import_utils49.AST_NODE_TYPES.RestElement && element.argument.type === import_utils49.AST_NODE_TYPES.Identifier) {
2555
3183
  checkIdentifier(element.argument);
2556
3184
  }
2557
3185
  });
2558
- } else if (pattern.type === import_utils37.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils37.AST_NODE_TYPES.Identifier) {
3186
+ } else if (pattern.type === import_utils49.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils49.AST_NODE_TYPES.Identifier) {
2559
3187
  checkIdentifier(pattern.left);
2560
- } else if (pattern.type === import_utils37.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils37.AST_NODE_TYPES.Identifier) {
3188
+ } else if (pattern.type === import_utils49.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils49.AST_NODE_TYPES.Identifier) {
2561
3189
  checkIdentifier(pattern.argument);
2562
3190
  }
2563
3191
  };
@@ -2602,11 +3230,11 @@ var noLazyIdentifiers = createRule33({
2602
3230
  var no_lazy_identifiers_default = noLazyIdentifiers;
2603
3231
 
2604
3232
  // src/rules/no-logic-in-params.ts
2605
- var import_utils38 = require("@typescript-eslint/utils");
2606
- var createRule34 = import_utils38.ESLintUtils.RuleCreator(
3233
+ var import_utils50 = require("@typescript-eslint/utils");
3234
+ var createRule42 = import_utils50.ESLintUtils.RuleCreator(
2607
3235
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2608
3236
  );
2609
- var noLogicInParams = createRule34({
3237
+ var noLogicInParams = createRule42({
2610
3238
  name: "no-logic-in-params",
2611
3239
  meta: {
2612
3240
  type: "suggestion",
@@ -2621,20 +3249,20 @@ var noLogicInParams = createRule34({
2621
3249
  defaultOptions: [],
2622
3250
  create(context) {
2623
3251
  const isComplexExpression = (node) => {
2624
- if (node.type === import_utils38.AST_NODE_TYPES.SpreadElement) {
3252
+ if (node.type === import_utils50.AST_NODE_TYPES.SpreadElement) {
2625
3253
  return false;
2626
3254
  }
2627
- if (node.type === import_utils38.AST_NODE_TYPES.ConditionalExpression) {
3255
+ if (node.type === import_utils50.AST_NODE_TYPES.ConditionalExpression) {
2628
3256
  return true;
2629
3257
  }
2630
- if (node.type === import_utils38.AST_NODE_TYPES.LogicalExpression) {
3258
+ if (node.type === import_utils50.AST_NODE_TYPES.LogicalExpression) {
2631
3259
  return true;
2632
3260
  }
2633
- if (node.type === import_utils38.AST_NODE_TYPES.BinaryExpression) {
3261
+ if (node.type === import_utils50.AST_NODE_TYPES.BinaryExpression) {
2634
3262
  const logicalOperators = ["==", "===", "!=", "!==", "<", ">", "<=", ">=", "in", "instanceof"];
2635
3263
  return logicalOperators.includes(node.operator);
2636
3264
  }
2637
- if (node.type === import_utils38.AST_NODE_TYPES.UnaryExpression) {
3265
+ if (node.type === import_utils50.AST_NODE_TYPES.UnaryExpression) {
2638
3266
  return node.operator === "!";
2639
3267
  }
2640
3268
  return false;
@@ -2647,7 +3275,7 @@ var noLogicInParams = createRule34({
2647
3275
  messageId: "noLogicInParams"
2648
3276
  });
2649
3277
  }
2650
- if (arg.type === import_utils38.AST_NODE_TYPES.ArrayExpression) {
3278
+ if (arg.type === import_utils50.AST_NODE_TYPES.ArrayExpression) {
2651
3279
  arg.elements.forEach((element) => {
2652
3280
  if (element && isComplexExpression(element)) {
2653
3281
  context.report({
@@ -2672,46 +3300,46 @@ var noLogicInParams = createRule34({
2672
3300
  var no_logic_in_params_default = noLogicInParams;
2673
3301
 
2674
3302
  // src/rules/no-misleading-constant-case.ts
2675
- var import_utils39 = require("@typescript-eslint/utils");
2676
- var createRule35 = import_utils39.ESLintUtils.RuleCreator(
3303
+ var import_utils51 = require("@typescript-eslint/utils");
3304
+ var createRule43 = import_utils51.ESLintUtils.RuleCreator(
2677
3305
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2678
3306
  );
2679
3307
  var SCREAMING_SNAKE_CASE_REGEX3 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
2680
- var isAsConstAssertion = (node) => node.type === import_utils39.AST_NODE_TYPES.TSAsExpression && node.typeAnnotation.type === import_utils39.AST_NODE_TYPES.TSTypeReference && node.typeAnnotation.typeName.type === import_utils39.AST_NODE_TYPES.Identifier && node.typeAnnotation.typeName.name === "const";
3308
+ var isAsConstAssertion = (node) => node.type === import_utils51.AST_NODE_TYPES.TSAsExpression && node.typeAnnotation.type === import_utils51.AST_NODE_TYPES.TSTypeReference && node.typeAnnotation.typeName.type === import_utils51.AST_NODE_TYPES.Identifier && node.typeAnnotation.typeName.name === "const";
2681
3309
  var isStaticValue2 = (init) => {
2682
3310
  if (isAsConstAssertion(init)) {
2683
3311
  return true;
2684
3312
  }
2685
- if (init.type === import_utils39.AST_NODE_TYPES.Literal) {
3313
+ if (init.type === import_utils51.AST_NODE_TYPES.Literal) {
2686
3314
  return true;
2687
3315
  }
2688
- if (init.type === import_utils39.AST_NODE_TYPES.UnaryExpression && init.argument.type === import_utils39.AST_NODE_TYPES.Literal) {
3316
+ if (init.type === import_utils51.AST_NODE_TYPES.UnaryExpression && init.argument.type === import_utils51.AST_NODE_TYPES.Literal) {
2689
3317
  return true;
2690
3318
  }
2691
- if (init.type === import_utils39.AST_NODE_TYPES.TemplateLiteral && init.expressions.length === 0) {
3319
+ if (init.type === import_utils51.AST_NODE_TYPES.TemplateLiteral && init.expressions.length === 0) {
2692
3320
  return true;
2693
3321
  }
2694
- if (init.type === import_utils39.AST_NODE_TYPES.ArrayExpression) {
2695
- return init.elements.every((el) => el !== null && el.type !== import_utils39.AST_NODE_TYPES.SpreadElement && isStaticValue2(el));
3322
+ if (init.type === import_utils51.AST_NODE_TYPES.ArrayExpression) {
3323
+ return init.elements.every((el) => el !== null && el.type !== import_utils51.AST_NODE_TYPES.SpreadElement && isStaticValue2(el));
2696
3324
  }
2697
- if (init.type === import_utils39.AST_NODE_TYPES.ObjectExpression) {
3325
+ if (init.type === import_utils51.AST_NODE_TYPES.ObjectExpression) {
2698
3326
  return init.properties.every(
2699
- (prop) => prop.type === import_utils39.AST_NODE_TYPES.Property && isStaticValue2(prop.value)
3327
+ (prop) => prop.type === import_utils51.AST_NODE_TYPES.Property && isStaticValue2(prop.value)
2700
3328
  );
2701
3329
  }
2702
3330
  return false;
2703
3331
  };
2704
3332
  var isGlobalScope3 = (node) => {
2705
3333
  const { parent } = node;
2706
- if (parent.type === import_utils39.AST_NODE_TYPES.Program) {
3334
+ if (parent.type === import_utils51.AST_NODE_TYPES.Program) {
2707
3335
  return true;
2708
3336
  }
2709
- if (parent.type === import_utils39.AST_NODE_TYPES.ExportNamedDeclaration && parent.parent?.type === import_utils39.AST_NODE_TYPES.Program) {
3337
+ if (parent.type === import_utils51.AST_NODE_TYPES.ExportNamedDeclaration && parent.parent?.type === import_utils51.AST_NODE_TYPES.Program) {
2710
3338
  return true;
2711
3339
  }
2712
3340
  return false;
2713
3341
  };
2714
- var noMisleadingConstantCase = createRule35({
3342
+ var noMisleadingConstantCase = createRule43({
2715
3343
  name: "no-misleading-constant-case",
2716
3344
  meta: {
2717
3345
  type: "suggestion",
@@ -2730,7 +3358,7 @@ var noMisleadingConstantCase = createRule35({
2730
3358
  return {
2731
3359
  VariableDeclaration(node) {
2732
3360
  node.declarations.forEach((declarator) => {
2733
- if (declarator.id.type !== import_utils39.AST_NODE_TYPES.Identifier) {
3361
+ if (declarator.id.type !== import_utils51.AST_NODE_TYPES.Identifier) {
2734
3362
  return;
2735
3363
  }
2736
3364
  const { name } = declarator.id;
@@ -2771,11 +3399,11 @@ var noMisleadingConstantCase = createRule35({
2771
3399
  var no_misleading_constant_case_default = noMisleadingConstantCase;
2772
3400
 
2773
3401
  // src/rules/no-nested-interface-declaration.ts
2774
- var import_utils40 = require("@typescript-eslint/utils");
2775
- var createRule36 = import_utils40.ESLintUtils.RuleCreator(
3402
+ var import_utils52 = require("@typescript-eslint/utils");
3403
+ var createRule44 = import_utils52.ESLintUtils.RuleCreator(
2776
3404
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2777
3405
  );
2778
- var noNestedInterfaceDeclaration = createRule36({
3406
+ var noNestedInterfaceDeclaration = createRule44({
2779
3407
  name: "no-nested-interface-declaration",
2780
3408
  meta: {
2781
3409
  type: "suggestion",
@@ -2796,15 +3424,15 @@ var noNestedInterfaceDeclaration = createRule36({
2796
3424
  return;
2797
3425
  }
2798
3426
  const { typeAnnotation } = node.typeAnnotation;
2799
- if (typeAnnotation.type === import_utils40.AST_NODE_TYPES.TSTypeLiteral) {
3427
+ if (typeAnnotation.type === import_utils52.AST_NODE_TYPES.TSTypeLiteral) {
2800
3428
  context.report({
2801
3429
  node: typeAnnotation,
2802
3430
  messageId: "noNestedInterface"
2803
3431
  });
2804
3432
  return;
2805
3433
  }
2806
- if (typeAnnotation.type === import_utils40.AST_NODE_TYPES.TSArrayType) {
2807
- if (typeAnnotation.elementType.type === import_utils40.AST_NODE_TYPES.TSTypeLiteral) {
3434
+ if (typeAnnotation.type === import_utils52.AST_NODE_TYPES.TSArrayType) {
3435
+ if (typeAnnotation.elementType.type === import_utils52.AST_NODE_TYPES.TSTypeLiteral) {
2808
3436
  context.report({
2809
3437
  node: typeAnnotation.elementType,
2810
3438
  messageId: "noNestedInterface"
@@ -2812,9 +3440,9 @@ var noNestedInterfaceDeclaration = createRule36({
2812
3440
  }
2813
3441
  return;
2814
3442
  }
2815
- if (typeAnnotation.type === import_utils40.AST_NODE_TYPES.TSTypeReference && typeAnnotation.typeArguments) {
3443
+ if (typeAnnotation.type === import_utils52.AST_NODE_TYPES.TSTypeReference && typeAnnotation.typeArguments) {
2816
3444
  typeAnnotation.typeArguments.params.forEach((param) => {
2817
- if (param.type === import_utils40.AST_NODE_TYPES.TSTypeLiteral) {
3445
+ if (param.type === import_utils52.AST_NODE_TYPES.TSTypeLiteral) {
2818
3446
  context.report({
2819
3447
  node: param,
2820
3448
  messageId: "noNestedInterface"
@@ -2829,11 +3457,11 @@ var noNestedInterfaceDeclaration = createRule36({
2829
3457
  var no_nested_interface_declaration_default = noNestedInterfaceDeclaration;
2830
3458
 
2831
3459
  // src/rules/no-nested-ternary.ts
2832
- var import_utils41 = require("@typescript-eslint/utils");
2833
- var createRule37 = import_utils41.ESLintUtils.RuleCreator(
3460
+ var import_utils53 = require("@typescript-eslint/utils");
3461
+ var createRule45 = import_utils53.ESLintUtils.RuleCreator(
2834
3462
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2835
3463
  );
2836
- var noNestedTernary = createRule37({
3464
+ var noNestedTernary = createRule45({
2837
3465
  name: "no-nested-ternary",
2838
3466
  meta: {
2839
3467
  type: "suggestion",
@@ -2850,13 +3478,13 @@ var noNestedTernary = createRule37({
2850
3478
  return {
2851
3479
  ConditionalExpression(node) {
2852
3480
  const { consequent, alternate } = node;
2853
- if (consequent.type === import_utils41.AST_NODE_TYPES.ConditionalExpression) {
3481
+ if (consequent.type === import_utils53.AST_NODE_TYPES.ConditionalExpression) {
2854
3482
  context.report({
2855
3483
  node: consequent,
2856
3484
  messageId: "noNestedTernary"
2857
3485
  });
2858
3486
  }
2859
- if (alternate.type === import_utils41.AST_NODE_TYPES.ConditionalExpression) {
3487
+ if (alternate.type === import_utils53.AST_NODE_TYPES.ConditionalExpression) {
2860
3488
  context.report({
2861
3489
  node: alternate,
2862
3490
  messageId: "noNestedTernary"
@@ -2869,33 +3497,33 @@ var noNestedTernary = createRule37({
2869
3497
  var no_nested_ternary_default = noNestedTernary;
2870
3498
 
2871
3499
  // src/rules/no-redundant-fragment.ts
2872
- var import_utils42 = require("@typescript-eslint/utils");
2873
- var createRule38 = import_utils42.ESLintUtils.RuleCreator(
3500
+ var import_utils54 = require("@typescript-eslint/utils");
3501
+ var createRule46 = import_utils54.ESLintUtils.RuleCreator(
2874
3502
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2875
3503
  );
2876
3504
  function isFragmentName(name) {
2877
- if (name.type === import_utils42.AST_NODE_TYPES.JSXIdentifier && name.name === "Fragment") {
3505
+ if (name.type === import_utils54.AST_NODE_TYPES.JSXIdentifier && name.name === "Fragment") {
2878
3506
  return true;
2879
3507
  }
2880
- if (name.type === import_utils42.AST_NODE_TYPES.JSXMemberExpression && name.object.type === import_utils42.AST_NODE_TYPES.JSXIdentifier && name.object.name === "React" && name.property.type === import_utils42.AST_NODE_TYPES.JSXIdentifier && name.property.name === "Fragment") {
3508
+ if (name.type === import_utils54.AST_NODE_TYPES.JSXMemberExpression && name.object.type === import_utils54.AST_NODE_TYPES.JSXIdentifier && name.object.name === "React" && name.property.type === import_utils54.AST_NODE_TYPES.JSXIdentifier && name.property.name === "Fragment") {
2881
3509
  return true;
2882
3510
  }
2883
3511
  return false;
2884
3512
  }
2885
3513
  function hasKeyAttribute(attributes) {
2886
3514
  return attributes.some(
2887
- (attribute) => attribute.type === import_utils42.AST_NODE_TYPES.JSXAttribute && attribute.name.type === import_utils42.AST_NODE_TYPES.JSXIdentifier && attribute.name.name === "key"
3515
+ (attribute) => attribute.type === import_utils54.AST_NODE_TYPES.JSXAttribute && attribute.name.type === import_utils54.AST_NODE_TYPES.JSXIdentifier && attribute.name.name === "key"
2888
3516
  );
2889
3517
  }
2890
3518
  function countMeaningfulChildren(children) {
2891
3519
  return children.filter((child) => {
2892
- if (child.type === import_utils42.AST_NODE_TYPES.JSXText) {
3520
+ if (child.type === import_utils54.AST_NODE_TYPES.JSXText) {
2893
3521
  return child.value.trim() !== "";
2894
3522
  }
2895
3523
  return true;
2896
3524
  }).length;
2897
3525
  }
2898
- var noRedundantFragment = createRule38({
3526
+ var noRedundantFragment = createRule46({
2899
3527
  name: "no-redundant-fragment",
2900
3528
  meta: {
2901
3529
  type: "problem",
@@ -2943,11 +3571,11 @@ var noRedundantFragment = createRule38({
2943
3571
  var no_redundant_fragment_default = noRedundantFragment;
2944
3572
 
2945
3573
  // src/rules/no-relative-imports.ts
2946
- var import_utils43 = require("@typescript-eslint/utils");
2947
- var createRule39 = import_utils43.ESLintUtils.RuleCreator(
3574
+ var import_utils55 = require("@typescript-eslint/utils");
3575
+ var createRule47 = import_utils55.ESLintUtils.RuleCreator(
2948
3576
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2949
3577
  );
2950
- var noRelativeImports = createRule39({
3578
+ var noRelativeImports = createRule47({
2951
3579
  name: "no-relative-imports",
2952
3580
  meta: {
2953
3581
  type: "suggestion",
@@ -2971,22 +3599,22 @@ var noRelativeImports = createRule39({
2971
3599
  };
2972
3600
  return {
2973
3601
  ImportDeclaration(node) {
2974
- if (node.source.type === import_utils43.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
3602
+ if (node.source.type === import_utils55.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
2975
3603
  checkImportPath(node.source.value, node);
2976
3604
  }
2977
3605
  },
2978
3606
  ImportExpression(node) {
2979
- if (node.source.type === import_utils43.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
3607
+ if (node.source.type === import_utils55.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
2980
3608
  checkImportPath(node.source.value, node);
2981
3609
  }
2982
3610
  },
2983
3611
  ExportNamedDeclaration(node) {
2984
- if (node.source?.type === import_utils43.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
3612
+ if (node.source?.type === import_utils55.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
2985
3613
  checkImportPath(node.source.value, node);
2986
3614
  }
2987
3615
  },
2988
3616
  ExportAllDeclaration(node) {
2989
- if (node.source.type === import_utils43.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
3617
+ if (node.source.type === import_utils55.AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
2990
3618
  checkImportPath(node.source.value, node);
2991
3619
  }
2992
3620
  }
@@ -2996,8 +3624,8 @@ var noRelativeImports = createRule39({
2996
3624
  var no_relative_imports_default = noRelativeImports;
2997
3625
 
2998
3626
  // src/rules/no-single-char-variables.ts
2999
- var import_utils44 = require("@typescript-eslint/utils");
3000
- var createRule40 = import_utils44.ESLintUtils.RuleCreator(
3627
+ var import_utils56 = require("@typescript-eslint/utils");
3628
+ var createRule48 = import_utils56.ESLintUtils.RuleCreator(
3001
3629
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3002
3630
  );
3003
3631
  var ALLOWED_IN_FOR_LOOPS = /* @__PURE__ */ new Set(["i", "j", "k", "n"]);
@@ -3009,7 +3637,7 @@ var isForLoopInit = (node) => {
3009
3637
  if (!parentNode) {
3010
3638
  return false;
3011
3639
  }
3012
- if (parentNode.type === import_utils44.AST_NODE_TYPES.ForStatement) {
3640
+ if (parentNode.type === import_utils56.AST_NODE_TYPES.ForStatement) {
3013
3641
  const { init } = parentNode;
3014
3642
  if (init && init === current) {
3015
3643
  return true;
@@ -3028,7 +3656,7 @@ var isAllowedInContext = (name, node) => {
3028
3656
  }
3029
3657
  return false;
3030
3658
  };
3031
- var noSingleCharVariables = createRule40({
3659
+ var noSingleCharVariables = createRule48({
3032
3660
  name: "no-single-char-variables",
3033
3661
  meta: {
3034
3662
  type: "suggestion",
@@ -3057,27 +3685,27 @@ var noSingleCharVariables = createRule40({
3057
3685
  });
3058
3686
  };
3059
3687
  const checkPattern = (pattern, declarationNode) => {
3060
- if (pattern.type === import_utils44.AST_NODE_TYPES.Identifier) {
3688
+ if (pattern.type === import_utils56.AST_NODE_TYPES.Identifier) {
3061
3689
  checkIdentifier(pattern, declarationNode);
3062
- } else if (pattern.type === import_utils44.AST_NODE_TYPES.ObjectPattern) {
3690
+ } else if (pattern.type === import_utils56.AST_NODE_TYPES.ObjectPattern) {
3063
3691
  pattern.properties.forEach((prop) => {
3064
- if (prop.type === import_utils44.AST_NODE_TYPES.Property && prop.value.type === import_utils44.AST_NODE_TYPES.Identifier) {
3692
+ if (prop.type === import_utils56.AST_NODE_TYPES.Property && prop.value.type === import_utils56.AST_NODE_TYPES.Identifier) {
3065
3693
  checkIdentifier(prop.value, declarationNode);
3066
- } else if (prop.type === import_utils44.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils44.AST_NODE_TYPES.Identifier) {
3694
+ } else if (prop.type === import_utils56.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils56.AST_NODE_TYPES.Identifier) {
3067
3695
  checkIdentifier(prop.argument, declarationNode);
3068
3696
  }
3069
3697
  });
3070
- } else if (pattern.type === import_utils44.AST_NODE_TYPES.ArrayPattern) {
3698
+ } else if (pattern.type === import_utils56.AST_NODE_TYPES.ArrayPattern) {
3071
3699
  pattern.elements.forEach((element) => {
3072
- if (element?.type === import_utils44.AST_NODE_TYPES.Identifier) {
3700
+ if (element?.type === import_utils56.AST_NODE_TYPES.Identifier) {
3073
3701
  checkIdentifier(element, declarationNode);
3074
- } else if (element?.type === import_utils44.AST_NODE_TYPES.RestElement && element.argument.type === import_utils44.AST_NODE_TYPES.Identifier) {
3702
+ } else if (element?.type === import_utils56.AST_NODE_TYPES.RestElement && element.argument.type === import_utils56.AST_NODE_TYPES.Identifier) {
3075
3703
  checkIdentifier(element.argument, declarationNode);
3076
3704
  }
3077
3705
  });
3078
- } else if (pattern.type === import_utils44.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils44.AST_NODE_TYPES.Identifier) {
3706
+ } else if (pattern.type === import_utils56.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils56.AST_NODE_TYPES.Identifier) {
3079
3707
  checkIdentifier(pattern.left, declarationNode);
3080
- } else if (pattern.type === import_utils44.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils44.AST_NODE_TYPES.Identifier) {
3708
+ } else if (pattern.type === import_utils56.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils56.AST_NODE_TYPES.Identifier) {
3081
3709
  checkIdentifier(pattern.argument, declarationNode);
3082
3710
  }
3083
3711
  };
@@ -3111,11 +3739,11 @@ var noSingleCharVariables = createRule40({
3111
3739
  var no_single_char_variables_default = noSingleCharVariables;
3112
3740
 
3113
3741
  // src/rules/prefer-async-await.ts
3114
- var import_utils45 = require("@typescript-eslint/utils");
3115
- var createRule41 = import_utils45.ESLintUtils.RuleCreator(
3742
+ var import_utils57 = require("@typescript-eslint/utils");
3743
+ var createRule49 = import_utils57.ESLintUtils.RuleCreator(
3116
3744
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3117
3745
  );
3118
- var preferAsyncAwait = createRule41({
3746
+ var preferAsyncAwait = createRule49({
3119
3747
  name: "prefer-async-await",
3120
3748
  meta: {
3121
3749
  type: "suggestion",
@@ -3131,7 +3759,7 @@ var preferAsyncAwait = createRule41({
3131
3759
  create(context) {
3132
3760
  return {
3133
3761
  CallExpression(node) {
3134
- if (node.callee.type === import_utils45.AST_NODE_TYPES.MemberExpression && node.callee.property.type === import_utils45.AST_NODE_TYPES.Identifier && node.callee.property.name === "then") {
3762
+ if (node.callee.type === import_utils57.AST_NODE_TYPES.MemberExpression && node.callee.property.type === import_utils57.AST_NODE_TYPES.Identifier && node.callee.property.name === "then") {
3135
3763
  context.report({
3136
3764
  node: node.callee.property,
3137
3765
  messageId: "preferAsyncAwait"
@@ -3144,11 +3772,11 @@ var preferAsyncAwait = createRule41({
3144
3772
  var prefer_async_await_default = preferAsyncAwait;
3145
3773
 
3146
3774
  // src/rules/prefer-destructuring-params.ts
3147
- var import_utils46 = require("@typescript-eslint/utils");
3148
- var createRule42 = import_utils46.ESLintUtils.RuleCreator(
3775
+ var import_utils58 = require("@typescript-eslint/utils");
3776
+ var createRule50 = import_utils58.ESLintUtils.RuleCreator(
3149
3777
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3150
3778
  );
3151
- var preferDestructuringParams = createRule42({
3779
+ var preferDestructuringParams = createRule50({
3152
3780
  name: "prefer-destructuring-params",
3153
3781
  meta: {
3154
3782
  type: "suggestion",
@@ -3164,18 +3792,18 @@ var preferDestructuringParams = createRule42({
3164
3792
  create(context) {
3165
3793
  const isCallbackFunction2 = (node) => {
3166
3794
  const { parent } = node;
3167
- return parent?.type === import_utils46.AST_NODE_TYPES.CallExpression;
3795
+ return parent?.type === import_utils58.AST_NODE_TYPES.CallExpression;
3168
3796
  };
3169
3797
  const isDeveloperFunction = (node) => {
3170
- if (node.type === import_utils46.AST_NODE_TYPES.FunctionDeclaration) {
3798
+ if (node.type === import_utils58.AST_NODE_TYPES.FunctionDeclaration) {
3171
3799
  return true;
3172
3800
  }
3173
- if (node.type === import_utils46.AST_NODE_TYPES.FunctionExpression || node.type === import_utils46.AST_NODE_TYPES.ArrowFunctionExpression) {
3801
+ if (node.type === import_utils58.AST_NODE_TYPES.FunctionExpression || node.type === import_utils58.AST_NODE_TYPES.ArrowFunctionExpression) {
3174
3802
  if (isCallbackFunction2(node)) {
3175
3803
  return false;
3176
3804
  }
3177
3805
  const { parent } = node;
3178
- return parent?.type === import_utils46.AST_NODE_TYPES.VariableDeclarator || parent?.type === import_utils46.AST_NODE_TYPES.AssignmentExpression || parent?.type === import_utils46.AST_NODE_TYPES.Property || parent?.type === import_utils46.AST_NODE_TYPES.MethodDefinition;
3806
+ return parent?.type === import_utils58.AST_NODE_TYPES.VariableDeclarator || parent?.type === import_utils58.AST_NODE_TYPES.AssignmentExpression || parent?.type === import_utils58.AST_NODE_TYPES.Property || parent?.type === import_utils58.AST_NODE_TYPES.MethodDefinition;
3179
3807
  }
3180
3808
  return false;
3181
3809
  };
@@ -3187,7 +3815,7 @@ var preferDestructuringParams = createRule42({
3187
3815
  if (!isDeveloperFunction(node)) {
3188
3816
  return;
3189
3817
  }
3190
- if (node.type === import_utils46.AST_NODE_TYPES.FunctionDeclaration && node.id) {
3818
+ if (node.type === import_utils58.AST_NODE_TYPES.FunctionDeclaration && node.id) {
3191
3819
  const functionName = node.id.name;
3192
3820
  if (functionName.startsWith("_") || functionName.includes("$") || /^[A-Z][a-zA-Z]*$/.test(functionName)) {
3193
3821
  return;
@@ -3197,7 +3825,7 @@ var preferDestructuringParams = createRule42({
3197
3825
  return;
3198
3826
  }
3199
3827
  const hasNonDestructuredParams = node.params.some(
3200
- (param) => param.type !== import_utils46.AST_NODE_TYPES.ObjectPattern && param.type !== import_utils46.AST_NODE_TYPES.RestElement
3828
+ (param) => param.type !== import_utils58.AST_NODE_TYPES.ObjectPattern && param.type !== import_utils58.AST_NODE_TYPES.RestElement
3201
3829
  );
3202
3830
  if (hasNonDestructuredParams) {
3203
3831
  context.report({
@@ -3216,8 +3844,8 @@ var preferDestructuringParams = createRule42({
3216
3844
  var prefer_destructuring_params_default = preferDestructuringParams;
3217
3845
 
3218
3846
  // src/rules/prefer-function-declaration.ts
3219
- var import_utils47 = require("@typescript-eslint/utils");
3220
- var createRule43 = import_utils47.ESLintUtils.RuleCreator(
3847
+ var import_utils59 = require("@typescript-eslint/utils");
3848
+ var createRule51 = import_utils59.ESLintUtils.RuleCreator(
3221
3849
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3222
3850
  );
3223
3851
  var isTsFile = (filename) => filename.endsWith(".ts") && !filename.endsWith(".d.ts");
@@ -3226,33 +3854,33 @@ var isCallbackContext = (node) => {
3226
3854
  if (!parent) {
3227
3855
  return false;
3228
3856
  }
3229
- if (parent.type === import_utils47.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
3857
+ if (parent.type === import_utils59.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
3230
3858
  return true;
3231
3859
  }
3232
- if (parent.type === import_utils47.AST_NODE_TYPES.NewExpression && parent.arguments.includes(node)) {
3860
+ if (parent.type === import_utils59.AST_NODE_TYPES.NewExpression && parent.arguments.includes(node)) {
3233
3861
  return true;
3234
3862
  }
3235
- if (parent.type === import_utils47.AST_NODE_TYPES.ReturnStatement) {
3863
+ if (parent.type === import_utils59.AST_NODE_TYPES.ReturnStatement) {
3236
3864
  return true;
3237
3865
  }
3238
- if (parent.type === import_utils47.AST_NODE_TYPES.Property) {
3866
+ if (parent.type === import_utils59.AST_NODE_TYPES.Property) {
3239
3867
  return true;
3240
3868
  }
3241
- if (parent.type === import_utils47.AST_NODE_TYPES.ArrayExpression) {
3869
+ if (parent.type === import_utils59.AST_NODE_TYPES.ArrayExpression) {
3242
3870
  return true;
3243
3871
  }
3244
- if (parent.type === import_utils47.AST_NODE_TYPES.ConditionalExpression) {
3872
+ if (parent.type === import_utils59.AST_NODE_TYPES.ConditionalExpression) {
3245
3873
  return true;
3246
3874
  }
3247
- if (parent.type === import_utils47.AST_NODE_TYPES.LogicalExpression) {
3875
+ if (parent.type === import_utils59.AST_NODE_TYPES.LogicalExpression) {
3248
3876
  return true;
3249
3877
  }
3250
- if (parent.type === import_utils47.AST_NODE_TYPES.AssignmentExpression && parent.left !== node) {
3878
+ if (parent.type === import_utils59.AST_NODE_TYPES.AssignmentExpression && parent.left !== node) {
3251
3879
  return true;
3252
3880
  }
3253
3881
  return false;
3254
3882
  };
3255
- var preferFunctionDeclaration = createRule43({
3883
+ var preferFunctionDeclaration = createRule51({
3256
3884
  name: "prefer-function-declaration",
3257
3885
  meta: {
3258
3886
  type: "suggestion",
@@ -3273,14 +3901,14 @@ var preferFunctionDeclaration = createRule43({
3273
3901
  }
3274
3902
  return {
3275
3903
  VariableDeclarator(node) {
3276
- if (node.id.type !== import_utils47.AST_NODE_TYPES.Identifier) {
3904
+ if (node.id.type !== import_utils59.AST_NODE_TYPES.Identifier) {
3277
3905
  return;
3278
3906
  }
3279
3907
  const { init } = node;
3280
3908
  if (!init) {
3281
3909
  return;
3282
3910
  }
3283
- if (init.type === import_utils47.AST_NODE_TYPES.ArrowFunctionExpression) {
3911
+ if (init.type === import_utils59.AST_NODE_TYPES.ArrowFunctionExpression) {
3284
3912
  if (isCallbackContext(init)) {
3285
3913
  return;
3286
3914
  }
@@ -3290,7 +3918,7 @@ var preferFunctionDeclaration = createRule43({
3290
3918
  data: { name: node.id.name }
3291
3919
  });
3292
3920
  }
3293
- if (init.type === import_utils47.AST_NODE_TYPES.FunctionExpression) {
3921
+ if (init.type === import_utils59.AST_NODE_TYPES.FunctionExpression) {
3294
3922
  if (isCallbackContext(init)) {
3295
3923
  return;
3296
3924
  }
@@ -3307,11 +3935,11 @@ var preferFunctionDeclaration = createRule43({
3307
3935
  var prefer_function_declaration_default = preferFunctionDeclaration;
3308
3936
 
3309
3937
  // src/rules/prefer-guard-clause.ts
3310
- var import_utils48 = require("@typescript-eslint/utils");
3311
- var createRule44 = import_utils48.ESLintUtils.RuleCreator(
3938
+ var import_utils60 = require("@typescript-eslint/utils");
3939
+ var createRule52 = import_utils60.ESLintUtils.RuleCreator(
3312
3940
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3313
3941
  );
3314
- var preferGuardClause = createRule44({
3942
+ var preferGuardClause = createRule52({
3315
3943
  name: "prefer-guard-clause",
3316
3944
  meta: {
3317
3945
  type: "suggestion",
@@ -3328,8 +3956,8 @@ var preferGuardClause = createRule44({
3328
3956
  return {
3329
3957
  IfStatement(node) {
3330
3958
  const { consequent } = node;
3331
- if (consequent.type === import_utils48.AST_NODE_TYPES.BlockStatement) {
3332
- const hasNestedIf = consequent.body.some((statement) => statement.type === import_utils48.AST_NODE_TYPES.IfStatement);
3959
+ if (consequent.type === import_utils60.AST_NODE_TYPES.BlockStatement) {
3960
+ const hasNestedIf = consequent.body.some((statement) => statement.type === import_utils60.AST_NODE_TYPES.IfStatement);
3333
3961
  if (hasNestedIf && consequent.body.length === 1) {
3334
3962
  context.report({
3335
3963
  node,
@@ -3337,7 +3965,7 @@ var preferGuardClause = createRule44({
3337
3965
  });
3338
3966
  }
3339
3967
  }
3340
- if (consequent.type === import_utils48.AST_NODE_TYPES.IfStatement) {
3968
+ if (consequent.type === import_utils60.AST_NODE_TYPES.IfStatement) {
3341
3969
  context.report({
3342
3970
  node,
3343
3971
  messageId: "preferGuardClause"
@@ -3350,11 +3978,11 @@ var preferGuardClause = createRule44({
3350
3978
  var prefer_guard_clause_default = preferGuardClause;
3351
3979
 
3352
3980
  // src/rules/prefer-import-type.ts
3353
- var import_utils49 = require("@typescript-eslint/utils");
3354
- var createRule45 = import_utils49.ESLintUtils.RuleCreator(
3981
+ var import_utils61 = require("@typescript-eslint/utils");
3982
+ var createRule53 = import_utils61.ESLintUtils.RuleCreator(
3355
3983
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3356
3984
  );
3357
- var preferImportType = createRule45({
3985
+ var preferImportType = createRule53({
3358
3986
  name: "prefer-import-type",
3359
3987
  meta: {
3360
3988
  type: "suggestion",
@@ -3373,22 +4001,22 @@ var preferImportType = createRule45({
3373
4001
  let current = node;
3374
4002
  while (current) {
3375
4003
  switch (current.type) {
3376
- case import_utils49.AST_NODE_TYPES.TSTypeReference:
3377
- case import_utils49.AST_NODE_TYPES.TSTypeAnnotation:
3378
- case import_utils49.AST_NODE_TYPES.TSTypeParameterInstantiation:
3379
- case import_utils49.AST_NODE_TYPES.TSInterfaceHeritage:
3380
- case import_utils49.AST_NODE_TYPES.TSClassImplements:
3381
- case import_utils49.AST_NODE_TYPES.TSTypeQuery:
3382
- case import_utils49.AST_NODE_TYPES.TSTypeAssertion:
3383
- case import_utils49.AST_NODE_TYPES.TSAsExpression:
3384
- case import_utils49.AST_NODE_TYPES.TSSatisfiesExpression:
3385
- case import_utils49.AST_NODE_TYPES.TSTypeAliasDeclaration:
3386
- case import_utils49.AST_NODE_TYPES.TSInterfaceDeclaration:
3387
- case import_utils49.AST_NODE_TYPES.TSTypeParameter:
3388
- case import_utils49.AST_NODE_TYPES.TSQualifiedName:
4004
+ case import_utils61.AST_NODE_TYPES.TSTypeReference:
4005
+ case import_utils61.AST_NODE_TYPES.TSTypeAnnotation:
4006
+ case import_utils61.AST_NODE_TYPES.TSTypeParameterInstantiation:
4007
+ case import_utils61.AST_NODE_TYPES.TSInterfaceHeritage:
4008
+ case import_utils61.AST_NODE_TYPES.TSClassImplements:
4009
+ case import_utils61.AST_NODE_TYPES.TSTypeQuery:
4010
+ case import_utils61.AST_NODE_TYPES.TSTypeAssertion:
4011
+ case import_utils61.AST_NODE_TYPES.TSAsExpression:
4012
+ case import_utils61.AST_NODE_TYPES.TSSatisfiesExpression:
4013
+ case import_utils61.AST_NODE_TYPES.TSTypeAliasDeclaration:
4014
+ case import_utils61.AST_NODE_TYPES.TSInterfaceDeclaration:
4015
+ case import_utils61.AST_NODE_TYPES.TSTypeParameter:
4016
+ case import_utils61.AST_NODE_TYPES.TSQualifiedName:
3389
4017
  return true;
3390
- case import_utils49.AST_NODE_TYPES.MemberExpression:
3391
- case import_utils49.AST_NODE_TYPES.Identifier:
4018
+ case import_utils61.AST_NODE_TYPES.MemberExpression:
4019
+ case import_utils61.AST_NODE_TYPES.Identifier:
3392
4020
  current = current.parent;
3393
4021
  break;
3394
4022
  default:
@@ -3418,27 +4046,27 @@ var preferImportType = createRule45({
3418
4046
  return false;
3419
4047
  }
3420
4048
  switch (parent.type) {
3421
- case import_utils49.AST_NODE_TYPES.CallExpression:
3422
- case import_utils49.AST_NODE_TYPES.NewExpression:
3423
- case import_utils49.AST_NODE_TYPES.JSXOpeningElement:
3424
- case import_utils49.AST_NODE_TYPES.JSXClosingElement:
3425
- case import_utils49.AST_NODE_TYPES.MemberExpression:
3426
- case import_utils49.AST_NODE_TYPES.VariableDeclarator:
3427
- case import_utils49.AST_NODE_TYPES.TaggedTemplateExpression:
3428
- case import_utils49.AST_NODE_TYPES.SpreadElement:
3429
- case import_utils49.AST_NODE_TYPES.ExportSpecifier:
3430
- case import_utils49.AST_NODE_TYPES.ArrayExpression:
3431
- case import_utils49.AST_NODE_TYPES.ObjectExpression:
3432
- case import_utils49.AST_NODE_TYPES.BinaryExpression:
3433
- case import_utils49.AST_NODE_TYPES.LogicalExpression:
3434
- case import_utils49.AST_NODE_TYPES.UnaryExpression:
3435
- case import_utils49.AST_NODE_TYPES.ReturnStatement:
3436
- case import_utils49.AST_NODE_TYPES.ArrowFunctionExpression:
3437
- case import_utils49.AST_NODE_TYPES.ConditionalExpression:
3438
- case import_utils49.AST_NODE_TYPES.AwaitExpression:
3439
- case import_utils49.AST_NODE_TYPES.YieldExpression:
3440
- case import_utils49.AST_NODE_TYPES.Property:
3441
- case import_utils49.AST_NODE_TYPES.JSXExpressionContainer:
4049
+ case import_utils61.AST_NODE_TYPES.CallExpression:
4050
+ case import_utils61.AST_NODE_TYPES.NewExpression:
4051
+ case import_utils61.AST_NODE_TYPES.JSXOpeningElement:
4052
+ case import_utils61.AST_NODE_TYPES.JSXClosingElement:
4053
+ case import_utils61.AST_NODE_TYPES.MemberExpression:
4054
+ case import_utils61.AST_NODE_TYPES.VariableDeclarator:
4055
+ case import_utils61.AST_NODE_TYPES.TaggedTemplateExpression:
4056
+ case import_utils61.AST_NODE_TYPES.SpreadElement:
4057
+ case import_utils61.AST_NODE_TYPES.ExportSpecifier:
4058
+ case import_utils61.AST_NODE_TYPES.ArrayExpression:
4059
+ case import_utils61.AST_NODE_TYPES.ObjectExpression:
4060
+ case import_utils61.AST_NODE_TYPES.BinaryExpression:
4061
+ case import_utils61.AST_NODE_TYPES.LogicalExpression:
4062
+ case import_utils61.AST_NODE_TYPES.UnaryExpression:
4063
+ case import_utils61.AST_NODE_TYPES.ReturnStatement:
4064
+ case import_utils61.AST_NODE_TYPES.ArrowFunctionExpression:
4065
+ case import_utils61.AST_NODE_TYPES.ConditionalExpression:
4066
+ case import_utils61.AST_NODE_TYPES.AwaitExpression:
4067
+ case import_utils61.AST_NODE_TYPES.YieldExpression:
4068
+ case import_utils61.AST_NODE_TYPES.Property:
4069
+ case import_utils61.AST_NODE_TYPES.JSXExpressionContainer:
3442
4070
  return true;
3443
4071
  default:
3444
4072
  return false;
@@ -3450,7 +4078,7 @@ var preferImportType = createRule45({
3450
4078
  return;
3451
4079
  }
3452
4080
  const hasInlineTypeSpecifier = node.specifiers.some(
3453
- (specifier) => specifier.type === import_utils49.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type"
4081
+ (specifier) => specifier.type === import_utils61.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type"
3454
4082
  );
3455
4083
  if (hasInlineTypeSpecifier) {
3456
4084
  return;
@@ -3468,13 +4096,13 @@ var preferImportType = createRule45({
3468
4096
  }
3469
4097
  const scope = context.sourceCode.getScope(node);
3470
4098
  const isTypeOnlyImport2 = node.specifiers.every((specifier) => {
3471
- if (specifier.type === import_utils49.AST_NODE_TYPES.ImportDefaultSpecifier) {
4099
+ if (specifier.type === import_utils61.AST_NODE_TYPES.ImportDefaultSpecifier) {
3472
4100
  return false;
3473
4101
  }
3474
- if (specifier.type === import_utils49.AST_NODE_TYPES.ImportNamespaceSpecifier) {
4102
+ if (specifier.type === import_utils61.AST_NODE_TYPES.ImportNamespaceSpecifier) {
3475
4103
  return false;
3476
4104
  }
3477
- if (specifier.type === import_utils49.AST_NODE_TYPES.ImportSpecifier) {
4105
+ if (specifier.type === import_utils61.AST_NODE_TYPES.ImportSpecifier) {
3478
4106
  const localName = specifier.local.name;
3479
4107
  return !isUsedAsValue(localName, scope);
3480
4108
  }
@@ -3500,19 +4128,19 @@ var preferImportType = createRule45({
3500
4128
  var prefer_import_type_default = preferImportType;
3501
4129
 
3502
4130
  // src/rules/prefer-inline-literal-union.ts
3503
- var import_utils50 = require("@typescript-eslint/utils");
3504
- var createRule46 = import_utils50.ESLintUtils.RuleCreator(
4131
+ var import_utils62 = require("@typescript-eslint/utils");
4132
+ var createRule54 = import_utils62.ESLintUtils.RuleCreator(
3505
4133
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3506
4134
  );
3507
4135
  function isLiteralUnionType(node) {
3508
- if (node.type !== import_utils50.AST_NODE_TYPES.TSUnionType) {
4136
+ if (node.type !== import_utils62.AST_NODE_TYPES.TSUnionType) {
3509
4137
  return false;
3510
4138
  }
3511
4139
  return node.types.every(
3512
- (member) => member.type === import_utils50.AST_NODE_TYPES.TSLiteralType || member.type === import_utils50.AST_NODE_TYPES.TSNullKeyword || member.type === import_utils50.AST_NODE_TYPES.TSUndefinedKeyword
4140
+ (member) => member.type === import_utils62.AST_NODE_TYPES.TSLiteralType || member.type === import_utils62.AST_NODE_TYPES.TSNullKeyword || member.type === import_utils62.AST_NODE_TYPES.TSUndefinedKeyword
3513
4141
  );
3514
4142
  }
3515
- var preferInlineLiteralUnion = createRule46({
4143
+ var preferInlineLiteralUnion = createRule54({
3516
4144
  name: "prefer-inline-literal-union",
3517
4145
  meta: {
3518
4146
  type: "suggestion",
@@ -3539,10 +4167,10 @@ var preferInlineLiteralUnion = createRule46({
3539
4167
  return;
3540
4168
  }
3541
4169
  const { typeAnnotation } = node.typeAnnotation;
3542
- if (typeAnnotation.type !== import_utils50.AST_NODE_TYPES.TSTypeReference) {
4170
+ if (typeAnnotation.type !== import_utils62.AST_NODE_TYPES.TSTypeReference) {
3543
4171
  return;
3544
4172
  }
3545
- if (typeAnnotation.typeName.type !== import_utils50.AST_NODE_TYPES.Identifier) {
4173
+ if (typeAnnotation.typeName.type !== import_utils62.AST_NODE_TYPES.Identifier) {
3546
4174
  return;
3547
4175
  }
3548
4176
  const aliasName = typeAnnotation.typeName.name;
@@ -3566,12 +4194,12 @@ var preferInlineLiteralUnion = createRule46({
3566
4194
  var prefer_inline_literal_union_default = preferInlineLiteralUnion;
3567
4195
 
3568
4196
  // src/rules/prefer-inline-type-export.ts
3569
- var import_utils51 = require("@typescript-eslint/utils");
3570
- var createRule47 = import_utils51.ESLintUtils.RuleCreator(
4197
+ var import_utils63 = require("@typescript-eslint/utils");
4198
+ var createRule55 = import_utils63.ESLintUtils.RuleCreator(
3571
4199
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3572
4200
  );
3573
- var isTypeDeclaration = (node) => node.type === import_utils51.AST_NODE_TYPES.TSInterfaceDeclaration || node.type === import_utils51.AST_NODE_TYPES.TSTypeAliasDeclaration;
3574
- var preferInlineTypeExport = createRule47({
4201
+ var isTypeDeclaration = (node) => node.type === import_utils63.AST_NODE_TYPES.TSInterfaceDeclaration || node.type === import_utils63.AST_NODE_TYPES.TSTypeAliasDeclaration;
4202
+ var preferInlineTypeExport = createRule55({
3575
4203
  name: "prefer-inline-type-export",
3576
4204
  meta: {
3577
4205
  type: "suggestion",
@@ -3588,12 +4216,12 @@ var preferInlineTypeExport = createRule47({
3588
4216
  create(context) {
3589
4217
  const typeDeclarations = /* @__PURE__ */ new Map();
3590
4218
  function collectDeclaration(node) {
3591
- if (node.parent.type !== import_utils51.AST_NODE_TYPES.ExportNamedDeclaration) {
4219
+ if (node.parent.type !== import_utils63.AST_NODE_TYPES.ExportNamedDeclaration) {
3592
4220
  typeDeclarations.set(node.id.name, node);
3593
4221
  }
3594
4222
  }
3595
4223
  function reportSpecifier(specifier, statement, declarationNode) {
3596
- if (specifier.local.type !== import_utils51.AST_NODE_TYPES.Identifier) {
4224
+ if (specifier.local.type !== import_utils63.AST_NODE_TYPES.Identifier) {
3597
4225
  return;
3598
4226
  }
3599
4227
  const { name } = specifier.local;
@@ -3626,16 +4254,16 @@ var preferInlineTypeExport = createRule47({
3626
4254
  return {
3627
4255
  Program(node) {
3628
4256
  node.body.forEach((statement) => {
3629
- if (statement.type === import_utils51.AST_NODE_TYPES.TSInterfaceDeclaration || statement.type === import_utils51.AST_NODE_TYPES.TSTypeAliasDeclaration) {
4257
+ if (statement.type === import_utils63.AST_NODE_TYPES.TSInterfaceDeclaration || statement.type === import_utils63.AST_NODE_TYPES.TSTypeAliasDeclaration) {
3630
4258
  collectDeclaration(statement);
3631
4259
  }
3632
4260
  });
3633
4261
  node.body.forEach((statement) => {
3634
- if (statement.type !== import_utils51.AST_NODE_TYPES.ExportNamedDeclaration || statement.declaration !== null) {
4262
+ if (statement.type !== import_utils63.AST_NODE_TYPES.ExportNamedDeclaration || statement.declaration !== null) {
3635
4263
  return;
3636
4264
  }
3637
4265
  statement.specifiers.forEach((specifier) => {
3638
- if (specifier.local.type !== import_utils51.AST_NODE_TYPES.Identifier) {
4266
+ if (specifier.local.type !== import_utils63.AST_NODE_TYPES.Identifier) {
3639
4267
  return;
3640
4268
  }
3641
4269
  const declarationNode = typeDeclarations.get(specifier.local.name);
@@ -3652,11 +4280,11 @@ var preferInlineTypeExport = createRule47({
3652
4280
  var prefer_inline_type_export_default = preferInlineTypeExport;
3653
4281
 
3654
4282
  // src/rules/prefer-interface-for-component-props.ts
3655
- var import_utils52 = require("@typescript-eslint/utils");
3656
- var createRule48 = import_utils52.ESLintUtils.RuleCreator(
4283
+ var import_utils64 = require("@typescript-eslint/utils");
4284
+ var createRule56 = import_utils64.ESLintUtils.RuleCreator(
3657
4285
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3658
4286
  );
3659
- var preferInterfaceForComponentProps = createRule48({
4287
+ var preferInterfaceForComponentProps = createRule56({
3660
4288
  name: "prefer-interface-for-component-props",
3661
4289
  meta: {
3662
4290
  type: "suggestion",
@@ -3676,13 +4304,13 @@ var preferInterfaceForComponentProps = createRule48({
3676
4304
  }
3677
4305
  return {
3678
4306
  TSTypeAliasDeclaration(node) {
3679
- if (node.id.type !== import_utils52.AST_NODE_TYPES.Identifier) {
4307
+ if (node.id.type !== import_utils64.AST_NODE_TYPES.Identifier) {
3680
4308
  return;
3681
4309
  }
3682
4310
  if (!node.id.name.endsWith("Props")) {
3683
4311
  return;
3684
4312
  }
3685
- if (node.typeAnnotation.type !== import_utils52.AST_NODE_TYPES.TSTypeLiteral) {
4313
+ if (node.typeAnnotation.type !== import_utils64.AST_NODE_TYPES.TSTypeLiteral) {
3686
4314
  return;
3687
4315
  }
3688
4316
  const { name } = node.id;
@@ -3709,11 +4337,11 @@ var preferInterfaceForComponentProps = createRule48({
3709
4337
  var prefer_interface_for_component_props_default = preferInterfaceForComponentProps;
3710
4338
 
3711
4339
  // src/rules/prefer-interface-over-inline-types.ts
3712
- var import_utils54 = require("@typescript-eslint/utils");
3713
- var createRule49 = import_utils54.ESLintUtils.RuleCreator(
4340
+ var import_utils66 = require("@typescript-eslint/utils");
4341
+ var createRule57 = import_utils66.ESLintUtils.RuleCreator(
3714
4342
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3715
4343
  );
3716
- var preferInterfaceOverInlineTypes = createRule49({
4344
+ var preferInterfaceOverInlineTypes = createRule57({
3717
4345
  name: "prefer-interface-over-inline-types",
3718
4346
  meta: {
3719
4347
  type: "suggestion",
@@ -3729,54 +4357,54 @@ var preferInterfaceOverInlineTypes = createRule49({
3729
4357
  defaultOptions: [],
3730
4358
  create(context) {
3731
4359
  function hasJSXInConditional(node) {
3732
- return node.consequent.type === import_utils54.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils54.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils54.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils54.AST_NODE_TYPES.JSXFragment;
4360
+ return node.consequent.type === import_utils66.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils66.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils66.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils66.AST_NODE_TYPES.JSXFragment;
3733
4361
  }
3734
4362
  function hasJSXInLogical(node) {
3735
- return node.right.type === import_utils54.AST_NODE_TYPES.JSXElement || node.right.type === import_utils54.AST_NODE_TYPES.JSXFragment;
4363
+ return node.right.type === import_utils66.AST_NODE_TYPES.JSXElement || node.right.type === import_utils66.AST_NODE_TYPES.JSXFragment;
3736
4364
  }
3737
4365
  function hasJSXReturn(block) {
3738
4366
  return block.body.some((stmt) => {
3739
- if (stmt.type === import_utils54.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
3740
- return stmt.argument.type === import_utils54.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils54.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils54.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils54.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
4367
+ if (stmt.type === import_utils66.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
4368
+ return stmt.argument.type === import_utils66.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils66.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils66.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils66.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
3741
4369
  }
3742
4370
  return false;
3743
4371
  });
3744
4372
  }
3745
4373
  function isReactComponent2(node) {
3746
- if (node.type === import_utils54.AST_NODE_TYPES.ArrowFunctionExpression) {
3747
- if (node.body.type === import_utils54.AST_NODE_TYPES.JSXElement || node.body.type === import_utils54.AST_NODE_TYPES.JSXFragment) {
4374
+ if (node.type === import_utils66.AST_NODE_TYPES.ArrowFunctionExpression) {
4375
+ if (node.body.type === import_utils66.AST_NODE_TYPES.JSXElement || node.body.type === import_utils66.AST_NODE_TYPES.JSXFragment) {
3748
4376
  return true;
3749
4377
  }
3750
- if (node.body.type === import_utils54.AST_NODE_TYPES.BlockStatement) {
4378
+ if (node.body.type === import_utils66.AST_NODE_TYPES.BlockStatement) {
3751
4379
  return hasJSXReturn(node.body);
3752
4380
  }
3753
- } else if (node.type === import_utils54.AST_NODE_TYPES.FunctionExpression || node.type === import_utils54.AST_NODE_TYPES.FunctionDeclaration) {
3754
- if (node.body && node.body.type === import_utils54.AST_NODE_TYPES.BlockStatement) {
4381
+ } else if (node.type === import_utils66.AST_NODE_TYPES.FunctionExpression || node.type === import_utils66.AST_NODE_TYPES.FunctionDeclaration) {
4382
+ if (node.body && node.body.type === import_utils66.AST_NODE_TYPES.BlockStatement) {
3755
4383
  return hasJSXReturn(node.body);
3756
4384
  }
3757
4385
  }
3758
4386
  return false;
3759
4387
  }
3760
4388
  function isInlineTypeAnnotation(node) {
3761
- if (node.type === import_utils54.AST_NODE_TYPES.TSTypeLiteral) {
4389
+ if (node.type === import_utils66.AST_NODE_TYPES.TSTypeLiteral) {
3762
4390
  return true;
3763
4391
  }
3764
- if (node.type === import_utils54.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
3765
- return node.typeArguments.params.some((param) => param.type === import_utils54.AST_NODE_TYPES.TSTypeLiteral);
4392
+ if (node.type === import_utils66.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
4393
+ return node.typeArguments.params.some((param) => param.type === import_utils66.AST_NODE_TYPES.TSTypeLiteral);
3766
4394
  }
3767
- if (node.type === import_utils54.AST_NODE_TYPES.TSUnionType) {
4395
+ if (node.type === import_utils66.AST_NODE_TYPES.TSUnionType) {
3768
4396
  return node.types.some((type) => isInlineTypeAnnotation(type));
3769
4397
  }
3770
4398
  return false;
3771
4399
  }
3772
4400
  function hasInlineObjectType(node) {
3773
- if (node.type === import_utils54.AST_NODE_TYPES.TSTypeLiteral) {
4401
+ if (node.type === import_utils66.AST_NODE_TYPES.TSTypeLiteral) {
3774
4402
  return true;
3775
4403
  }
3776
- if (node.type === import_utils54.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
3777
- return node.typeArguments.params.some((param) => param.type === import_utils54.AST_NODE_TYPES.TSTypeLiteral);
4404
+ if (node.type === import_utils66.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
4405
+ return node.typeArguments.params.some((param) => param.type === import_utils66.AST_NODE_TYPES.TSTypeLiteral);
3778
4406
  }
3779
- if (node.type === import_utils54.AST_NODE_TYPES.TSUnionType) {
4407
+ if (node.type === import_utils66.AST_NODE_TYPES.TSUnionType) {
3780
4408
  return node.types.some((type) => hasInlineObjectType(type));
3781
4409
  }
3782
4410
  return false;
@@ -3789,7 +4417,7 @@ var preferInterfaceOverInlineTypes = createRule49({
3789
4417
  return;
3790
4418
  }
3791
4419
  const param = node.params[0];
3792
- if (param.type === import_utils54.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
4420
+ if (param.type === import_utils66.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
3793
4421
  const { typeAnnotation } = param.typeAnnotation;
3794
4422
  if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
3795
4423
  context.report({
@@ -3809,11 +4437,11 @@ var preferInterfaceOverInlineTypes = createRule49({
3809
4437
  var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
3810
4438
 
3811
4439
  // src/rules/prefer-jsx-template-literals.ts
3812
- var import_utils55 = require("@typescript-eslint/utils");
3813
- var createRule50 = import_utils55.ESLintUtils.RuleCreator(
4440
+ var import_utils67 = require("@typescript-eslint/utils");
4441
+ var createRule58 = import_utils67.ESLintUtils.RuleCreator(
3814
4442
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3815
4443
  );
3816
- var preferJSXTemplateLiterals = createRule50({
4444
+ var preferJSXTemplateLiterals = createRule58({
3817
4445
  name: "prefer-jsx-template-literals",
3818
4446
  meta: {
3819
4447
  type: "suggestion",
@@ -3882,9 +4510,9 @@ var preferJSXTemplateLiterals = createRule50({
3882
4510
  if (!child || !nextChild) {
3883
4511
  return;
3884
4512
  }
3885
- if (child.type === import_utils55.AST_NODE_TYPES.JSXText && nextChild.type === import_utils55.AST_NODE_TYPES.JSXExpressionContainer) {
4513
+ if (child.type === import_utils67.AST_NODE_TYPES.JSXText && nextChild.type === import_utils67.AST_NODE_TYPES.JSXExpressionContainer) {
3886
4514
  handleTextBeforeExpression(child, nextChild);
3887
- } else if (child.type === import_utils55.AST_NODE_TYPES.JSXExpressionContainer && nextChild.type === import_utils55.AST_NODE_TYPES.JSXText) {
4515
+ } else if (child.type === import_utils67.AST_NODE_TYPES.JSXExpressionContainer && nextChild.type === import_utils67.AST_NODE_TYPES.JSXText) {
3888
4516
  handleExpressionBeforeText(child, nextChild);
3889
4517
  }
3890
4518
  }
@@ -3897,32 +4525,32 @@ var preferJSXTemplateLiterals = createRule50({
3897
4525
  var prefer_jsx_template_literals_default = preferJSXTemplateLiterals;
3898
4526
 
3899
4527
  // src/rules/prefer-named-param-types.ts
3900
- var import_utils56 = require("@typescript-eslint/utils");
3901
- var createRule51 = import_utils56.ESLintUtils.RuleCreator(
4528
+ var import_utils68 = require("@typescript-eslint/utils");
4529
+ var createRule59 = import_utils68.ESLintUtils.RuleCreator(
3902
4530
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3903
4531
  );
3904
4532
  var returnsJsx2 = (node) => {
3905
- if (node.type === import_utils56.AST_NODE_TYPES.JSXElement || node.type === import_utils56.AST_NODE_TYPES.JSXFragment) {
4533
+ if (node.type === import_utils68.AST_NODE_TYPES.JSXElement || node.type === import_utils68.AST_NODE_TYPES.JSXFragment) {
3906
4534
  return true;
3907
4535
  }
3908
- if (node.type === import_utils56.AST_NODE_TYPES.ConditionalExpression) {
4536
+ if (node.type === import_utils68.AST_NODE_TYPES.ConditionalExpression) {
3909
4537
  return returnsJsx2(node.consequent) || returnsJsx2(node.alternate);
3910
4538
  }
3911
- if (node.type === import_utils56.AST_NODE_TYPES.LogicalExpression) {
4539
+ if (node.type === import_utils68.AST_NODE_TYPES.LogicalExpression) {
3912
4540
  return returnsJsx2(node.left) || returnsJsx2(node.right);
3913
4541
  }
3914
4542
  return false;
3915
4543
  };
3916
4544
  var bodyReturnsJsx2 = (body) => {
3917
- if (body.type !== import_utils56.AST_NODE_TYPES.BlockStatement) {
4545
+ if (body.type !== import_utils68.AST_NODE_TYPES.BlockStatement) {
3918
4546
  return returnsJsx2(body);
3919
4547
  }
3920
4548
  return body.body.some(
3921
- (stmt) => stmt.type === import_utils56.AST_NODE_TYPES.ReturnStatement && stmt.argument !== null && returnsJsx2(stmt.argument)
4549
+ (stmt) => stmt.type === import_utils68.AST_NODE_TYPES.ReturnStatement && stmt.argument !== null && returnsJsx2(stmt.argument)
3922
4550
  );
3923
4551
  };
3924
4552
  var isReactComponentFunction = (node) => bodyReturnsJsx2(node.body);
3925
- var preferNamedParamTypes = createRule51({
4553
+ var preferNamedParamTypes = createRule59({
3926
4554
  name: "prefer-named-param-types",
3927
4555
  meta: {
3928
4556
  type: "suggestion",
@@ -3937,16 +4565,16 @@ var preferNamedParamTypes = createRule51({
3937
4565
  defaultOptions: [],
3938
4566
  create(context) {
3939
4567
  function hasInlineObjectType(param) {
3940
- if (param.type === import_utils56.AST_NODE_TYPES.AssignmentPattern) {
4568
+ if (param.type === import_utils68.AST_NODE_TYPES.AssignmentPattern) {
3941
4569
  return hasInlineObjectType(param.left);
3942
4570
  }
3943
- if (param.type === import_utils56.AST_NODE_TYPES.ObjectPattern) {
3944
- if (param.typeAnnotation?.typeAnnotation.type === import_utils56.AST_NODE_TYPES.TSTypeLiteral) {
4571
+ if (param.type === import_utils68.AST_NODE_TYPES.ObjectPattern) {
4572
+ if (param.typeAnnotation?.typeAnnotation.type === import_utils68.AST_NODE_TYPES.TSTypeLiteral) {
3945
4573
  return true;
3946
4574
  }
3947
4575
  }
3948
- if (param.type === import_utils56.AST_NODE_TYPES.Identifier) {
3949
- if (param.typeAnnotation?.typeAnnotation.type === import_utils56.AST_NODE_TYPES.TSTypeLiteral) {
4576
+ if (param.type === import_utils68.AST_NODE_TYPES.Identifier) {
4577
+ if (param.typeAnnotation?.typeAnnotation.type === import_utils68.AST_NODE_TYPES.TSTypeLiteral) {
3950
4578
  return true;
3951
4579
  }
3952
4580
  }
@@ -3959,7 +4587,7 @@ var preferNamedParamTypes = createRule51({
3959
4587
  } else if ("value" in node && node.value) {
3960
4588
  params = node.value.params;
3961
4589
  }
3962
- if ((node.type === import_utils56.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils56.AST_NODE_TYPES.FunctionExpression || node.type === import_utils56.AST_NODE_TYPES.ArrowFunctionExpression) && params.length === 1 && params[0].type === import_utils56.AST_NODE_TYPES.Identifier && isReactComponentFunction(node)) {
4590
+ if ((node.type === import_utils68.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils68.AST_NODE_TYPES.FunctionExpression || node.type === import_utils68.AST_NODE_TYPES.ArrowFunctionExpression) && params.length === 1 && params[0].type === import_utils68.AST_NODE_TYPES.Identifier && isReactComponentFunction(node)) {
3963
4591
  return;
3964
4592
  }
3965
4593
  params.forEach((param) => {
@@ -3983,11 +4611,11 @@ var preferNamedParamTypes = createRule51({
3983
4611
  var prefer_named_param_types_default = preferNamedParamTypes;
3984
4612
 
3985
4613
  // src/rules/prefer-props-with-children.ts
3986
- var import_utils57 = require("@typescript-eslint/utils");
3987
- var createRule52 = import_utils57.ESLintUtils.RuleCreator(
4614
+ var import_utils69 = require("@typescript-eslint/utils");
4615
+ var createRule60 = import_utils69.ESLintUtils.RuleCreator(
3988
4616
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
3989
4617
  );
3990
- var preferPropsWithChildren = createRule52({
4618
+ var preferPropsWithChildren = createRule60({
3991
4619
  name: "prefer-props-with-children",
3992
4620
  meta: {
3993
4621
  type: "suggestion",
@@ -4005,24 +4633,24 @@ var preferPropsWithChildren = createRule52({
4005
4633
  if (!typeNode) {
4006
4634
  return false;
4007
4635
  }
4008
- if (typeNode.type !== import_utils57.AST_NODE_TYPES.TSTypeReference) {
4636
+ if (typeNode.type !== import_utils69.AST_NODE_TYPES.TSTypeReference) {
4009
4637
  return false;
4010
4638
  }
4011
4639
  const { typeName } = typeNode;
4012
- if (typeName.type === import_utils57.AST_NODE_TYPES.Identifier) {
4640
+ if (typeName.type === import_utils69.AST_NODE_TYPES.Identifier) {
4013
4641
  return typeName.name === "ReactNode";
4014
4642
  }
4015
- if (typeName.type === import_utils57.AST_NODE_TYPES.TSQualifiedName && typeName.left.type === import_utils57.AST_NODE_TYPES.Identifier && typeName.left.name === "React" && typeName.right.type === import_utils57.AST_NODE_TYPES.Identifier && typeName.right.name === "ReactNode") {
4643
+ if (typeName.type === import_utils69.AST_NODE_TYPES.TSQualifiedName && typeName.left.type === import_utils69.AST_NODE_TYPES.Identifier && typeName.left.name === "React" && typeName.right.type === import_utils69.AST_NODE_TYPES.Identifier && typeName.right.name === "ReactNode") {
4016
4644
  return true;
4017
4645
  }
4018
4646
  return false;
4019
4647
  }
4020
4648
  function findChildrenReactNode(members) {
4021
4649
  for (const member of members) {
4022
- if (member.type !== import_utils57.AST_NODE_TYPES.TSPropertySignature) {
4650
+ if (member.type !== import_utils69.AST_NODE_TYPES.TSPropertySignature) {
4023
4651
  continue;
4024
4652
  }
4025
- if (member.key.type !== import_utils57.AST_NODE_TYPES.Identifier) {
4653
+ if (member.key.type !== import_utils69.AST_NODE_TYPES.Identifier) {
4026
4654
  continue;
4027
4655
  }
4028
4656
  if (member.key.name !== "children") {
@@ -4062,11 +4690,11 @@ var preferPropsWithChildren = createRule52({
4062
4690
  var prefer_props_with_children_default = preferPropsWithChildren;
4063
4691
 
4064
4692
  // src/rules/prefer-react-import-types.ts
4065
- var import_utils58 = require("@typescript-eslint/utils");
4066
- var createRule53 = import_utils58.ESLintUtils.RuleCreator(
4693
+ var import_utils70 = require("@typescript-eslint/utils");
4694
+ var createRule61 = import_utils70.ESLintUtils.RuleCreator(
4067
4695
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4068
4696
  );
4069
- var preferReactImportTypes = createRule53({
4697
+ var preferReactImportTypes = createRule61({
4070
4698
  name: "prefer-react-import-types",
4071
4699
  meta: {
4072
4700
  type: "suggestion",
@@ -4142,7 +4770,7 @@ var preferReactImportTypes = createRule53({
4142
4770
  ]);
4143
4771
  const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
4144
4772
  function checkMemberExpression(node) {
4145
- if (node.object.type === import_utils58.AST_NODE_TYPES.Identifier && node.object.name === "React" && node.property.type === import_utils58.AST_NODE_TYPES.Identifier && allReactExports.has(node.property.name)) {
4773
+ if (node.object.type === import_utils70.AST_NODE_TYPES.Identifier && node.object.name === "React" && node.property.type === import_utils70.AST_NODE_TYPES.Identifier && allReactExports.has(node.property.name)) {
4146
4774
  const typeName = node.property.name;
4147
4775
  const isType = reactTypes.has(typeName);
4148
4776
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -4159,7 +4787,7 @@ var preferReactImportTypes = createRule53({
4159
4787
  return {
4160
4788
  MemberExpression: checkMemberExpression,
4161
4789
  "TSTypeReference > TSQualifiedName": (node) => {
4162
- if (node.left.type === import_utils58.AST_NODE_TYPES.Identifier && node.left.name === "React" && node.right.type === import_utils58.AST_NODE_TYPES.Identifier && allReactExports.has(node.right.name)) {
4790
+ if (node.left.type === import_utils70.AST_NODE_TYPES.Identifier && node.left.name === "React" && node.right.type === import_utils70.AST_NODE_TYPES.Identifier && allReactExports.has(node.right.name)) {
4163
4791
  const typeName = node.right.name;
4164
4792
  const isType = reactTypes.has(typeName);
4165
4793
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -4179,11 +4807,11 @@ var preferReactImportTypes = createRule53({
4179
4807
  var prefer_react_import_types_default = preferReactImportTypes;
4180
4808
 
4181
4809
  // src/rules/react-props-destructure.ts
4182
- var import_utils59 = require("@typescript-eslint/utils");
4183
- var createRule54 = import_utils59.ESLintUtils.RuleCreator(
4810
+ var import_utils71 = require("@typescript-eslint/utils");
4811
+ var createRule62 = import_utils71.ESLintUtils.RuleCreator(
4184
4812
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4185
4813
  );
4186
- var reactPropsDestructure = createRule54({
4814
+ var reactPropsDestructure = createRule62({
4187
4815
  name: "react-props-destructure",
4188
4816
  meta: {
4189
4817
  type: "suggestion",
@@ -4199,29 +4827,29 @@ var reactPropsDestructure = createRule54({
4199
4827
  defaultOptions: [],
4200
4828
  create(context) {
4201
4829
  function hasJSXInConditional(node) {
4202
- return node.consequent.type === import_utils59.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils59.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils59.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils59.AST_NODE_TYPES.JSXFragment;
4830
+ return node.consequent.type === import_utils71.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils71.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils71.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils71.AST_NODE_TYPES.JSXFragment;
4203
4831
  }
4204
4832
  function hasJSXInLogical(node) {
4205
- return node.right.type === import_utils59.AST_NODE_TYPES.JSXElement || node.right.type === import_utils59.AST_NODE_TYPES.JSXFragment;
4833
+ return node.right.type === import_utils71.AST_NODE_TYPES.JSXElement || node.right.type === import_utils71.AST_NODE_TYPES.JSXFragment;
4206
4834
  }
4207
4835
  function hasJSXReturn(block) {
4208
4836
  return block.body.some((stmt) => {
4209
- if (stmt.type === import_utils59.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
4210
- return stmt.argument.type === import_utils59.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils59.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils59.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils59.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
4837
+ if (stmt.type === import_utils71.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
4838
+ return stmt.argument.type === import_utils71.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils71.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils71.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils71.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
4211
4839
  }
4212
4840
  return false;
4213
4841
  });
4214
4842
  }
4215
4843
  function isReactComponent2(node) {
4216
- if (node.type === import_utils59.AST_NODE_TYPES.ArrowFunctionExpression) {
4217
- if (node.body.type === import_utils59.AST_NODE_TYPES.JSXElement || node.body.type === import_utils59.AST_NODE_TYPES.JSXFragment) {
4844
+ if (node.type === import_utils71.AST_NODE_TYPES.ArrowFunctionExpression) {
4845
+ if (node.body.type === import_utils71.AST_NODE_TYPES.JSXElement || node.body.type === import_utils71.AST_NODE_TYPES.JSXFragment) {
4218
4846
  return true;
4219
4847
  }
4220
- if (node.body.type === import_utils59.AST_NODE_TYPES.BlockStatement) {
4848
+ if (node.body.type === import_utils71.AST_NODE_TYPES.BlockStatement) {
4221
4849
  return hasJSXReturn(node.body);
4222
4850
  }
4223
- } else if (node.type === import_utils59.AST_NODE_TYPES.FunctionExpression || node.type === import_utils59.AST_NODE_TYPES.FunctionDeclaration) {
4224
- if (node.body && node.body.type === import_utils59.AST_NODE_TYPES.BlockStatement) {
4851
+ } else if (node.type === import_utils71.AST_NODE_TYPES.FunctionExpression || node.type === import_utils71.AST_NODE_TYPES.FunctionDeclaration) {
4852
+ if (node.body && node.body.type === import_utils71.AST_NODE_TYPES.BlockStatement) {
4225
4853
  return hasJSXReturn(node.body);
4226
4854
  }
4227
4855
  }
@@ -4235,9 +4863,9 @@ var reactPropsDestructure = createRule54({
4235
4863
  return;
4236
4864
  }
4237
4865
  const param = node.params[0];
4238
- if (param.type === import_utils59.AST_NODE_TYPES.ObjectPattern) {
4239
- const properties = param.properties.filter((prop) => prop.type === import_utils59.AST_NODE_TYPES.Property).map((prop) => {
4240
- if (prop.key.type === import_utils59.AST_NODE_TYPES.Identifier) {
4866
+ if (param.type === import_utils71.AST_NODE_TYPES.ObjectPattern) {
4867
+ const properties = param.properties.filter((prop) => prop.type === import_utils71.AST_NODE_TYPES.Property).map((prop) => {
4868
+ if (prop.key.type === import_utils71.AST_NODE_TYPES.Identifier) {
4241
4869
  return prop.key.name;
4242
4870
  }
4243
4871
  return null;
@@ -4264,57 +4892,57 @@ var reactPropsDestructure = createRule54({
4264
4892
  var react_props_destructure_default = reactPropsDestructure;
4265
4893
 
4266
4894
  // src/rules/require-explicit-return-type.ts
4267
- var import_utils60 = require("@typescript-eslint/utils");
4268
- var createRule55 = import_utils60.ESLintUtils.RuleCreator(
4895
+ var import_utils72 = require("@typescript-eslint/utils");
4896
+ var createRule63 = import_utils72.ESLintUtils.RuleCreator(
4269
4897
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4270
4898
  );
4271
4899
  var isReactComponent = (node) => {
4272
- if (node.type === import_utils60.AST_NODE_TYPES.ArrowFunctionExpression) {
4900
+ if (node.type === import_utils72.AST_NODE_TYPES.ArrowFunctionExpression) {
4273
4901
  const { parent } = node;
4274
- if (parent?.type === import_utils60.AST_NODE_TYPES.VariableDeclarator) {
4902
+ if (parent?.type === import_utils72.AST_NODE_TYPES.VariableDeclarator) {
4275
4903
  const { id } = parent;
4276
- if (id.type === import_utils60.AST_NODE_TYPES.Identifier) {
4904
+ if (id.type === import_utils72.AST_NODE_TYPES.Identifier) {
4277
4905
  return /^[A-Z]/.test(id.name);
4278
4906
  }
4279
4907
  }
4280
4908
  }
4281
- if (node.type === import_utils60.AST_NODE_TYPES.FunctionDeclaration && node.id) {
4909
+ if (node.type === import_utils72.AST_NODE_TYPES.FunctionDeclaration && node.id) {
4282
4910
  return /^[A-Z]/.test(node.id.name);
4283
4911
  }
4284
4912
  return false;
4285
4913
  };
4286
4914
  var isCallbackFunction = (node) => {
4287
- if (node.type === import_utils60.AST_NODE_TYPES.FunctionDeclaration) {
4915
+ if (node.type === import_utils72.AST_NODE_TYPES.FunctionDeclaration) {
4288
4916
  return false;
4289
4917
  }
4290
4918
  const { parent } = node;
4291
4919
  if (!parent) {
4292
4920
  return false;
4293
4921
  }
4294
- if (parent.type === import_utils60.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
4922
+ if (parent.type === import_utils72.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
4295
4923
  return true;
4296
4924
  }
4297
- if (parent.type === import_utils60.AST_NODE_TYPES.Property) {
4925
+ if (parent.type === import_utils72.AST_NODE_TYPES.Property) {
4298
4926
  return true;
4299
4927
  }
4300
- if (parent.type === import_utils60.AST_NODE_TYPES.ArrayExpression) {
4928
+ if (parent.type === import_utils72.AST_NODE_TYPES.ArrayExpression) {
4301
4929
  return true;
4302
4930
  }
4303
4931
  return false;
4304
4932
  };
4305
4933
  var getFunctionName = (node) => {
4306
- if (node.type === import_utils60.AST_NODE_TYPES.FunctionDeclaration && node.id) {
4934
+ if (node.type === import_utils72.AST_NODE_TYPES.FunctionDeclaration && node.id) {
4307
4935
  return node.id.name;
4308
4936
  }
4309
- if (node.type === import_utils60.AST_NODE_TYPES.FunctionExpression && node.id) {
4937
+ if (node.type === import_utils72.AST_NODE_TYPES.FunctionExpression && node.id) {
4310
4938
  return node.id.name;
4311
4939
  }
4312
- if ((node.type === import_utils60.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils60.AST_NODE_TYPES.FunctionExpression) && node.parent?.type === import_utils60.AST_NODE_TYPES.VariableDeclarator && node.parent.id.type === import_utils60.AST_NODE_TYPES.Identifier) {
4940
+ if ((node.type === import_utils72.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils72.AST_NODE_TYPES.FunctionExpression) && node.parent?.type === import_utils72.AST_NODE_TYPES.VariableDeclarator && node.parent.id.type === import_utils72.AST_NODE_TYPES.Identifier) {
4313
4941
  return node.parent.id.name;
4314
4942
  }
4315
4943
  return null;
4316
4944
  };
4317
- var requireExplicitReturnType = createRule55({
4945
+ var requireExplicitReturnType = createRule63({
4318
4946
  name: "require-explicit-return-type",
4319
4947
  meta: {
4320
4948
  type: "suggestion",
@@ -4363,8 +4991,8 @@ var requireExplicitReturnType = createRule55({
4363
4991
  var require_explicit_return_type_default = requireExplicitReturnType;
4364
4992
 
4365
4993
  // src/rules/sort-exports.ts
4366
- var import_utils61 = require("@typescript-eslint/utils");
4367
- var createRule56 = import_utils61.ESLintUtils.RuleCreator(
4994
+ var import_utils73 = require("@typescript-eslint/utils");
4995
+ var createRule64 = import_utils73.ESLintUtils.RuleCreator(
4368
4996
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4369
4997
  );
4370
4998
  var GROUP_NAMES = ["", "external/alias re-export", "relative re-export", "local export"];
@@ -4378,7 +5006,7 @@ function getExportGroup(node) {
4378
5006
  }
4379
5007
  return 1;
4380
5008
  }
4381
- var sortExports = createRule56({
5009
+ var sortExports = createRule64({
4382
5010
  name: "sort-exports",
4383
5011
  meta: {
4384
5012
  type: "suggestion",
@@ -4418,7 +5046,7 @@ var sortExports = createRule56({
4418
5046
  Program(node) {
4419
5047
  const exportGroups = [];
4420
5048
  node.body.forEach((statement) => {
4421
- if (statement.type !== import_utils61.AST_NODE_TYPES.ExportNamedDeclaration || statement.declaration !== null) {
5049
+ if (statement.type !== import_utils73.AST_NODE_TYPES.ExportNamedDeclaration || statement.declaration !== null) {
4422
5050
  if (exportGroups.length > 0) {
4423
5051
  checkOrder(exportGroups);
4424
5052
  exportGroups.length = 0;
@@ -4437,8 +5065,8 @@ var sortExports = createRule56({
4437
5065
  var sort_exports_default = sortExports;
4438
5066
 
4439
5067
  // src/rules/sort-imports.ts
4440
- var import_utils62 = require("@typescript-eslint/utils");
4441
- var createRule57 = import_utils62.ESLintUtils.RuleCreator(
5068
+ var import_utils74 = require("@typescript-eslint/utils");
5069
+ var createRule65 = import_utils74.ESLintUtils.RuleCreator(
4442
5070
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4443
5071
  );
4444
5072
  var NODE_BUILTINS = /* @__PURE__ */ new Set([
@@ -4505,7 +5133,7 @@ function getImportGroup(node) {
4505
5133
  function isTypeOnlyImport(node) {
4506
5134
  return node.importKind === "type" && node.specifiers.length > 0;
4507
5135
  }
4508
- var sortImports = createRule57({
5136
+ var sortImports = createRule65({
4509
5137
  name: "sort-imports",
4510
5138
  meta: {
4511
5139
  type: "suggestion",
@@ -4549,7 +5177,7 @@ var sortImports = createRule57({
4549
5177
  Program(node) {
4550
5178
  const importGroups = [];
4551
5179
  node.body.forEach((statement) => {
4552
- if (statement.type !== import_utils62.AST_NODE_TYPES.ImportDeclaration) {
5180
+ if (statement.type !== import_utils74.AST_NODE_TYPES.ImportDeclaration) {
4553
5181
  if (importGroups.length > 0) {
4554
5182
  checkOrder(importGroups);
4555
5183
  importGroups.length = 0;
@@ -4571,13 +5199,13 @@ var sortImports = createRule57({
4571
5199
  var sort_imports_default = sortImports;
4572
5200
 
4573
5201
  // src/rules/sort-type-alphabetically.ts
4574
- var import_utils63 = require("@typescript-eslint/utils");
4575
- var createRule58 = import_utils63.ESLintUtils.RuleCreator(
5202
+ var import_utils75 = require("@typescript-eslint/utils");
5203
+ var createRule66 = import_utils75.ESLintUtils.RuleCreator(
4576
5204
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4577
5205
  );
4578
5206
  function isAlphabeticallySortedWithinGroups(members) {
4579
5207
  const properties = members.filter(
4580
- (member) => member.type === import_utils63.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils63.AST_NODE_TYPES.Identifier
5208
+ (member) => member.type === import_utils75.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils75.AST_NODE_TYPES.Identifier
4581
5209
  );
4582
5210
  if (properties.length < 2) {
4583
5211
  return true;
@@ -4588,7 +5216,7 @@ function isAlphabeticallySortedWithinGroups(members) {
4588
5216
  const isOptionalSorted = optional.every((name, index) => index === 0 || optional[index - 1].localeCompare(name) <= 0);
4589
5217
  return isRequiredSorted && isOptionalSorted;
4590
5218
  }
4591
- var sortTypeAlphabetically = createRule58({
5219
+ var sortTypeAlphabetically = createRule66({
4592
5220
  name: "sort-type-alphabetically",
4593
5221
  meta: {
4594
5222
  type: "suggestion",
@@ -4606,7 +5234,7 @@ var sortTypeAlphabetically = createRule58({
4606
5234
  function fixMembers(fixer, members) {
4607
5235
  const { sourceCode } = context;
4608
5236
  const properties = members.filter(
4609
- (member) => member.type === import_utils63.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils63.AST_NODE_TYPES.Identifier
5237
+ (member) => member.type === import_utils75.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils75.AST_NODE_TYPES.Identifier
4610
5238
  );
4611
5239
  const required = properties.filter((prop) => !prop.optional);
4612
5240
  const optional = properties.filter((prop) => prop.optional);
@@ -4643,7 +5271,7 @@ var sortTypeAlphabetically = createRule58({
4643
5271
  }
4644
5272
  },
4645
5273
  TSTypeAliasDeclaration(node) {
4646
- if (node.typeAnnotation.type !== import_utils63.AST_NODE_TYPES.TSTypeLiteral) {
5274
+ if (node.typeAnnotation.type !== import_utils75.AST_NODE_TYPES.TSTypeLiteral) {
4647
5275
  return;
4648
5276
  }
4649
5277
  const { members } = node.typeAnnotation;
@@ -4663,13 +5291,13 @@ var sortTypeAlphabetically = createRule58({
4663
5291
  var sort_type_alphabetically_default = sortTypeAlphabetically;
4664
5292
 
4665
5293
  // src/rules/sort-type-required-first.ts
4666
- var import_utils64 = require("@typescript-eslint/utils");
4667
- var createRule59 = import_utils64.ESLintUtils.RuleCreator(
5294
+ var import_utils76 = require("@typescript-eslint/utils");
5295
+ var createRule67 = import_utils76.ESLintUtils.RuleCreator(
4668
5296
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
4669
5297
  );
4670
5298
  function isRequiredBeforeOptional(members) {
4671
5299
  const properties = members.filter(
4672
- (member) => member.type === import_utils64.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils64.AST_NODE_TYPES.Identifier
5300
+ (member) => member.type === import_utils76.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils76.AST_NODE_TYPES.Identifier
4673
5301
  );
4674
5302
  if (properties.length < 2) {
4675
5303
  return true;
@@ -4680,7 +5308,7 @@ function isRequiredBeforeOptional(members) {
4680
5308
  }
4681
5309
  return properties.slice(firstOptionalIndex).every((prop) => prop.optional);
4682
5310
  }
4683
- var sortTypeRequiredFirst = createRule59({
5311
+ var sortTypeRequiredFirst = createRule67({
4684
5312
  name: "sort-type-required-first",
4685
5313
  meta: {
4686
5314
  type: "suggestion",
@@ -4698,7 +5326,7 @@ var sortTypeRequiredFirst = createRule59({
4698
5326
  function fixMembers(fixer, members) {
4699
5327
  const { sourceCode } = context;
4700
5328
  const properties = members.filter(
4701
- (member) => member.type === import_utils64.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils64.AST_NODE_TYPES.Identifier
5329
+ (member) => member.type === import_utils76.AST_NODE_TYPES.TSPropertySignature && member.key.type === import_utils76.AST_NODE_TYPES.Identifier
4702
5330
  );
4703
5331
  const required = properties.filter((prop) => !prop.optional);
4704
5332
  const optional = properties.filter((prop) => prop.optional);
@@ -4719,7 +5347,7 @@ var sortTypeRequiredFirst = createRule59({
4719
5347
  }
4720
5348
  },
4721
5349
  TSTypeAliasDeclaration(node) {
4722
- if (node.typeAnnotation.type !== import_utils64.AST_NODE_TYPES.TSTypeLiteral) {
5350
+ if (node.typeAnnotation.type !== import_utils76.AST_NODE_TYPES.TSTypeLiteral) {
4723
5351
  return;
4724
5352
  }
4725
5353
  const { members } = node.typeAnnotation;
@@ -4747,18 +5375,24 @@ var rules = {
4747
5375
  "boolean-naming-prefix": boolean_naming_prefix_default,
4748
5376
  "enforce-camel-case": enforce_camel_case_default,
4749
5377
  "enforce-constant-case": enforce_constant_case_default,
5378
+ "enforce-hook-filename": enforce_hook_filename_default,
4750
5379
  "enforce-hook-naming": enforce_hook_naming_default,
4751
5380
  "enforce-property-case": enforce_property_case_default,
4752
5381
  "enforce-props-suffix": enforce_props_suffix_default,
4753
5382
  "enforce-readonly-component-props": enforce_readonly_component_props_default,
5383
+ "enforce-render-naming": enforce_render_naming_default,
4754
5384
  "enforce-service-naming": enforce_service_naming_default,
5385
+ "enforce-test-filename": enforce_test_filename_default,
4755
5386
  "enforce-sorted-destructuring": enforce_sorted_destructuring_default,
4756
5387
  "enforce-type-declaration-order": enforce_type_declaration_order_default,
4757
5388
  "index-export-only": index_export_only_default,
4758
5389
  "jsx-newline-between-elements": jsx_newline_between_elements_default,
5390
+ "jsx-no-data-array": jsx_no_data_array_default,
5391
+ "jsx-no-data-object": jsx_no_data_object_default,
4759
5392
  "jsx-no-inline-object-prop": jsx_no_inline_object_prop_default,
4760
5393
  "jsx-no-newline-single-line-elements": jsx_no_newline_single_line_elements_default,
4761
5394
  "jsx-no-non-component-function": jsx_no_non_component_function_default,
5395
+ "jsx-no-sub-interface": jsx_no_sub_interface_default,
4762
5396
  "jsx-no-ternary-null": jsx_no_ternary_null_default,
4763
5397
  "jsx-no-variable-in-callback": jsx_no_variable_in_callback_default,
4764
5398
  "jsx-require-suspense": jsx_require_suspense_default,
@@ -4772,6 +5406,8 @@ var rules = {
4772
5406
  "no-emoji": no_emoji_default,
4773
5407
  "no-env-fallback": no_env_fallback_default,
4774
5408
  "no-ghost-wrapper": no_ghost_wrapper_default,
5409
+ "no-helper-function-in-hook": no_helper_function_in_hook_default,
5410
+ "no-helper-function-in-test": no_helper_function_in_test_default,
4775
5411
  "no-inline-default-export": no_inline_default_export_default,
4776
5412
  "no-inline-nested-object": no_inline_nested_object_default,
4777
5413
  "no-inline-return-properties": no_inline_return_properties_default,
@@ -4812,9 +5448,11 @@ var baseRules = {
4812
5448
  "nextfriday/boolean-naming-prefix": "warn",
4813
5449
  "nextfriday/enforce-camel-case": "warn",
4814
5450
  "nextfriday/enforce-constant-case": "warn",
5451
+ "nextfriday/enforce-hook-filename": "warn",
4815
5452
  "nextfriday/enforce-hook-naming": "warn",
4816
5453
  "nextfriday/enforce-property-case": "warn",
4817
5454
  "nextfriday/enforce-service-naming": "warn",
5455
+ "nextfriday/enforce-test-filename": "warn",
4818
5456
  "nextfriday/enforce-sorted-destructuring": "warn",
4819
5457
  "nextfriday/enforce-type-declaration-order": "warn",
4820
5458
  "nextfriday/index-export-only": "warn",
@@ -4854,9 +5492,11 @@ var baseRecommendedRules = {
4854
5492
  "nextfriday/boolean-naming-prefix": "error",
4855
5493
  "nextfriday/enforce-camel-case": "error",
4856
5494
  "nextfriday/enforce-constant-case": "error",
5495
+ "nextfriday/enforce-hook-filename": "error",
4857
5496
  "nextfriday/enforce-hook-naming": "error",
4858
5497
  "nextfriday/enforce-property-case": "error",
4859
5498
  "nextfriday/enforce-service-naming": "error",
5499
+ "nextfriday/enforce-test-filename": "error",
4860
5500
  "nextfriday/enforce-sorted-destructuring": "error",
4861
5501
  "nextfriday/enforce-type-declaration-order": "error",
4862
5502
  "nextfriday/index-export-only": "error",
@@ -4895,10 +5535,14 @@ var baseRecommendedRules = {
4895
5535
  var jsxRules = {
4896
5536
  "nextfriday/enforce-props-suffix": "warn",
4897
5537
  "nextfriday/enforce-readonly-component-props": "warn",
5538
+ "nextfriday/enforce-render-naming": "warn",
4898
5539
  "nextfriday/jsx-newline-between-elements": "warn",
5540
+ "nextfriday/jsx-no-data-array": "warn",
5541
+ "nextfriday/jsx-no-data-object": "warn",
4899
5542
  "nextfriday/jsx-no-inline-object-prop": "warn",
4900
5543
  "nextfriday/jsx-no-newline-single-line-elements": "warn",
4901
5544
  "nextfriday/jsx-no-non-component-function": "warn",
5545
+ "nextfriday/jsx-no-sub-interface": "warn",
4902
5546
  "nextfriday/jsx-no-ternary-null": "warn",
4903
5547
  "nextfriday/jsx-no-variable-in-callback": "warn",
4904
5548
  "nextfriday/jsx-require-suspense": "warn",
@@ -4916,10 +5560,14 @@ var jsxRules = {
4916
5560
  var jsxRecommendedRules = {
4917
5561
  "nextfriday/enforce-props-suffix": "error",
4918
5562
  "nextfriday/enforce-readonly-component-props": "error",
5563
+ "nextfriday/enforce-render-naming": "error",
4919
5564
  "nextfriday/jsx-newline-between-elements": "error",
5565
+ "nextfriday/jsx-no-data-array": "error",
5566
+ "nextfriday/jsx-no-data-object": "error",
4920
5567
  "nextfriday/jsx-no-inline-object-prop": "error",
4921
5568
  "nextfriday/jsx-no-newline-single-line-elements": "error",
4922
5569
  "nextfriday/jsx-no-non-component-function": "error",
5570
+ "nextfriday/jsx-no-sub-interface": "error",
4923
5571
  "nextfriday/jsx-no-ternary-null": "error",
4924
5572
  "nextfriday/jsx-no-variable-in-callback": "error",
4925
5573
  "nextfriday/jsx-require-suspense": "error",