@eslint-react/core 2.12.1-next.2 → 2.12.2-next.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/dist/index.d.ts CHANGED
@@ -90,6 +90,7 @@ declare const ComponentDetectionHint: {
90
90
  readonly DoNotIncludeFunctionDefinedInArrayPattern: bigint;
91
91
  readonly DoNotIncludeFunctionDefinedInArrayExpression: bigint;
92
92
  readonly DoNotIncludeFunctionDefinedAsArrayMapCallback: bigint;
93
+ readonly DoNotIncludeFunctionDefinedAsArrayFlatMapCallback: bigint;
93
94
  readonly None: 0n;
94
95
  readonly DoNotIncludeJsxWithNullValue: bigint;
95
96
  readonly DoNotIncludeJsxWithNumberValue: bigint;
@@ -543,7 +544,7 @@ type FindEnclosingComponentOrHookFilter = (n: TSESTree.Node, name: string | null
543
544
  * @param test Optional test function to customize component or hook identification
544
545
  * @returns The enclosing component or hook node, or `null` if none is ASAST.
545
546
  */
546
- declare function findEnclosingComponentOrHook(node: TSESTree.Node | unit, test?: FindEnclosingComponentOrHookFilter): TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | undefined;
547
+ declare function findEnclosingComponentOrHook(node: TSESTree.Node | unit, test?: FindEnclosingComponentOrHookFilter): TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | undefined;
547
548
  //#endregion
548
549
  //#region src/hierarchy/is-inside-component-or-hook.d.ts
549
550
  /**
@@ -741,7 +742,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: ast.T
741
742
  readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
742
743
  } | {
743
744
  readonly kind: "expression";
744
- readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
745
+ readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
745
746
  readonly toStatic: () => unknown;
746
747
  } | {
747
748
  readonly kind: "element";
@@ -749,7 +750,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: ast.T
749
750
  readonly toStatic: () => undefined;
750
751
  } | {
751
752
  readonly kind: "spreadChild";
752
- readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
753
+ readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
753
754
  readonly toStatic: () => undefined;
754
755
  } | {
755
756
  readonly kind: "spreadProps";
package/dist/index.js CHANGED
@@ -677,12 +677,13 @@ const ComponentDetectionHint = {
677
677
  DoNotIncludeFunctionDefinedOnClassProperty: 1n << 66n,
678
678
  DoNotIncludeFunctionDefinedInArrayPattern: 1n << 67n,
679
679
  DoNotIncludeFunctionDefinedInArrayExpression: 1n << 68n,
680
- DoNotIncludeFunctionDefinedAsArrayMapCallback: 1n << 69n
680
+ DoNotIncludeFunctionDefinedAsArrayMapCallback: 1n << 69n,
681
+ DoNotIncludeFunctionDefinedAsArrayFlatMapCallback: 1n << 70n
681
682
  };
682
683
  /**
683
684
  * Default component detection hint
684
685
  */
685
- const DEFAULT_COMPONENT_DETECTION_HINT = 0n | ComponentDetectionHint.DoNotIncludeJsxWithBigIntValue | ComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | ComponentDetectionHint.DoNotIncludeJsxWithNumberValue | ComponentDetectionHint.DoNotIncludeJsxWithStringValue | ComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback | ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayExpression | ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayPattern | ComponentDetectionHint.RequireAllArrayElementsToBeJsx | ComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | ComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx;
686
+ const DEFAULT_COMPONENT_DETECTION_HINT = 0n | ComponentDetectionHint.DoNotIncludeJsxWithBigIntValue | ComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | ComponentDetectionHint.DoNotIncludeJsxWithNumberValue | ComponentDetectionHint.DoNotIncludeJsxWithStringValue | ComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayFlatMapCallback | ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback | ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayExpression | ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayPattern | ComponentDetectionHint.RequireAllArrayElementsToBeJsx | ComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | ComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx;
686
687
 
687
688
  //#endregion
688
689
  //#region src/component/component-is.ts
@@ -865,6 +866,7 @@ function shouldExcludeBasedOnHint(node, hint) {
865
866
  case hint & ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayPattern && node.parent.type === AST_NODE_TYPES.ArrayPattern: return true;
866
867
  case hint & ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayExpression && node.parent.type === AST_NODE_TYPES.ArrayExpression: return true;
867
868
  case hint & ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback && node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee.type === AST_NODE_TYPES.MemberExpression && node.parent.callee.property.type === AST_NODE_TYPES.Identifier && node.parent.callee.property.name === "map": return true;
869
+ case hint & ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayFlatMapCallback && node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee.type === AST_NODE_TYPES.MemberExpression && node.parent.callee.property.type === AST_NODE_TYPES.Identifier && node.parent.callee.property.name === "flatMap": return true;
868
870
  }
869
871
  return false;
870
872
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "2.12.1-next.2",
3
+ "version": "2.12.2-next.0",
4
4
  "description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -34,10 +34,10 @@
34
34
  "@typescript-eslint/types": "^8.54.0",
35
35
  "@typescript-eslint/utils": "^8.54.0",
36
36
  "ts-pattern": "^5.9.0",
37
- "@eslint-react/ast": "2.12.1-next.2",
38
- "@eslint-react/eff": "2.12.1-next.2",
39
- "@eslint-react/var": "2.12.1-next.2",
40
- "@eslint-react/shared": "2.12.1-next.2"
37
+ "@eslint-react/ast": "2.12.2-next.0",
38
+ "@eslint-react/eff": "2.12.2-next.0",
39
+ "@eslint-react/shared": "2.12.2-next.0",
40
+ "@eslint-react/var": "2.12.2-next.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "tsdown": "^0.20.3",