@eslint-react/var
Advanced tools
+29
-25
@@ -8,3 +8,3 @@ import { TSESTree } from "@typescript-eslint/types"; | ||
| * @param node The node to match. | ||
| * @returns The require expression arguments or null if the node is not a require expression. | ||
| * @returns The require expression arguments or `null` if the node is not a require expression. | ||
| * @internal | ||
@@ -16,8 +16,7 @@ */ | ||
| /** | ||
| * Check if two assignment targets are equal | ||
| * Compares nodes directly or by their values. | ||
| * Check if two assignment targets are equal, either directly or by their values. | ||
| * @param context The rule context. | ||
| * @param a The first node to compare. | ||
| * @param b The second node to compare. | ||
| * @returns True if the assignment targets are equal. | ||
| * @returns `true` if the assignment targets are equal. | ||
| * @internal | ||
@@ -29,8 +28,8 @@ */ | ||
| /** | ||
| * Check if a variable is initialized from React import. | ||
| * @internal | ||
| * Check if a variable is initialized from a React import. | ||
| * @param name The variable name. | ||
| * @param initialScope The initial scope. | ||
| * @param importSource Alternative import source of React (ex: "preact/compat"). | ||
| * @returns True if the variable is initialized or derived from React import. | ||
| * @returns `true` if the variable is initialized or derived from a React import. | ||
| * @internal | ||
| */ | ||
@@ -41,8 +40,8 @@ declare function isInitializedFromReact(name: string, initialScope: Scope, importSource?: string): boolean; | ||
| /** | ||
| * if a variable is initialized from React Native import. | ||
| * @internal | ||
| * Check if a variable is initialized from a React Native import. | ||
| * @param name The variable name. | ||
| * @param initialScope The initial scope. | ||
| * @param importSource Alternative import source of React Native (ex: "react-native-web"). | ||
| * @returns True if the variable is initialized from React Native import. | ||
| * @returns `true` if the variable is initialized from a React Native import. | ||
| * @internal | ||
| */ | ||
@@ -53,7 +52,7 @@ declare function isInitializedFromReactNative(name: string, initialScope: Scope, importSource?: string): boolean; | ||
| /** | ||
| * Determine whether node value equals to another node value. | ||
| * @param context rule context. | ||
| * @param a node to compare. | ||
| * @param b node to compare. | ||
| * @returns `true` if node value equal. | ||
| * Check if the value of a node equals the value of another node. | ||
| * @param context The rule context. | ||
| * @param a The first node to compare. | ||
| * @param b The second node to compare. | ||
| * @returns `true` if the node values are equal. | ||
| */ | ||
@@ -64,3 +63,3 @@ declare function isValueEqual(context: RuleContext, a: TSESTree.Node, b: TSESTree.Node): boolean; | ||
| /** | ||
| * Resolves an identifier to the AST node that represents its value, | ||
| * Resolve an identifier to the AST node that represents its value, | ||
| * suitable for use in ESLint rule analysis. | ||
@@ -101,14 +100,19 @@ * | ||
| /** | ||
| * Finds the enclosing assignment target (variable, property, etc.) for a given node. | ||
| * Resolve the enclosing assignment target (variable, property, etc.) of a node. | ||
| * | ||
| * @param node The starting node. | ||
| * @returns The enclosing assignment target node, or null if not found. | ||
| * @returns The enclosing assignment target node, or `null` if not found. | ||
| */ | ||
| declare function resolveEnclosingAssignmentTarget(node: TSESTree.Node): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | 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.TSDeclareFunctionNoDeclare | TSESTree.TSDeclareFunctionWithDeclare | TSESTree.TSEnumDeclaration | TSESTree.TSInstantiationExpression | TSESTree.TSInterfaceDeclaration | TSESTree.TSModuleDeclarationGlobal | TSESTree.TSModuleDeclarationModuleWithIdentifierId | TSESTree.TSModuleDeclarationModuleWithStringIdDeclared | TSESTree.TSModuleDeclarationModuleWithStringIdNotDeclared | TSESTree.TSModuleDeclarationNamespace | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAliasDeclaration | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.ConstDeclaration | TSESTree.LetOrVarDeclaredDeclaration | TSESTree.LetOrVarNonDeclaredDeclaration | TSESTree.UsingInForOfDeclaration | TSESTree.UsingInNormalContextDeclaration | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | null; | ||
| /** | ||
| * Type representing the possible assignment targets returned by `resolveEnclosingAssignmentTarget`. | ||
| */ | ||
| /** The possible assignment targets returned by {@link resolveEnclosingAssignmentTarget}. */ | ||
| type AssignmentTarget = ReturnType<typeof resolveEnclosingAssignmentTarget>; | ||
| //#endregion | ||
| //#region src/resolve-import-source.d.ts | ||
| /** | ||
| * Resolve the import source of a variable by walking its latest definition. | ||
| * @param name The variable name. | ||
| * @param initialScope The initial scope. | ||
| * @param seen The set of already visited variable names (for cycle detection). | ||
| * @returns The import source, or `null` if it cannot be resolved. | ||
| */ | ||
| declare function resolveImportSource(name: string, initialScope: Scope, seen?: Set<string>): string | null; | ||
@@ -147,6 +151,6 @@ //#endregion | ||
| /** | ||
| * Detect the ObjectType of a given node. | ||
| * @param context The context of the rule. | ||
| * @param node The node to check. | ||
| * @returns The ObjectType of the node, or undefined if not detected. | ||
| * Resolve the object type of the given node. | ||
| * @param context The rule context. | ||
| * @param node The node to resolve. | ||
| * @returns The object type of the node, or `null` if it cannot be resolved. | ||
| */ | ||
@@ -153,0 +157,0 @@ declare function resolveObjectType(context: RuleContext, node: TSESTree.Node | null): ObjectType | null; |
+28
-22
@@ -11,3 +11,3 @@ import { Check, Compare, Extract, Traverse } from "@eslint-react/ast"; | ||
| * @param node The node to match. | ||
| * @returns The require expression arguments or null if the node is not a require expression. | ||
| * @returns The require expression arguments or `null` if the node is not a require expression. | ||
| * @internal | ||
@@ -28,3 +28,3 @@ */ | ||
| /** | ||
| * Resolves an identifier to the AST node that represents its value, | ||
| * Resolve an identifier to the AST node that represents its value, | ||
| * suitable for use in ESLint rule analysis. | ||
@@ -95,7 +95,7 @@ * | ||
| /** | ||
| * Determine whether node value equals to another node value. | ||
| * @param context rule context. | ||
| * @param a node to compare. | ||
| * @param b node to compare. | ||
| * @returns `true` if node value equal. | ||
| * Check if the value of a node equals the value of another node. | ||
| * @param context The rule context. | ||
| * @param a The first node to compare. | ||
| * @param b The second node to compare. | ||
| * @returns `true` if the node values are equal. | ||
| */ | ||
@@ -158,8 +158,7 @@ function isValueEqual(context, a, b) { | ||
| /** | ||
| * Check if two assignment targets are equal | ||
| * Compares nodes directly or by their values. | ||
| * Check if two assignment targets are equal, either directly or by their values. | ||
| * @param context The rule context. | ||
| * @param a The first node to compare. | ||
| * @param b The second node to compare. | ||
| * @returns True if the assignment targets are equal. | ||
| * @returns `true` if the assignment targets are equal. | ||
| * @internal | ||
@@ -173,2 +172,9 @@ */ | ||
| //#region src/resolve-import-source.ts | ||
| /** | ||
| * Resolve the import source of a variable by walking its latest definition. | ||
| * @param name The variable name. | ||
| * @param initialScope The initial scope. | ||
| * @param seen The set of already visited variable names (for cycle detection). | ||
| * @returns The import source, or `null` if it cannot be resolved. | ||
| */ | ||
| function resolveImportSource(name, initialScope, seen = /* @__PURE__ */ new Set()) { | ||
@@ -198,8 +204,8 @@ if (seen.has(name)) return null; | ||
| /** | ||
| * Check if a variable is initialized from React import. | ||
| * @internal | ||
| * Check if a variable is initialized from a React import. | ||
| * @param name The variable name. | ||
| * @param initialScope The initial scope. | ||
| * @param importSource Alternative import source of React (ex: "preact/compat"). | ||
| * @returns True if the variable is initialized or derived from React import. | ||
| * @returns `true` if the variable is initialized or derived from a React import. | ||
| * @internal | ||
| */ | ||
@@ -213,8 +219,8 @@ function isInitializedFromReact(name, initialScope, importSource = "react") { | ||
| /** | ||
| * if a variable is initialized from React Native import. | ||
| * @internal | ||
| * Check if a variable is initialized from a React Native import. | ||
| * @param name The variable name. | ||
| * @param initialScope The initial scope. | ||
| * @param importSource Alternative import source of React Native (ex: "react-native-web"). | ||
| * @returns True if the variable is initialized from React Native import. | ||
| * @returns `true` if the variable is initialized from a React Native import. | ||
| * @internal | ||
| */ | ||
@@ -232,6 +238,6 @@ function isInitializedFromReactNative(name, initialScope, importSource = "react-native") { | ||
| /** | ||
| * Finds the enclosing assignment target (variable, property, etc.) for a given node. | ||
| * Resolve the enclosing assignment target (variable, property, etc.) of a node. | ||
| * | ||
| * @param node The starting node. | ||
| * @returns The enclosing assignment target node, or null if not found. | ||
| * @returns The enclosing assignment target node, or `null` if not found. | ||
| */ | ||
@@ -252,6 +258,6 @@ function resolveEnclosingAssignmentTarget(node) { | ||
| /** | ||
| * Detect the ObjectType of a given node. | ||
| * @param context The context of the rule. | ||
| * @param node The node to check. | ||
| * @returns The ObjectType of the node, or undefined if not detected. | ||
| * Resolve the object type of the given node. | ||
| * @param context The rule context. | ||
| * @param node The node to resolve. | ||
| * @returns The object type of the node, or `null` if it cannot be resolved. | ||
| */ | ||
@@ -258,0 +264,0 @@ function resolveObjectType(context, node) { |
+9
-9
| { | ||
| "name": "@eslint-react/var", | ||
| "version": "5.17.3", | ||
| "version": "5.18.0", | ||
| "description": "ESLint React's TSESTree AST utility module for static analysis of variables.", | ||
@@ -32,14 +32,14 @@ "homepage": "https://github.com/Rel1cx/eslint-react", | ||
| "dependencies": { | ||
| "@typescript-eslint/scope-manager": "^8.64.0", | ||
| "@typescript-eslint/types": "^8.64.0", | ||
| "@typescript-eslint/utils": "^8.64.0", | ||
| "@typescript-eslint/scope-manager": "^8.65.0", | ||
| "@typescript-eslint/types": "^8.65.0", | ||
| "@typescript-eslint/utils": "^8.65.0", | ||
| "ts-pattern": "^5.9.0", | ||
| "@eslint-react/eslint": "5.17.3", | ||
| "@eslint-react/ast": "5.17.3" | ||
| "@eslint-react/ast": "5.18.0", | ||
| "@eslint-react/eslint": "5.18.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@typescript-eslint/parser": "^8.64.0", | ||
| "@typescript-eslint/typescript-estree": "^8.64.0", | ||
| "@typescript-eslint/parser": "^8.65.0", | ||
| "@typescript-eslint/typescript-estree": "^8.65.0", | ||
| "eslint": "^10.7.0", | ||
| "tsdown": "^0.22.9", | ||
| "tsdown": "^0.22.13", | ||
| "typescript": "6.0.3", | ||
@@ -46,0 +46,0 @@ "vitest": "^4.1.10", |
27567
2.61%506
2.02%+ Added
+ Added
- Removed
- Removed
Updated
Updated