@eslint-react/core 5.30.0-beta.8 → 5.30.0-rc.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
@@ -369,7 +369,7 @@ export type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSe
369
369
  * @param node The function node to analyze.
370
370
  * @returns The identifier node if found, `null` otherwise.
371
371
  */
372
- export declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | null;
372
+ export declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ClassExpression | TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.CallExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSTypeAssertion | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.ChainExpression | TSESTree.ConditionalExpression | TSESTree.ImportExpression | TSESTree.LogicalExpression | TSESTree.NewExpression | TSESTree.PrivateIdentifier | TSESTree.TSInstantiationExpression | TSESTree.TSSatisfiesExpression | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | null;
373
373
  /**
374
374
  * Get the initialization path of a function node in the AST.
375
375
  *
@@ -456,7 +456,8 @@ export declare function isHookName(name: string): boolean;
456
456
  /**
457
457
  * Checks if the given node is a hook identifier.
458
458
  * @param id The AST node to check.
459
- * @returns `true` if the node is a hook identifier or member expression with hook name, `false` otherwise.
459
+ * @returns `true` if the node is a hook identifier or a non-computed member expression with a hook name
460
+ * (ex: `useState`, `React.useState`); computed member expressions (ex: `React["useState"]`) do not match.
460
461
  */
461
462
  export declare function isHookId(id: TSESTree.Node): id is TSESTree.Identifier | TSESTree.MemberExpression;
462
463
  /**
package/dist/index.js CHANGED
@@ -254,7 +254,7 @@ const isGetDefaultProps = createLifecycleChecker("getDefaultProps", true);
254
254
  const isGetDerivedStateFromProps = createLifecycleChecker("getDerivedStateFromProps", true);
255
255
  const isGetDerivedStateFromError = createLifecycleChecker("getDerivedStateFromError", true);
256
256
  function isRenderMethodLike(node) {
257
- return Check.isPropertyOrMethod(node) && Check.isIdentifier(node.key) && node.key.name.startsWith("render") && Check.isClass(node.parent.parent);
257
+ return Check.isPropertyOrMethod(node) && !node.computed && getStaticKeyName(node.key, node.computed)?.startsWith("render") === true && Check.isClass(node.parent.parent);
258
258
  }
259
259
  function isRenderMethodCallback(node) {
260
260
  let parent = node.parent;
@@ -848,7 +848,7 @@ const isFalsyStringType = (type) => type.isStringLiteral() && type.value === "";
848
848
  const isNeverType = (type) => isTypeFlagSet(type, ts.TypeFlags.Never);
849
849
  const isNullishType = (type) => isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike);
850
850
  const isNumberType = (type) => isTypeFlagSet(type, ts.TypeFlags.NumberLike);
851
- const isObjectType = (type) => !isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike | ts.TypeFlags.TypeParameter | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never);
851
+ const isObjectType = (type) => !isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike | ts.TypeFlags.ESSymbolLike | ts.TypeFlags.TypeParameter | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never);
852
852
  const isStringType = (type) => isTypeFlagSet(type, ts.TypeFlags.StringLike);
853
853
  const isTruthyBigIntType = (type) => type.isLiteral() && isMatching({ value: { base10Value: P.not("0") } }, type);
854
854
  const isTruthyNumberType = (type) => type.isNumberLiteral() && type.value !== 0;
@@ -895,7 +895,7 @@ function getFullyQualifiedNameEx(checker, symbol) {
895
895
  }
896
896
  const namespace = parent.getSourceFile().statements.find((n) => ts.isNamespaceExportDeclaration(n))?.name.text;
897
897
  if (namespace == null) return name;
898
- if (name.startsWith(`${namespace}.`)) return name;
898
+ if (name === namespace || name.startsWith(`${namespace}.`)) return name;
899
899
  return `${namespace}.${name}`;
900
900
  }
901
901
  // src/type-variant.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "5.30.0-beta.8",
3
+ "version": "5.30.0-rc.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": {
@@ -29,11 +29,11 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@eslint-react/ast": "5.30.0-beta.8",
33
- "@eslint-react/eslint": "5.30.0-beta.8",
34
- "@eslint-react/jsx": "5.30.0-beta.8",
35
- "@eslint-react/shared": "5.30.0-beta.8",
36
- "@eslint-react/var": "5.30.0-beta.8",
32
+ "@eslint-react/ast": "5.30.0-rc.0",
33
+ "@eslint-react/eslint": "5.30.0-rc.0",
34
+ "@eslint-react/jsx": "5.30.0-rc.0",
35
+ "@eslint-react/shared": "5.30.0-rc.0",
36
+ "@eslint-react/var": "5.30.0-rc.0",
37
37
  "@typescript-eslint/types": "^8.72.1",
38
38
  "@typescript-eslint/utils": "^8.72.1",
39
39
  "ts-pattern": "^5.9.2"
@@ -45,10 +45,10 @@
45
45
  "@tsconfig/node20": "^20.1.10",
46
46
  "@types/node": "^20.19.43",
47
47
  "dedent": "^1.7.2",
48
- "eslint": "^10.13.0",
49
- "tsdown": "^0.23.2",
48
+ "eslint": "^10.14.0",
49
+ "tsdown": "^0.23.5",
50
50
  "typescript": "6.0.3",
51
- "vitest": "^5.0.5"
51
+ "vitest": "^5.1.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "eslint": "*",