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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "eslint-plugin-nextfriday",
4
- version: "1.3.0",
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({
@@ -667,11 +777,11 @@ var preferInterfaceOverInlineTypes = createRule9({
667
777
  var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
668
778
 
669
779
  // src/rules/prefer-named-param-types.ts
670
- import { AST_NODE_TYPES as AST_NODE_TYPES5, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
671
- var createRule10 = ESLintUtils10.RuleCreator(
780
+ import { AST_NODE_TYPES as AST_NODE_TYPES7, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
781
+ var createRule12 = ESLintUtils12.RuleCreator(
672
782
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
673
783
  );
674
- var preferNamedParamTypes = createRule10({
784
+ var preferNamedParamTypes = createRule12({
675
785
  name: "prefer-named-param-types",
676
786
  meta: {
677
787
  type: "suggestion",
@@ -686,16 +796,16 @@ var preferNamedParamTypes = createRule10({
686
796
  defaultOptions: [],
687
797
  create(context) {
688
798
  function hasInlineObjectType(param) {
689
- if (param.type === AST_NODE_TYPES5.AssignmentPattern) {
799
+ if (param.type === AST_NODE_TYPES7.AssignmentPattern) {
690
800
  return hasInlineObjectType(param.left);
691
801
  }
692
- if (param.type === AST_NODE_TYPES5.ObjectPattern) {
693
- if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES5.TSTypeLiteral) {
802
+ if (param.type === AST_NODE_TYPES7.ObjectPattern) {
803
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES7.TSTypeLiteral) {
694
804
  return true;
695
805
  }
696
806
  }
697
- if (param.type === AST_NODE_TYPES5.Identifier) {
698
- if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES5.TSTypeLiteral) {
807
+ if (param.type === AST_NODE_TYPES7.Identifier) {
808
+ if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES7.TSTypeLiteral) {
699
809
  return true;
700
810
  }
701
811
  }
@@ -729,11 +839,11 @@ var preferNamedParamTypes = createRule10({
729
839
  var prefer_named_param_types_default = preferNamedParamTypes;
730
840
 
731
841
  // src/rules/prefer-react-import-types.ts
732
- import { AST_NODE_TYPES as AST_NODE_TYPES6, ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
733
- var createRule11 = ESLintUtils11.RuleCreator(
842
+ import { AST_NODE_TYPES as AST_NODE_TYPES8, ESLintUtils as ESLintUtils13 } from "@typescript-eslint/utils";
843
+ var createRule13 = ESLintUtils13.RuleCreator(
734
844
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
735
845
  );
736
- var preferReactImportTypes = createRule11({
846
+ var preferReactImportTypes = createRule13({
737
847
  name: "prefer-react-import-types",
738
848
  meta: {
739
849
  type: "suggestion",
@@ -809,7 +919,7 @@ var preferReactImportTypes = createRule11({
809
919
  ]);
810
920
  const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
811
921
  function checkMemberExpression(node) {
812
- if (node.object.type === AST_NODE_TYPES6.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES6.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)) {
813
923
  const typeName = node.property.name;
814
924
  const isType = reactTypes.has(typeName);
815
925
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -826,7 +936,7 @@ var preferReactImportTypes = createRule11({
826
936
  return {
827
937
  MemberExpression: checkMemberExpression,
828
938
  "TSTypeReference > TSQualifiedName": (node) => {
829
- if (node.left.type === AST_NODE_TYPES6.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES6.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)) {
830
940
  const typeName = node.right.name;
831
941
  const isType = reactTypes.has(typeName);
832
942
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -846,11 +956,11 @@ var preferReactImportTypes = createRule11({
846
956
  var prefer_react_import_types_default = preferReactImportTypes;
847
957
 
848
958
  // src/rules/react-props-destructure.ts
849
- import { AST_NODE_TYPES as AST_NODE_TYPES7, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
850
- var createRule12 = ESLintUtils12.RuleCreator(
959
+ import { AST_NODE_TYPES as AST_NODE_TYPES9, ESLintUtils as ESLintUtils14 } from "@typescript-eslint/utils";
960
+ var createRule14 = ESLintUtils14.RuleCreator(
851
961
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replace(/-/g, "_").toUpperCase()}.md`
852
962
  );
853
- var reactPropsDestructure = createRule12({
963
+ var reactPropsDestructure = createRule14({
854
964
  name: "react-props-destructure",
855
965
  meta: {
856
966
  type: "suggestion",
@@ -866,29 +976,29 @@ var reactPropsDestructure = createRule12({
866
976
  defaultOptions: [],
867
977
  create(context) {
868
978
  function hasJSXInConditional(node) {
869
- return node.consequent.type === AST_NODE_TYPES7.JSXElement || node.consequent.type === AST_NODE_TYPES7.JSXFragment || node.alternate.type === AST_NODE_TYPES7.JSXElement || node.alternate.type === AST_NODE_TYPES7.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;
870
980
  }
871
981
  function hasJSXInLogical(node) {
872
- return node.right.type === AST_NODE_TYPES7.JSXElement || node.right.type === AST_NODE_TYPES7.JSXFragment;
982
+ return node.right.type === AST_NODE_TYPES9.JSXElement || node.right.type === AST_NODE_TYPES9.JSXFragment;
873
983
  }
874
984
  function hasJSXReturn(block) {
875
985
  return block.body.some((stmt) => {
876
- if (stmt.type === AST_NODE_TYPES7.ReturnStatement && stmt.argument) {
877
- return stmt.argument.type === AST_NODE_TYPES7.JSXElement || stmt.argument.type === AST_NODE_TYPES7.JSXFragment || stmt.argument.type === AST_NODE_TYPES7.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES7.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);
878
988
  }
879
989
  return false;
880
990
  });
881
991
  }
882
992
  function isReactComponent(node) {
883
- if (node.type === AST_NODE_TYPES7.ArrowFunctionExpression) {
884
- if (node.body.type === AST_NODE_TYPES7.JSXElement || node.body.type === AST_NODE_TYPES7.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) {
885
995
  return true;
886
996
  }
887
- if (node.body.type === AST_NODE_TYPES7.BlockStatement) {
997
+ if (node.body.type === AST_NODE_TYPES9.BlockStatement) {
888
998
  return hasJSXReturn(node.body);
889
999
  }
890
- } else if (node.type === AST_NODE_TYPES7.FunctionExpression || node.type === AST_NODE_TYPES7.FunctionDeclaration) {
891
- if (node.body && node.body.type === AST_NODE_TYPES7.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) {
892
1002
  return hasJSXReturn(node.body);
893
1003
  }
894
1004
  }
@@ -902,9 +1012,9 @@ var reactPropsDestructure = createRule12({
902
1012
  return;
903
1013
  }
904
1014
  const param = node.params[0];
905
- if (param.type === AST_NODE_TYPES7.ObjectPattern) {
906
- const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES7.Property).map((prop) => {
907
- if (prop.key.type === AST_NODE_TYPES7.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) {
908
1018
  return prop.key.name;
909
1019
  }
910
1020
  return null;
@@ -940,8 +1050,10 @@ var rules = {
940
1050
  "file-kebab-case": file_kebab_case_default,
941
1051
  "jsx-pascal-case": jsx_pascal_case_default,
942
1052
  "md-filename-case-restriction": md_filename_case_restriction_default,
1053
+ "no-complex-inline-return": no_complex_inline_return_default,
943
1054
  "no-emoji": no_emoji_default,
944
1055
  "no-explicit-return-type": no_explicit_return_type_default,
1056
+ "no-logic-in-params": no_logic_in_params_default,
945
1057
  "prefer-destructuring-params": prefer_destructuring_params_default,
946
1058
  "prefer-import-type": prefer_import_type_default,
947
1059
  "prefer-interface-over-inline-types": prefer_interface_over_inline_types_default,
@@ -961,7 +1073,9 @@ var baseRules = {
961
1073
  "nextfriday/no-explicit-return-type": "warn",
962
1074
  "nextfriday/prefer-import-type": "warn",
963
1075
  "nextfriday/prefer-named-param-types": "warn",
964
- "nextfriday/prefer-react-import-types": "warn"
1076
+ "nextfriday/prefer-react-import-types": "warn",
1077
+ "nextfriday/no-complex-inline-return": "warn",
1078
+ "nextfriday/no-logic-in-params": "warn"
965
1079
  };
966
1080
  var baseRecommendedRules = {
967
1081
  "nextfriday/no-emoji": "error",
@@ -971,7 +1085,9 @@ var baseRecommendedRules = {
971
1085
  "nextfriday/no-explicit-return-type": "error",
972
1086
  "nextfriday/prefer-import-type": "error",
973
1087
  "nextfriday/prefer-named-param-types": "error",
974
- "nextfriday/prefer-react-import-types": "error"
1088
+ "nextfriday/prefer-react-import-types": "error",
1089
+ "nextfriday/no-complex-inline-return": "error",
1090
+ "nextfriday/no-logic-in-params": "error"
975
1091
  };
976
1092
  var jsxRules = {
977
1093
  "nextfriday/jsx-pascal-case": "warn",