eslint-plugin-nextfriday 1.2.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "eslint-plugin-nextfriday",
4
- version: "1.2.3",
4
+ version: "1.4.0",
5
5
  description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
6
6
  keywords: [
7
7
  "eslint",
@@ -341,13 +341,59 @@ var mdFilenameCaseRestriction = createRule4({
341
341
  });
342
342
  var md_filename_case_restriction_default = mdFilenameCaseRestriction;
343
343
 
344
+ // src/rules/no-complex-inline-return.ts
345
+ import { ESLintUtils as ESLintUtils5, AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
346
+ var createRule5 = ESLintUtils5.RuleCreator(
347
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
348
+ );
349
+ var noComplexInlineReturn = createRule5({
350
+ name: "no-complex-inline-return",
351
+ meta: {
352
+ type: "suggestion",
353
+ docs: {
354
+ description: "Disallow complex inline expressions in return statements - prefer extracting to a const first"
355
+ },
356
+ messages: {
357
+ noComplexInlineReturn: "Avoid returning complex expressions directly. Extract to a const variable first for better readability."
358
+ },
359
+ schema: []
360
+ },
361
+ defaultOptions: [],
362
+ create(context) {
363
+ const isComplexExpression = (node) => {
364
+ if (!node) return false;
365
+ if (node.type === AST_NODE_TYPES2.ConditionalExpression) {
366
+ return true;
367
+ }
368
+ if (node.type === AST_NODE_TYPES2.LogicalExpression) {
369
+ return true;
370
+ }
371
+ if (node.type === AST_NODE_TYPES2.NewExpression) {
372
+ return true;
373
+ }
374
+ return false;
375
+ };
376
+ return {
377
+ ReturnStatement(node) {
378
+ if (node.argument && isComplexExpression(node.argument)) {
379
+ context.report({
380
+ node: node.argument,
381
+ messageId: "noComplexInlineReturn"
382
+ });
383
+ }
384
+ }
385
+ };
386
+ }
387
+ });
388
+ var no_complex_inline_return_default = noComplexInlineReturn;
389
+
344
390
  // src/rules/no-emoji.ts
345
391
  import emojiRegex from "emoji-regex";
346
- import { ESLintUtils as ESLintUtils5 } from "@typescript-eslint/utils";
347
- var createRule5 = ESLintUtils5.RuleCreator(
392
+ import { ESLintUtils as ESLintUtils6 } from "@typescript-eslint/utils";
393
+ var createRule6 = ESLintUtils6.RuleCreator(
348
394
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
349
395
  );
350
- var noEmoji = createRule5({
396
+ var noEmoji = createRule6({
351
397
  name: "no-emoji",
352
398
  meta: {
353
399
  type: "problem",
@@ -381,11 +427,11 @@ var noEmoji = createRule5({
381
427
  var no_emoji_default = noEmoji;
382
428
 
383
429
  // src/rules/no-explicit-return-type.ts
384
- import { ESLintUtils as ESLintUtils6 } from "@typescript-eslint/utils";
385
- var createRule6 = ESLintUtils6.RuleCreator(
430
+ import { ESLintUtils as ESLintUtils7 } from "@typescript-eslint/utils";
431
+ var createRule7 = ESLintUtils7.RuleCreator(
386
432
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
387
433
  );
388
- var noExplicitReturnType = createRule6({
434
+ var noExplicitReturnType = createRule7({
389
435
  name: "no-explicit-return-type",
390
436
  meta: {
391
437
  type: "suggestion",
@@ -424,12 +470,76 @@ var noExplicitReturnType = createRule6({
424
470
  });
425
471
  var no_explicit_return_type_default = noExplicitReturnType;
426
472
 
473
+ // src/rules/no-logic-in-params.ts
474
+ import { ESLintUtils as ESLintUtils8, AST_NODE_TYPES as AST_NODE_TYPES3 } from "@typescript-eslint/utils";
475
+ var createRule8 = ESLintUtils8.RuleCreator(
476
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
477
+ );
478
+ var noLogicInParams = createRule8({
479
+ name: "no-logic-in-params",
480
+ meta: {
481
+ type: "suggestion",
482
+ docs: {
483
+ description: "Disallow logic or conditions in function parameters - extract to a const variable first"
484
+ },
485
+ messages: {
486
+ noLogicInParams: "Avoid logic or conditions in function parameters. Extract to a const variable first for better readability."
487
+ },
488
+ schema: []
489
+ },
490
+ defaultOptions: [],
491
+ create(context) {
492
+ const isComplexExpression = (node) => {
493
+ if (node.type === AST_NODE_TYPES3.SpreadElement) {
494
+ return false;
495
+ }
496
+ if (node.type === AST_NODE_TYPES3.ConditionalExpression) {
497
+ return true;
498
+ }
499
+ if (node.type === AST_NODE_TYPES3.LogicalExpression) {
500
+ return true;
501
+ }
502
+ if (node.type === AST_NODE_TYPES3.BinaryExpression) {
503
+ const logicalOperators = ["==", "===", "!=", "!==", "<", ">", "<=", ">=", "in", "instanceof"];
504
+ return logicalOperators.includes(node.operator);
505
+ }
506
+ if (node.type === AST_NODE_TYPES3.UnaryExpression) {
507
+ return node.operator === "!";
508
+ }
509
+ return false;
510
+ };
511
+ return {
512
+ CallExpression(node) {
513
+ node.arguments.forEach((arg) => {
514
+ if (isComplexExpression(arg)) {
515
+ context.report({
516
+ node: arg,
517
+ messageId: "noLogicInParams"
518
+ });
519
+ }
520
+ });
521
+ },
522
+ NewExpression(node) {
523
+ node.arguments.forEach((arg) => {
524
+ if (isComplexExpression(arg)) {
525
+ context.report({
526
+ node: arg,
527
+ messageId: "noLogicInParams"
528
+ });
529
+ }
530
+ });
531
+ }
532
+ };
533
+ }
534
+ });
535
+ var no_logic_in_params_default = noLogicInParams;
536
+
427
537
  // src/rules/prefer-destructuring-params.ts
428
- import { AST_NODE_TYPES as AST_NODE_TYPES2, ESLintUtils as ESLintUtils7 } from "@typescript-eslint/utils";
429
- var createRule7 = ESLintUtils7.RuleCreator(
538
+ import { AST_NODE_TYPES as AST_NODE_TYPES4, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
539
+ var createRule9 = ESLintUtils9.RuleCreator(
430
540
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
431
541
  );
432
- var preferDestructuringParams = createRule7({
542
+ var preferDestructuringParams = createRule9({
433
543
  name: "prefer-destructuring-params",
434
544
  meta: {
435
545
  type: "suggestion",
@@ -445,18 +555,18 @@ var preferDestructuringParams = createRule7({
445
555
  create(context) {
446
556
  const isCallbackFunction = (node) => {
447
557
  const { parent } = node;
448
- return parent?.type === AST_NODE_TYPES2.CallExpression;
558
+ return parent?.type === AST_NODE_TYPES4.CallExpression;
449
559
  };
450
560
  const isDeveloperFunction = (node) => {
451
- if (node.type === AST_NODE_TYPES2.FunctionDeclaration) {
561
+ if (node.type === AST_NODE_TYPES4.FunctionDeclaration) {
452
562
  return true;
453
563
  }
454
- if (node.type === AST_NODE_TYPES2.FunctionExpression || node.type === AST_NODE_TYPES2.ArrowFunctionExpression) {
564
+ if (node.type === AST_NODE_TYPES4.FunctionExpression || node.type === AST_NODE_TYPES4.ArrowFunctionExpression) {
455
565
  if (isCallbackFunction(node)) {
456
566
  return false;
457
567
  }
458
568
  const { parent } = node;
459
- return parent?.type === AST_NODE_TYPES2.VariableDeclarator || parent?.type === AST_NODE_TYPES2.AssignmentExpression || parent?.type === AST_NODE_TYPES2.Property || parent?.type === AST_NODE_TYPES2.MethodDefinition;
569
+ return parent?.type === AST_NODE_TYPES4.VariableDeclarator || parent?.type === AST_NODE_TYPES4.AssignmentExpression || parent?.type === AST_NODE_TYPES4.Property || parent?.type === AST_NODE_TYPES4.MethodDefinition;
460
570
  }
461
571
  return false;
462
572
  };
@@ -468,7 +578,7 @@ var preferDestructuringParams = createRule7({
468
578
  if (!isDeveloperFunction(node)) {
469
579
  return;
470
580
  }
471
- if (node.type === AST_NODE_TYPES2.FunctionDeclaration && node.id) {
581
+ if (node.type === AST_NODE_TYPES4.FunctionDeclaration && node.id) {
472
582
  const functionName = node.id.name;
473
583
  if (functionName.startsWith("_") || functionName.includes("$") || /^[A-Z][a-zA-Z]*$/.test(functionName)) {
474
584
  return;
@@ -478,7 +588,7 @@ var preferDestructuringParams = createRule7({
478
588
  return;
479
589
  }
480
590
  const hasNonDestructuredParams = node.params.some(
481
- (param) => param.type !== AST_NODE_TYPES2.ObjectPattern && param.type !== AST_NODE_TYPES2.RestElement
591
+ (param) => param.type !== AST_NODE_TYPES4.ObjectPattern && param.type !== AST_NODE_TYPES4.RestElement
482
592
  );
483
593
  if (hasNonDestructuredParams) {
484
594
  context.report({
@@ -497,11 +607,11 @@ var preferDestructuringParams = createRule7({
497
607
  var prefer_destructuring_params_default = preferDestructuringParams;
498
608
 
499
609
  // src/rules/prefer-import-type.ts
500
- import { AST_NODE_TYPES as AST_NODE_TYPES3, ESLintUtils as ESLintUtils8 } from "@typescript-eslint/utils";
501
- var createRule8 = ESLintUtils8.RuleCreator(
610
+ import { AST_NODE_TYPES as AST_NODE_TYPES5, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
611
+ var createRule10 = ESLintUtils10.RuleCreator(
502
612
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
503
613
  );
504
- var preferImportType = createRule8({
614
+ var preferImportType = createRule10({
505
615
  name: "prefer-import-type",
506
616
  meta: {
507
617
  type: "suggestion",
@@ -532,14 +642,14 @@ var preferImportType = createRule8({
532
642
  return;
533
643
  }
534
644
  const isTypeOnlyImport = node.specifiers.every((specifier) => {
535
- if (specifier.type === AST_NODE_TYPES3.ImportDefaultSpecifier) {
645
+ if (specifier.type === AST_NODE_TYPES5.ImportDefaultSpecifier) {
536
646
  return false;
537
647
  }
538
- if (specifier.type === AST_NODE_TYPES3.ImportNamespaceSpecifier) {
648
+ if (specifier.type === AST_NODE_TYPES5.ImportNamespaceSpecifier) {
539
649
  return false;
540
650
  }
541
- if (specifier.type === AST_NODE_TYPES3.ImportSpecifier) {
542
- const importedName = specifier.imported.type === AST_NODE_TYPES3.Identifier ? specifier.imported.name : specifier.imported.value;
651
+ if (specifier.type === AST_NODE_TYPES5.ImportSpecifier) {
652
+ const importedName = specifier.imported.type === AST_NODE_TYPES5.Identifier ? specifier.imported.name : specifier.imported.value;
543
653
  const isKnownTypeOnly = node.source.value === "@typescript-eslint/utils" && ["TSESTree", "RuleContext"].includes(importedName) || node.source.value === "react" && ["Component", "ComponentProps", "ReactNode", "FC", "JSX", "ReactElement", "PropsWithChildren"].includes(
544
654
  importedName
545
655
  ) || importedName.endsWith("Type") || importedName.endsWith("Interface") || importedName.endsWith("Props");
@@ -567,11 +677,11 @@ var preferImportType = createRule8({
567
677
  var prefer_import_type_default = preferImportType;
568
678
 
569
679
  // src/rules/prefer-interface-over-inline-types.ts
570
- import { AST_NODE_TYPES as AST_NODE_TYPES4, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
571
- var createRule9 = ESLintUtils9.RuleCreator(
680
+ import { AST_NODE_TYPES as AST_NODE_TYPES6, ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
681
+ var createRule11 = ESLintUtils11.RuleCreator(
572
682
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
573
683
  );
574
- var preferInterfaceOverInlineTypes = createRule9({
684
+ var preferInterfaceOverInlineTypes = createRule11({
575
685
  name: "prefer-interface-over-inline-types",
576
686
  meta: {
577
687
  type: "suggestion",
@@ -587,54 +697,54 @@ var preferInterfaceOverInlineTypes = createRule9({
587
697
  defaultOptions: [],
588
698
  create(context) {
589
699
  function hasJSXInConditional(node) {
590
- return node.consequent.type === AST_NODE_TYPES4.JSXElement || node.consequent.type === AST_NODE_TYPES4.JSXFragment || node.alternate.type === AST_NODE_TYPES4.JSXElement || node.alternate.type === AST_NODE_TYPES4.JSXFragment;
700
+ return node.consequent.type === AST_NODE_TYPES6.JSXElement || node.consequent.type === AST_NODE_TYPES6.JSXFragment || node.alternate.type === AST_NODE_TYPES6.JSXElement || node.alternate.type === AST_NODE_TYPES6.JSXFragment;
591
701
  }
592
702
  function hasJSXInLogical(node) {
593
- return node.right.type === AST_NODE_TYPES4.JSXElement || node.right.type === AST_NODE_TYPES4.JSXFragment;
703
+ return node.right.type === AST_NODE_TYPES6.JSXElement || node.right.type === AST_NODE_TYPES6.JSXFragment;
594
704
  }
595
705
  function hasJSXReturn(block) {
596
706
  return block.body.some((stmt) => {
597
- if (stmt.type === AST_NODE_TYPES4.ReturnStatement && stmt.argument) {
598
- return stmt.argument.type === AST_NODE_TYPES4.JSXElement || stmt.argument.type === AST_NODE_TYPES4.JSXFragment || stmt.argument.type === AST_NODE_TYPES4.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES4.LogicalExpression && hasJSXInLogical(stmt.argument);
707
+ if (stmt.type === AST_NODE_TYPES6.ReturnStatement && stmt.argument) {
708
+ return stmt.argument.type === AST_NODE_TYPES6.JSXElement || stmt.argument.type === AST_NODE_TYPES6.JSXFragment || stmt.argument.type === AST_NODE_TYPES6.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES6.LogicalExpression && hasJSXInLogical(stmt.argument);
599
709
  }
600
710
  return false;
601
711
  });
602
712
  }
603
713
  function isReactComponent(node) {
604
- if (node.type === AST_NODE_TYPES4.ArrowFunctionExpression) {
605
- if (node.body.type === AST_NODE_TYPES4.JSXElement || node.body.type === AST_NODE_TYPES4.JSXFragment) {
714
+ if (node.type === AST_NODE_TYPES6.ArrowFunctionExpression) {
715
+ if (node.body.type === AST_NODE_TYPES6.JSXElement || node.body.type === AST_NODE_TYPES6.JSXFragment) {
606
716
  return true;
607
717
  }
608
- if (node.body.type === AST_NODE_TYPES4.BlockStatement) {
718
+ if (node.body.type === AST_NODE_TYPES6.BlockStatement) {
609
719
  return hasJSXReturn(node.body);
610
720
  }
611
- } else if (node.type === AST_NODE_TYPES4.FunctionExpression || node.type === AST_NODE_TYPES4.FunctionDeclaration) {
612
- if (node.body && node.body.type === AST_NODE_TYPES4.BlockStatement) {
721
+ } else if (node.type === AST_NODE_TYPES6.FunctionExpression || node.type === AST_NODE_TYPES6.FunctionDeclaration) {
722
+ if (node.body && node.body.type === AST_NODE_TYPES6.BlockStatement) {
613
723
  return hasJSXReturn(node.body);
614
724
  }
615
725
  }
616
726
  return false;
617
727
  }
618
728
  function isInlineTypeAnnotation(node) {
619
- if (node.type === AST_NODE_TYPES4.TSTypeLiteral) {
729
+ if (node.type === AST_NODE_TYPES6.TSTypeLiteral) {
620
730
  return true;
621
731
  }
622
- if (node.type === AST_NODE_TYPES4.TSTypeReference && node.typeArguments) {
623
- return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES4.TSTypeLiteral);
732
+ if (node.type === AST_NODE_TYPES6.TSTypeReference && node.typeArguments) {
733
+ return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES6.TSTypeLiteral);
624
734
  }
625
- if (node.type === AST_NODE_TYPES4.TSUnionType) {
735
+ if (node.type === AST_NODE_TYPES6.TSUnionType) {
626
736
  return node.types.some((type) => isInlineTypeAnnotation(type));
627
737
  }
628
738
  return false;
629
739
  }
630
740
  function hasInlineObjectType(node) {
631
- if (node.type === AST_NODE_TYPES4.TSTypeLiteral) {
741
+ if (node.type === AST_NODE_TYPES6.TSTypeLiteral) {
632
742
  return true;
633
743
  }
634
- if (node.type === AST_NODE_TYPES4.TSTypeReference && node.typeArguments) {
635
- return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES4.TSTypeLiteral);
744
+ if (node.type === AST_NODE_TYPES6.TSTypeReference && node.typeArguments) {
745
+ return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES6.TSTypeLiteral);
636
746
  }
637
- if (node.type === AST_NODE_TYPES4.TSUnionType) {
747
+ if (node.type === AST_NODE_TYPES6.TSUnionType) {
638
748
  return node.types.some((type) => hasInlineObjectType(type));
639
749
  }
640
750
  return false;
@@ -647,7 +757,7 @@ var preferInterfaceOverInlineTypes = createRule9({
647
757
  return;
648
758
  }
649
759
  const param = node.params[0];
650
- if (param.type === AST_NODE_TYPES4.Identifier && param.typeAnnotation) {
760
+ if (param.type === AST_NODE_TYPES6.Identifier && param.typeAnnotation) {
651
761
  const { typeAnnotation } = param.typeAnnotation;
652
762
  if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
653
763
  context.report({
@@ -666,12 +776,74 @@ var preferInterfaceOverInlineTypes = createRule9({
666
776
  });
667
777
  var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
668
778
 
779
+ // src/rules/prefer-named-param-types.ts
780
+ import { AST_NODE_TYPES as AST_NODE_TYPES7, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
781
+ var createRule12 = ESLintUtils12.RuleCreator(
782
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
783
+ );
784
+ var preferNamedParamTypes = createRule12({
785
+ name: "prefer-named-param-types",
786
+ meta: {
787
+ type: "suggestion",
788
+ docs: {
789
+ description: "Enforce named interfaces/types instead of inline object types for function parameters"
790
+ },
791
+ messages: {
792
+ preferNamedParamTypes: "Use a named interface or type for object parameter types instead of inline type annotations"
793
+ },
794
+ schema: []
795
+ },
796
+ defaultOptions: [],
797
+ create(context) {
798
+ function hasInlineObjectType(param) {
799
+ if (param.type === AST_NODE_TYPES7.AssignmentPattern) {
800
+ return hasInlineObjectType(param.left);
801
+ }
802
+ if (param.type === AST_NODE_TYPES7.ObjectPattern) {
803
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES7.TSTypeLiteral) {
804
+ return true;
805
+ }
806
+ }
807
+ if (param.type === AST_NODE_TYPES7.Identifier) {
808
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES7.TSTypeLiteral) {
809
+ return true;
810
+ }
811
+ }
812
+ return false;
813
+ }
814
+ function checkFunction(node) {
815
+ let params = [];
816
+ if ("params" in node) {
817
+ params = node.params;
818
+ } else if ("value" in node && node.value) {
819
+ params = node.value.params;
820
+ }
821
+ params.forEach((param) => {
822
+ if (hasInlineObjectType(param)) {
823
+ context.report({
824
+ node: param,
825
+ messageId: "preferNamedParamTypes"
826
+ });
827
+ }
828
+ });
829
+ }
830
+ return {
831
+ FunctionDeclaration: checkFunction,
832
+ FunctionExpression: checkFunction,
833
+ ArrowFunctionExpression: checkFunction,
834
+ TSMethodSignature: checkFunction,
835
+ MethodDefinition: checkFunction
836
+ };
837
+ }
838
+ });
839
+ var prefer_named_param_types_default = preferNamedParamTypes;
840
+
669
841
  // src/rules/prefer-react-import-types.ts
670
- import { AST_NODE_TYPES as AST_NODE_TYPES5, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
671
- var createRule10 = ESLintUtils10.RuleCreator(
842
+ import { AST_NODE_TYPES as AST_NODE_TYPES8, ESLintUtils as ESLintUtils13 } from "@typescript-eslint/utils";
843
+ var createRule13 = ESLintUtils13.RuleCreator(
672
844
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
673
845
  );
674
- var preferReactImportTypes = createRule10({
846
+ var preferReactImportTypes = createRule13({
675
847
  name: "prefer-react-import-types",
676
848
  meta: {
677
849
  type: "suggestion",
@@ -747,7 +919,7 @@ var preferReactImportTypes = createRule10({
747
919
  ]);
748
920
  const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
749
921
  function checkMemberExpression(node) {
750
- if (node.object.type === AST_NODE_TYPES5.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES5.Identifier && allReactExports.has(node.property.name)) {
922
+ if (node.object.type === AST_NODE_TYPES8.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES8.Identifier && allReactExports.has(node.property.name)) {
751
923
  const typeName = node.property.name;
752
924
  const isType = reactTypes.has(typeName);
753
925
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -764,7 +936,7 @@ var preferReactImportTypes = createRule10({
764
936
  return {
765
937
  MemberExpression: checkMemberExpression,
766
938
  "TSTypeReference > TSQualifiedName": (node) => {
767
- if (node.left.type === AST_NODE_TYPES5.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES5.Identifier && allReactExports.has(node.right.name)) {
939
+ if (node.left.type === AST_NODE_TYPES8.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES8.Identifier && allReactExports.has(node.right.name)) {
768
940
  const typeName = node.right.name;
769
941
  const isType = reactTypes.has(typeName);
770
942
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -784,11 +956,11 @@ var preferReactImportTypes = createRule10({
784
956
  var prefer_react_import_types_default = preferReactImportTypes;
785
957
 
786
958
  // src/rules/react-props-destructure.ts
787
- import { AST_NODE_TYPES as AST_NODE_TYPES6, ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
788
- var createRule11 = ESLintUtils11.RuleCreator(
959
+ import { AST_NODE_TYPES as AST_NODE_TYPES9, ESLintUtils as ESLintUtils14 } from "@typescript-eslint/utils";
960
+ var createRule14 = ESLintUtils14.RuleCreator(
789
961
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
790
962
  );
791
- var reactPropsDestructure = createRule11({
963
+ var reactPropsDestructure = createRule14({
792
964
  name: "react-props-destructure",
793
965
  meta: {
794
966
  type: "suggestion",
@@ -804,29 +976,29 @@ var reactPropsDestructure = createRule11({
804
976
  defaultOptions: [],
805
977
  create(context) {
806
978
  function hasJSXInConditional(node) {
807
- return node.consequent.type === AST_NODE_TYPES6.JSXElement || node.consequent.type === AST_NODE_TYPES6.JSXFragment || node.alternate.type === AST_NODE_TYPES6.JSXElement || node.alternate.type === AST_NODE_TYPES6.JSXFragment;
979
+ return node.consequent.type === AST_NODE_TYPES9.JSXElement || node.consequent.type === AST_NODE_TYPES9.JSXFragment || node.alternate.type === AST_NODE_TYPES9.JSXElement || node.alternate.type === AST_NODE_TYPES9.JSXFragment;
808
980
  }
809
981
  function hasJSXInLogical(node) {
810
- return node.right.type === AST_NODE_TYPES6.JSXElement || node.right.type === AST_NODE_TYPES6.JSXFragment;
982
+ return node.right.type === AST_NODE_TYPES9.JSXElement || node.right.type === AST_NODE_TYPES9.JSXFragment;
811
983
  }
812
984
  function hasJSXReturn(block) {
813
985
  return block.body.some((stmt) => {
814
- if (stmt.type === AST_NODE_TYPES6.ReturnStatement && stmt.argument) {
815
- return stmt.argument.type === AST_NODE_TYPES6.JSXElement || stmt.argument.type === AST_NODE_TYPES6.JSXFragment || stmt.argument.type === AST_NODE_TYPES6.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES6.LogicalExpression && hasJSXInLogical(stmt.argument);
986
+ if (stmt.type === AST_NODE_TYPES9.ReturnStatement && stmt.argument) {
987
+ return stmt.argument.type === AST_NODE_TYPES9.JSXElement || stmt.argument.type === AST_NODE_TYPES9.JSXFragment || stmt.argument.type === AST_NODE_TYPES9.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES9.LogicalExpression && hasJSXInLogical(stmt.argument);
816
988
  }
817
989
  return false;
818
990
  });
819
991
  }
820
992
  function isReactComponent(node) {
821
- if (node.type === AST_NODE_TYPES6.ArrowFunctionExpression) {
822
- if (node.body.type === AST_NODE_TYPES6.JSXElement || node.body.type === AST_NODE_TYPES6.JSXFragment) {
993
+ if (node.type === AST_NODE_TYPES9.ArrowFunctionExpression) {
994
+ if (node.body.type === AST_NODE_TYPES9.JSXElement || node.body.type === AST_NODE_TYPES9.JSXFragment) {
823
995
  return true;
824
996
  }
825
- if (node.body.type === AST_NODE_TYPES6.BlockStatement) {
997
+ if (node.body.type === AST_NODE_TYPES9.BlockStatement) {
826
998
  return hasJSXReturn(node.body);
827
999
  }
828
- } else if (node.type === AST_NODE_TYPES6.FunctionExpression || node.type === AST_NODE_TYPES6.FunctionDeclaration) {
829
- if (node.body && node.body.type === AST_NODE_TYPES6.BlockStatement) {
1000
+ } else if (node.type === AST_NODE_TYPES9.FunctionExpression || node.type === AST_NODE_TYPES9.FunctionDeclaration) {
1001
+ if (node.body && node.body.type === AST_NODE_TYPES9.BlockStatement) {
830
1002
  return hasJSXReturn(node.body);
831
1003
  }
832
1004
  }
@@ -840,9 +1012,9 @@ var reactPropsDestructure = createRule11({
840
1012
  return;
841
1013
  }
842
1014
  const param = node.params[0];
843
- if (param.type === AST_NODE_TYPES6.ObjectPattern) {
844
- const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES6.Property).map((prop) => {
845
- if (prop.key.type === AST_NODE_TYPES6.Identifier) {
1015
+ if (param.type === AST_NODE_TYPES9.ObjectPattern) {
1016
+ const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES9.Property).map((prop) => {
1017
+ if (prop.key.type === AST_NODE_TYPES9.Identifier) {
846
1018
  return prop.key.name;
847
1019
  }
848
1020
  return null;
@@ -878,11 +1050,14 @@ var rules = {
878
1050
  "file-kebab-case": file_kebab_case_default,
879
1051
  "jsx-pascal-case": jsx_pascal_case_default,
880
1052
  "md-filename-case-restriction": md_filename_case_restriction_default,
1053
+ "no-complex-inline-return": no_complex_inline_return_default,
881
1054
  "no-emoji": no_emoji_default,
882
1055
  "no-explicit-return-type": no_explicit_return_type_default,
1056
+ "no-logic-in-params": no_logic_in_params_default,
883
1057
  "prefer-destructuring-params": prefer_destructuring_params_default,
884
1058
  "prefer-import-type": prefer_import_type_default,
885
1059
  "prefer-interface-over-inline-types": prefer_interface_over_inline_types_default,
1060
+ "prefer-named-param-types": prefer_named_param_types_default,
886
1061
  "prefer-react-import-types": prefer_react_import_types_default,
887
1062
  "react-props-destructure": react_props_destructure_default
888
1063
  };
@@ -897,7 +1072,10 @@ var baseRules = {
897
1072
  "nextfriday/prefer-destructuring-params": "warn",
898
1073
  "nextfriday/no-explicit-return-type": "warn",
899
1074
  "nextfriday/prefer-import-type": "warn",
900
- "nextfriday/prefer-react-import-types": "warn"
1075
+ "nextfriday/prefer-named-param-types": "warn",
1076
+ "nextfriday/prefer-react-import-types": "warn",
1077
+ "nextfriday/no-complex-inline-return": "warn",
1078
+ "nextfriday/no-logic-in-params": "warn"
901
1079
  };
902
1080
  var baseRecommendedRules = {
903
1081
  "nextfriday/no-emoji": "error",
@@ -906,7 +1084,10 @@ var baseRecommendedRules = {
906
1084
  "nextfriday/prefer-destructuring-params": "error",
907
1085
  "nextfriday/no-explicit-return-type": "error",
908
1086
  "nextfriday/prefer-import-type": "error",
909
- "nextfriday/prefer-react-import-types": "error"
1087
+ "nextfriday/prefer-named-param-types": "error",
1088
+ "nextfriday/prefer-react-import-types": "error",
1089
+ "nextfriday/no-complex-inline-return": "error",
1090
+ "nextfriday/no-logic-in-params": "error"
910
1091
  };
911
1092
  var jsxRules = {
912
1093
  "nextfriday/jsx-pascal-case": "warn",