eslint-plugin-nextfriday 1.3.0 → 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.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: "1.3.0",
43
+ version: "1.4.0",
44
44
  description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
45
45
  keywords: [
46
46
  "eslint",
@@ -380,13 +380,59 @@ var mdFilenameCaseRestriction = createRule4({
380
380
  });
381
381
  var md_filename_case_restriction_default = mdFilenameCaseRestriction;
382
382
 
383
- // src/rules/no-emoji.ts
384
- var import_emoji_regex = __toESM(require("emoji-regex"), 1);
383
+ // src/rules/no-complex-inline-return.ts
385
384
  var import_utils5 = require("@typescript-eslint/utils");
386
385
  var createRule5 = import_utils5.ESLintUtils.RuleCreator(
387
386
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
388
387
  );
389
- var noEmoji = createRule5({
388
+ var noComplexInlineReturn = createRule5({
389
+ name: "no-complex-inline-return",
390
+ meta: {
391
+ type: "suggestion",
392
+ docs: {
393
+ description: "Disallow complex inline expressions in return statements - prefer extracting to a const first"
394
+ },
395
+ messages: {
396
+ noComplexInlineReturn: "Avoid returning complex expressions directly. Extract to a const variable first for better readability."
397
+ },
398
+ schema: []
399
+ },
400
+ defaultOptions: [],
401
+ create(context) {
402
+ const isComplexExpression = (node) => {
403
+ if (!node) return false;
404
+ if (node.type === import_utils5.AST_NODE_TYPES.ConditionalExpression) {
405
+ return true;
406
+ }
407
+ if (node.type === import_utils5.AST_NODE_TYPES.LogicalExpression) {
408
+ return true;
409
+ }
410
+ if (node.type === import_utils5.AST_NODE_TYPES.NewExpression) {
411
+ return true;
412
+ }
413
+ return false;
414
+ };
415
+ return {
416
+ ReturnStatement(node) {
417
+ if (node.argument && isComplexExpression(node.argument)) {
418
+ context.report({
419
+ node: node.argument,
420
+ messageId: "noComplexInlineReturn"
421
+ });
422
+ }
423
+ }
424
+ };
425
+ }
426
+ });
427
+ var no_complex_inline_return_default = noComplexInlineReturn;
428
+
429
+ // src/rules/no-emoji.ts
430
+ var import_emoji_regex = __toESM(require("emoji-regex"), 1);
431
+ var import_utils6 = require("@typescript-eslint/utils");
432
+ var createRule6 = import_utils6.ESLintUtils.RuleCreator(
433
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
434
+ );
435
+ var noEmoji = createRule6({
390
436
  name: "no-emoji",
391
437
  meta: {
392
438
  type: "problem",
@@ -420,11 +466,11 @@ var noEmoji = createRule5({
420
466
  var no_emoji_default = noEmoji;
421
467
 
422
468
  // src/rules/no-explicit-return-type.ts
423
- var import_utils6 = require("@typescript-eslint/utils");
424
- var createRule6 = import_utils6.ESLintUtils.RuleCreator(
469
+ var import_utils7 = require("@typescript-eslint/utils");
470
+ var createRule7 = import_utils7.ESLintUtils.RuleCreator(
425
471
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
426
472
  );
427
- var noExplicitReturnType = createRule6({
473
+ var noExplicitReturnType = createRule7({
428
474
  name: "no-explicit-return-type",
429
475
  meta: {
430
476
  type: "suggestion",
@@ -463,12 +509,76 @@ var noExplicitReturnType = createRule6({
463
509
  });
464
510
  var no_explicit_return_type_default = noExplicitReturnType;
465
511
 
512
+ // src/rules/no-logic-in-params.ts
513
+ var import_utils8 = require("@typescript-eslint/utils");
514
+ var createRule8 = import_utils8.ESLintUtils.RuleCreator(
515
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
516
+ );
517
+ var noLogicInParams = createRule8({
518
+ name: "no-logic-in-params",
519
+ meta: {
520
+ type: "suggestion",
521
+ docs: {
522
+ description: "Disallow logic or conditions in function parameters - extract to a const variable first"
523
+ },
524
+ messages: {
525
+ noLogicInParams: "Avoid logic or conditions in function parameters. Extract to a const variable first for better readability."
526
+ },
527
+ schema: []
528
+ },
529
+ defaultOptions: [],
530
+ create(context) {
531
+ const isComplexExpression = (node) => {
532
+ if (node.type === import_utils8.AST_NODE_TYPES.SpreadElement) {
533
+ return false;
534
+ }
535
+ if (node.type === import_utils8.AST_NODE_TYPES.ConditionalExpression) {
536
+ return true;
537
+ }
538
+ if (node.type === import_utils8.AST_NODE_TYPES.LogicalExpression) {
539
+ return true;
540
+ }
541
+ if (node.type === import_utils8.AST_NODE_TYPES.BinaryExpression) {
542
+ const logicalOperators = ["==", "===", "!=", "!==", "<", ">", "<=", ">=", "in", "instanceof"];
543
+ return logicalOperators.includes(node.operator);
544
+ }
545
+ if (node.type === import_utils8.AST_NODE_TYPES.UnaryExpression) {
546
+ return node.operator === "!";
547
+ }
548
+ return false;
549
+ };
550
+ return {
551
+ CallExpression(node) {
552
+ node.arguments.forEach((arg) => {
553
+ if (isComplexExpression(arg)) {
554
+ context.report({
555
+ node: arg,
556
+ messageId: "noLogicInParams"
557
+ });
558
+ }
559
+ });
560
+ },
561
+ NewExpression(node) {
562
+ node.arguments.forEach((arg) => {
563
+ if (isComplexExpression(arg)) {
564
+ context.report({
565
+ node: arg,
566
+ messageId: "noLogicInParams"
567
+ });
568
+ }
569
+ });
570
+ }
571
+ };
572
+ }
573
+ });
574
+ var no_logic_in_params_default = noLogicInParams;
575
+
466
576
  // src/rules/prefer-destructuring-params.ts
467
- var import_utils7 = require("@typescript-eslint/utils");
468
- var createRule7 = import_utils7.ESLintUtils.RuleCreator(
577
+ var import_utils9 = require("@typescript-eslint/utils");
578
+ var createRule9 = import_utils9.ESLintUtils.RuleCreator(
469
579
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
470
580
  );
471
- var preferDestructuringParams = createRule7({
581
+ var preferDestructuringParams = createRule9({
472
582
  name: "prefer-destructuring-params",
473
583
  meta: {
474
584
  type: "suggestion",
@@ -484,18 +594,18 @@ var preferDestructuringParams = createRule7({
484
594
  create(context) {
485
595
  const isCallbackFunction = (node) => {
486
596
  const { parent } = node;
487
- return parent?.type === import_utils7.AST_NODE_TYPES.CallExpression;
597
+ return parent?.type === import_utils9.AST_NODE_TYPES.CallExpression;
488
598
  };
489
599
  const isDeveloperFunction = (node) => {
490
- if (node.type === import_utils7.AST_NODE_TYPES.FunctionDeclaration) {
600
+ if (node.type === import_utils9.AST_NODE_TYPES.FunctionDeclaration) {
491
601
  return true;
492
602
  }
493
- if (node.type === import_utils7.AST_NODE_TYPES.FunctionExpression || node.type === import_utils7.AST_NODE_TYPES.ArrowFunctionExpression) {
603
+ if (node.type === import_utils9.AST_NODE_TYPES.FunctionExpression || node.type === import_utils9.AST_NODE_TYPES.ArrowFunctionExpression) {
494
604
  if (isCallbackFunction(node)) {
495
605
  return false;
496
606
  }
497
607
  const { parent } = node;
498
- return parent?.type === import_utils7.AST_NODE_TYPES.VariableDeclarator || parent?.type === import_utils7.AST_NODE_TYPES.AssignmentExpression || parent?.type === import_utils7.AST_NODE_TYPES.Property || parent?.type === import_utils7.AST_NODE_TYPES.MethodDefinition;
608
+ return parent?.type === import_utils9.AST_NODE_TYPES.VariableDeclarator || parent?.type === import_utils9.AST_NODE_TYPES.AssignmentExpression || parent?.type === import_utils9.AST_NODE_TYPES.Property || parent?.type === import_utils9.AST_NODE_TYPES.MethodDefinition;
499
609
  }
500
610
  return false;
501
611
  };
@@ -507,7 +617,7 @@ var preferDestructuringParams = createRule7({
507
617
  if (!isDeveloperFunction(node)) {
508
618
  return;
509
619
  }
510
- if (node.type === import_utils7.AST_NODE_TYPES.FunctionDeclaration && node.id) {
620
+ if (node.type === import_utils9.AST_NODE_TYPES.FunctionDeclaration && node.id) {
511
621
  const functionName = node.id.name;
512
622
  if (functionName.startsWith("_") || functionName.includes("$") || /^[A-Z][a-zA-Z]*$/.test(functionName)) {
513
623
  return;
@@ -517,7 +627,7 @@ var preferDestructuringParams = createRule7({
517
627
  return;
518
628
  }
519
629
  const hasNonDestructuredParams = node.params.some(
520
- (param) => param.type !== import_utils7.AST_NODE_TYPES.ObjectPattern && param.type !== import_utils7.AST_NODE_TYPES.RestElement
630
+ (param) => param.type !== import_utils9.AST_NODE_TYPES.ObjectPattern && param.type !== import_utils9.AST_NODE_TYPES.RestElement
521
631
  );
522
632
  if (hasNonDestructuredParams) {
523
633
  context.report({
@@ -536,11 +646,11 @@ var preferDestructuringParams = createRule7({
536
646
  var prefer_destructuring_params_default = preferDestructuringParams;
537
647
 
538
648
  // src/rules/prefer-import-type.ts
539
- var import_utils8 = require("@typescript-eslint/utils");
540
- var createRule8 = import_utils8.ESLintUtils.RuleCreator(
649
+ var import_utils10 = require("@typescript-eslint/utils");
650
+ var createRule10 = import_utils10.ESLintUtils.RuleCreator(
541
651
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
542
652
  );
543
- var preferImportType = createRule8({
653
+ var preferImportType = createRule10({
544
654
  name: "prefer-import-type",
545
655
  meta: {
546
656
  type: "suggestion",
@@ -571,14 +681,14 @@ var preferImportType = createRule8({
571
681
  return;
572
682
  }
573
683
  const isTypeOnlyImport = node.specifiers.every((specifier) => {
574
- if (specifier.type === import_utils8.AST_NODE_TYPES.ImportDefaultSpecifier) {
684
+ if (specifier.type === import_utils10.AST_NODE_TYPES.ImportDefaultSpecifier) {
575
685
  return false;
576
686
  }
577
- if (specifier.type === import_utils8.AST_NODE_TYPES.ImportNamespaceSpecifier) {
687
+ if (specifier.type === import_utils10.AST_NODE_TYPES.ImportNamespaceSpecifier) {
578
688
  return false;
579
689
  }
580
- if (specifier.type === import_utils8.AST_NODE_TYPES.ImportSpecifier) {
581
- const importedName = specifier.imported.type === import_utils8.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
690
+ if (specifier.type === import_utils10.AST_NODE_TYPES.ImportSpecifier) {
691
+ const importedName = specifier.imported.type === import_utils10.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
582
692
  const isKnownTypeOnly = node.source.value === "@typescript-eslint/utils" && ["TSESTree", "RuleContext"].includes(importedName) || node.source.value === "react" && ["Component", "ComponentProps", "ReactNode", "FC", "JSX", "ReactElement", "PropsWithChildren"].includes(
583
693
  importedName
584
694
  ) || importedName.endsWith("Type") || importedName.endsWith("Interface") || importedName.endsWith("Props");
@@ -606,11 +716,11 @@ var preferImportType = createRule8({
606
716
  var prefer_import_type_default = preferImportType;
607
717
 
608
718
  // src/rules/prefer-interface-over-inline-types.ts
609
- var import_utils9 = require("@typescript-eslint/utils");
610
- var createRule9 = import_utils9.ESLintUtils.RuleCreator(
719
+ var import_utils11 = require("@typescript-eslint/utils");
720
+ var createRule11 = import_utils11.ESLintUtils.RuleCreator(
611
721
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
612
722
  );
613
- var preferInterfaceOverInlineTypes = createRule9({
723
+ var preferInterfaceOverInlineTypes = createRule11({
614
724
  name: "prefer-interface-over-inline-types",
615
725
  meta: {
616
726
  type: "suggestion",
@@ -626,54 +736,54 @@ var preferInterfaceOverInlineTypes = createRule9({
626
736
  defaultOptions: [],
627
737
  create(context) {
628
738
  function hasJSXInConditional(node) {
629
- 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;
739
+ return node.consequent.type === import_utils11.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils11.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils11.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils11.AST_NODE_TYPES.JSXFragment;
630
740
  }
631
741
  function hasJSXInLogical(node) {
632
- return node.right.type === import_utils9.AST_NODE_TYPES.JSXElement || node.right.type === import_utils9.AST_NODE_TYPES.JSXFragment;
742
+ return node.right.type === import_utils11.AST_NODE_TYPES.JSXElement || node.right.type === import_utils11.AST_NODE_TYPES.JSXFragment;
633
743
  }
634
744
  function hasJSXReturn(block) {
635
745
  return block.body.some((stmt) => {
636
- if (stmt.type === import_utils9.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
637
- 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);
746
+ if (stmt.type === import_utils11.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
747
+ return stmt.argument.type === import_utils11.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils11.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils11.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils11.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
638
748
  }
639
749
  return false;
640
750
  });
641
751
  }
642
752
  function isReactComponent(node) {
643
- if (node.type === import_utils9.AST_NODE_TYPES.ArrowFunctionExpression) {
644
- if (node.body.type === import_utils9.AST_NODE_TYPES.JSXElement || node.body.type === import_utils9.AST_NODE_TYPES.JSXFragment) {
753
+ if (node.type === import_utils11.AST_NODE_TYPES.ArrowFunctionExpression) {
754
+ if (node.body.type === import_utils11.AST_NODE_TYPES.JSXElement || node.body.type === import_utils11.AST_NODE_TYPES.JSXFragment) {
645
755
  return true;
646
756
  }
647
- if (node.body.type === import_utils9.AST_NODE_TYPES.BlockStatement) {
757
+ if (node.body.type === import_utils11.AST_NODE_TYPES.BlockStatement) {
648
758
  return hasJSXReturn(node.body);
649
759
  }
650
- } else if (node.type === import_utils9.AST_NODE_TYPES.FunctionExpression || node.type === import_utils9.AST_NODE_TYPES.FunctionDeclaration) {
651
- if (node.body && node.body.type === import_utils9.AST_NODE_TYPES.BlockStatement) {
760
+ } else if (node.type === import_utils11.AST_NODE_TYPES.FunctionExpression || node.type === import_utils11.AST_NODE_TYPES.FunctionDeclaration) {
761
+ if (node.body && node.body.type === import_utils11.AST_NODE_TYPES.BlockStatement) {
652
762
  return hasJSXReturn(node.body);
653
763
  }
654
764
  }
655
765
  return false;
656
766
  }
657
767
  function isInlineTypeAnnotation(node) {
658
- if (node.type === import_utils9.AST_NODE_TYPES.TSTypeLiteral) {
768
+ if (node.type === import_utils11.AST_NODE_TYPES.TSTypeLiteral) {
659
769
  return true;
660
770
  }
661
- if (node.type === import_utils9.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
662
- return node.typeArguments.params.some((param) => param.type === import_utils9.AST_NODE_TYPES.TSTypeLiteral);
771
+ if (node.type === import_utils11.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
772
+ return node.typeArguments.params.some((param) => param.type === import_utils11.AST_NODE_TYPES.TSTypeLiteral);
663
773
  }
664
- if (node.type === import_utils9.AST_NODE_TYPES.TSUnionType) {
774
+ if (node.type === import_utils11.AST_NODE_TYPES.TSUnionType) {
665
775
  return node.types.some((type) => isInlineTypeAnnotation(type));
666
776
  }
667
777
  return false;
668
778
  }
669
779
  function hasInlineObjectType(node) {
670
- if (node.type === import_utils9.AST_NODE_TYPES.TSTypeLiteral) {
780
+ if (node.type === import_utils11.AST_NODE_TYPES.TSTypeLiteral) {
671
781
  return true;
672
782
  }
673
- if (node.type === import_utils9.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
674
- return node.typeArguments.params.some((param) => param.type === import_utils9.AST_NODE_TYPES.TSTypeLiteral);
783
+ if (node.type === import_utils11.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
784
+ return node.typeArguments.params.some((param) => param.type === import_utils11.AST_NODE_TYPES.TSTypeLiteral);
675
785
  }
676
- if (node.type === import_utils9.AST_NODE_TYPES.TSUnionType) {
786
+ if (node.type === import_utils11.AST_NODE_TYPES.TSUnionType) {
677
787
  return node.types.some((type) => hasInlineObjectType(type));
678
788
  }
679
789
  return false;
@@ -686,7 +796,7 @@ var preferInterfaceOverInlineTypes = createRule9({
686
796
  return;
687
797
  }
688
798
  const param = node.params[0];
689
- if (param.type === import_utils9.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
799
+ if (param.type === import_utils11.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
690
800
  const { typeAnnotation } = param.typeAnnotation;
691
801
  if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
692
802
  context.report({
@@ -706,11 +816,11 @@ var preferInterfaceOverInlineTypes = createRule9({
706
816
  var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
707
817
 
708
818
  // src/rules/prefer-named-param-types.ts
709
- var import_utils10 = require("@typescript-eslint/utils");
710
- var createRule10 = import_utils10.ESLintUtils.RuleCreator(
819
+ var import_utils12 = require("@typescript-eslint/utils");
820
+ var createRule12 = import_utils12.ESLintUtils.RuleCreator(
711
821
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
712
822
  );
713
- var preferNamedParamTypes = createRule10({
823
+ var preferNamedParamTypes = createRule12({
714
824
  name: "prefer-named-param-types",
715
825
  meta: {
716
826
  type: "suggestion",
@@ -725,16 +835,16 @@ var preferNamedParamTypes = createRule10({
725
835
  defaultOptions: [],
726
836
  create(context) {
727
837
  function hasInlineObjectType(param) {
728
- if (param.type === import_utils10.AST_NODE_TYPES.AssignmentPattern) {
838
+ if (param.type === import_utils12.AST_NODE_TYPES.AssignmentPattern) {
729
839
  return hasInlineObjectType(param.left);
730
840
  }
731
- if (param.type === import_utils10.AST_NODE_TYPES.ObjectPattern) {
732
- if (param.typeAnnotation?.typeAnnotation.type === import_utils10.AST_NODE_TYPES.TSTypeLiteral) {
841
+ if (param.type === import_utils12.AST_NODE_TYPES.ObjectPattern) {
842
+ if (param.typeAnnotation?.typeAnnotation.type === import_utils12.AST_NODE_TYPES.TSTypeLiteral) {
733
843
  return true;
734
844
  }
735
845
  }
736
- if (param.type === import_utils10.AST_NODE_TYPES.Identifier) {
737
- if (param.typeAnnotation?.typeAnnotation.type === import_utils10.AST_NODE_TYPES.TSTypeLiteral) {
846
+ if (param.type === import_utils12.AST_NODE_TYPES.Identifier) {
847
+ if (param.typeAnnotation?.typeAnnotation.type === import_utils12.AST_NODE_TYPES.TSTypeLiteral) {
738
848
  return true;
739
849
  }
740
850
  }
@@ -768,11 +878,11 @@ var preferNamedParamTypes = createRule10({
768
878
  var prefer_named_param_types_default = preferNamedParamTypes;
769
879
 
770
880
  // src/rules/prefer-react-import-types.ts
771
- var import_utils11 = require("@typescript-eslint/utils");
772
- var createRule11 = import_utils11.ESLintUtils.RuleCreator(
881
+ var import_utils13 = require("@typescript-eslint/utils");
882
+ var createRule13 = import_utils13.ESLintUtils.RuleCreator(
773
883
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
774
884
  );
775
- var preferReactImportTypes = createRule11({
885
+ var preferReactImportTypes = createRule13({
776
886
  name: "prefer-react-import-types",
777
887
  meta: {
778
888
  type: "suggestion",
@@ -848,7 +958,7 @@ var preferReactImportTypes = createRule11({
848
958
  ]);
849
959
  const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
850
960
  function checkMemberExpression(node) {
851
- if (node.object.type === import_utils11.AST_NODE_TYPES.Identifier && node.object.name === "React" && node.property.type === import_utils11.AST_NODE_TYPES.Identifier && allReactExports.has(node.property.name)) {
961
+ if (node.object.type === import_utils13.AST_NODE_TYPES.Identifier && node.object.name === "React" && node.property.type === import_utils13.AST_NODE_TYPES.Identifier && allReactExports.has(node.property.name)) {
852
962
  const typeName = node.property.name;
853
963
  const isType = reactTypes.has(typeName);
854
964
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -865,7 +975,7 @@ var preferReactImportTypes = createRule11({
865
975
  return {
866
976
  MemberExpression: checkMemberExpression,
867
977
  "TSTypeReference > TSQualifiedName": (node) => {
868
- if (node.left.type === import_utils11.AST_NODE_TYPES.Identifier && node.left.name === "React" && node.right.type === import_utils11.AST_NODE_TYPES.Identifier && allReactExports.has(node.right.name)) {
978
+ if (node.left.type === import_utils13.AST_NODE_TYPES.Identifier && node.left.name === "React" && node.right.type === import_utils13.AST_NODE_TYPES.Identifier && allReactExports.has(node.right.name)) {
869
979
  const typeName = node.right.name;
870
980
  const isType = reactTypes.has(typeName);
871
981
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -885,11 +995,11 @@ var preferReactImportTypes = createRule11({
885
995
  var prefer_react_import_types_default = preferReactImportTypes;
886
996
 
887
997
  // src/rules/react-props-destructure.ts
888
- var import_utils12 = require("@typescript-eslint/utils");
889
- var createRule12 = import_utils12.ESLintUtils.RuleCreator(
998
+ var import_utils14 = require("@typescript-eslint/utils");
999
+ var createRule14 = import_utils14.ESLintUtils.RuleCreator(
890
1000
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
891
1001
  );
892
- var reactPropsDestructure = createRule12({
1002
+ var reactPropsDestructure = createRule14({
893
1003
  name: "react-props-destructure",
894
1004
  meta: {
895
1005
  type: "suggestion",
@@ -905,29 +1015,29 @@ var reactPropsDestructure = createRule12({
905
1015
  defaultOptions: [],
906
1016
  create(context) {
907
1017
  function hasJSXInConditional(node) {
908
- return node.consequent.type === import_utils12.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils12.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils12.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils12.AST_NODE_TYPES.JSXFragment;
1018
+ return node.consequent.type === import_utils14.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils14.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils14.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils14.AST_NODE_TYPES.JSXFragment;
909
1019
  }
910
1020
  function hasJSXInLogical(node) {
911
- return node.right.type === import_utils12.AST_NODE_TYPES.JSXElement || node.right.type === import_utils12.AST_NODE_TYPES.JSXFragment;
1021
+ return node.right.type === import_utils14.AST_NODE_TYPES.JSXElement || node.right.type === import_utils14.AST_NODE_TYPES.JSXFragment;
912
1022
  }
913
1023
  function hasJSXReturn(block) {
914
1024
  return block.body.some((stmt) => {
915
- if (stmt.type === import_utils12.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
916
- return stmt.argument.type === import_utils12.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils12.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils12.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils12.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
1025
+ if (stmt.type === import_utils14.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
1026
+ return stmt.argument.type === import_utils14.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils14.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils14.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils14.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
917
1027
  }
918
1028
  return false;
919
1029
  });
920
1030
  }
921
1031
  function isReactComponent(node) {
922
- if (node.type === import_utils12.AST_NODE_TYPES.ArrowFunctionExpression) {
923
- if (node.body.type === import_utils12.AST_NODE_TYPES.JSXElement || node.body.type === import_utils12.AST_NODE_TYPES.JSXFragment) {
1032
+ if (node.type === import_utils14.AST_NODE_TYPES.ArrowFunctionExpression) {
1033
+ if (node.body.type === import_utils14.AST_NODE_TYPES.JSXElement || node.body.type === import_utils14.AST_NODE_TYPES.JSXFragment) {
924
1034
  return true;
925
1035
  }
926
- if (node.body.type === import_utils12.AST_NODE_TYPES.BlockStatement) {
1036
+ if (node.body.type === import_utils14.AST_NODE_TYPES.BlockStatement) {
927
1037
  return hasJSXReturn(node.body);
928
1038
  }
929
- } else if (node.type === import_utils12.AST_NODE_TYPES.FunctionExpression || node.type === import_utils12.AST_NODE_TYPES.FunctionDeclaration) {
930
- if (node.body && node.body.type === import_utils12.AST_NODE_TYPES.BlockStatement) {
1039
+ } else if (node.type === import_utils14.AST_NODE_TYPES.FunctionExpression || node.type === import_utils14.AST_NODE_TYPES.FunctionDeclaration) {
1040
+ if (node.body && node.body.type === import_utils14.AST_NODE_TYPES.BlockStatement) {
931
1041
  return hasJSXReturn(node.body);
932
1042
  }
933
1043
  }
@@ -941,9 +1051,9 @@ var reactPropsDestructure = createRule12({
941
1051
  return;
942
1052
  }
943
1053
  const param = node.params[0];
944
- if (param.type === import_utils12.AST_NODE_TYPES.ObjectPattern) {
945
- const properties = param.properties.filter((prop) => prop.type === import_utils12.AST_NODE_TYPES.Property).map((prop) => {
946
- if (prop.key.type === import_utils12.AST_NODE_TYPES.Identifier) {
1054
+ if (param.type === import_utils14.AST_NODE_TYPES.ObjectPattern) {
1055
+ const properties = param.properties.filter((prop) => prop.type === import_utils14.AST_NODE_TYPES.Property).map((prop) => {
1056
+ if (prop.key.type === import_utils14.AST_NODE_TYPES.Identifier) {
947
1057
  return prop.key.name;
948
1058
  }
949
1059
  return null;
@@ -979,8 +1089,10 @@ var rules = {
979
1089
  "file-kebab-case": file_kebab_case_default,
980
1090
  "jsx-pascal-case": jsx_pascal_case_default,
981
1091
  "md-filename-case-restriction": md_filename_case_restriction_default,
1092
+ "no-complex-inline-return": no_complex_inline_return_default,
982
1093
  "no-emoji": no_emoji_default,
983
1094
  "no-explicit-return-type": no_explicit_return_type_default,
1095
+ "no-logic-in-params": no_logic_in_params_default,
984
1096
  "prefer-destructuring-params": prefer_destructuring_params_default,
985
1097
  "prefer-import-type": prefer_import_type_default,
986
1098
  "prefer-interface-over-inline-types": prefer_interface_over_inline_types_default,
@@ -1000,7 +1112,9 @@ var baseRules = {
1000
1112
  "nextfriday/no-explicit-return-type": "warn",
1001
1113
  "nextfriday/prefer-import-type": "warn",
1002
1114
  "nextfriday/prefer-named-param-types": "warn",
1003
- "nextfriday/prefer-react-import-types": "warn"
1115
+ "nextfriday/prefer-react-import-types": "warn",
1116
+ "nextfriday/no-complex-inline-return": "warn",
1117
+ "nextfriday/no-logic-in-params": "warn"
1004
1118
  };
1005
1119
  var baseRecommendedRules = {
1006
1120
  "nextfriday/no-emoji": "error",
@@ -1010,7 +1124,9 @@ var baseRecommendedRules = {
1010
1124
  "nextfriday/no-explicit-return-type": "error",
1011
1125
  "nextfriday/prefer-import-type": "error",
1012
1126
  "nextfriday/prefer-named-param-types": "error",
1013
- "nextfriday/prefer-react-import-types": "error"
1127
+ "nextfriday/prefer-react-import-types": "error",
1128
+ "nextfriday/no-complex-inline-return": "error",
1129
+ "nextfriday/no-logic-in-params": "error"
1014
1130
  };
1015
1131
  var jsxRules = {
1016
1132
  "nextfriday/jsx-pascal-case": "warn",