@eslint-react/core 5.9.5 → 5.10.1
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 +1 -18
- package/dist/index.js +2 -26
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { JsxDetectionHint } from "@eslint-react/jsx";
|
|
|
4
4
|
import { RegExpLike } from "@eslint-react/shared";
|
|
5
5
|
import ts from "typescript";
|
|
6
6
|
import { RuleContext } from "@eslint-react/eslint";
|
|
7
|
-
import { Scope } from "@typescript-eslint/scope-manager";
|
|
8
7
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
9
8
|
|
|
10
9
|
//#region src/api.d.ts
|
|
@@ -32,22 +31,6 @@ declare namespace isAPICall {
|
|
|
32
31
|
* @returns A predicate function to check if a node is a call to the API
|
|
33
32
|
*/
|
|
34
33
|
declare function isAPICall(api: string): isAPICall.ReturnType;
|
|
35
|
-
/**
|
|
36
|
-
* Check if a variable is initialized from React import
|
|
37
|
-
* @param name The variable name
|
|
38
|
-
* @param initialScope The initial scope
|
|
39
|
-
* @param importSource Alternative import source of React (ex: "preact/compat")
|
|
40
|
-
* @returns True if the variable is initialized or derived from React import
|
|
41
|
-
*/
|
|
42
|
-
declare function isAPIFromReact(name: string, initialScope: Scope, importSource?: string): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* if a variable is initialized from React Native import
|
|
45
|
-
* @param name The variable name
|
|
46
|
-
* @param initialScope The initial scope
|
|
47
|
-
* @param importSource Alternative import source of React Native (ex: "react-native-web")
|
|
48
|
-
* @returns True if the variable is initialized from React Native import
|
|
49
|
-
*/
|
|
50
|
-
declare function isAPIFromReactNative(name: string, initialScope: Scope, importSource?: string): boolean;
|
|
51
34
|
declare const isCaptureOwnerStack: isAPI.ReturnType;
|
|
52
35
|
declare const isChildrenCount: isAPI.ReturnType;
|
|
53
36
|
declare const isChildrenForEach: isAPI.ReturnType;
|
|
@@ -806,4 +789,4 @@ type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" |
|
|
|
806
789
|
*/
|
|
807
790
|
declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
|
|
808
791
|
//#endregion
|
|
809
|
-
export { ClassComponentSemanticNode, ClientFunctionSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, FunctionComponentSemanticNode, FunctionDisplayNameAssignment, FunctionID, FunctionInitPath, FunctionKind, FunctionSemanticNode, HookSemanticNode, JsxConfig, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, SemanticFunc, SemanticNode, ServerFunctionSemanticNode, TypeVariant, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall,
|
|
792
|
+
export { ClassComponentSemanticNode, ClientFunctionSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, FunctionComponentSemanticNode, FunctionDisplayNameAssignment, FunctionID, FunctionInitPath, FunctionKind, FunctionSemanticNode, HookSemanticNode, JsxConfig, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, SemanticFunc, SemanticNode, ServerFunctionSemanticNode, TypeVariant, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFunctionComponentDefinition, isFunctionComponentName, isFunctionComponentNameLoose, isFunctionComponentWrapperCall, isFunctionComponentWrapperCallback, isFunctionEmpty, isFunctionHasCallInInitPath, isFunctionHasDirective, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHookCall, isHookDefinition, isHookId, isHookName, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isStringType, isThisSetStateCall, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUse, isUseActionState, isUseActionStateCall, isUseCall, isUseCallback, isUseCallbackCall, isUseContext, isUseContextCall, isUseDebugValue, isUseDebugValueCall, isUseDeferredValue, isUseDeferredValueCall, isUseEffect, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatus, isUseFormStatusCall, isUseId, isUseIdCall, isUseImperativeHandle, isUseImperativeHandleCall, isUseInsertionEffect, isUseInsertionEffectCall, isUseLayoutEffect, isUseLayoutEffectCall, isUseMemo, isUseMemoCall, isUseOptimistic, isUseOptimisticCall, isUseReducer, isUseReducerCall, isUseRef, isUseRefCall, isUseState, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStore, isUseSyncExternalStoreCall, isUseTransition, isUseTransitionCall };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Check, Extract, Traverse, is, isOneOf } from "@eslint-react/ast";
|
|
2
|
-
import { resolve, resolveImportSource } from "@eslint-react/var";
|
|
3
2
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
4
3
|
import { randomBytes } from "node:crypto";
|
|
5
4
|
import { DEFAULT_JSX_DETECTION_HINT, JsxDetectionHint } from "@eslint-react/jsx";
|
|
6
5
|
import { RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE } from "@eslint-react/shared";
|
|
6
|
+
import { resolve } from "@eslint-react/var";
|
|
7
7
|
import ts from "typescript";
|
|
8
8
|
import { P, isMatching, match } from "ts-pattern";
|
|
9
9
|
|
|
@@ -164,30 +164,6 @@ function isAPICall(api) {
|
|
|
164
164
|
};
|
|
165
165
|
return dual(2, func);
|
|
166
166
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Check if a variable is initialized from React import
|
|
169
|
-
* @param name The variable name
|
|
170
|
-
* @param initialScope The initial scope
|
|
171
|
-
* @param importSource Alternative import source of React (ex: "preact/compat")
|
|
172
|
-
* @returns True if the variable is initialized or derived from React import
|
|
173
|
-
*/
|
|
174
|
-
function isAPIFromReact(name, initialScope, importSource = "react") {
|
|
175
|
-
return name.toLowerCase() === "react" || Boolean(resolveImportSource(name, initialScope)?.startsWith(importSource));
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* if a variable is initialized from React Native import
|
|
179
|
-
* @param name The variable name
|
|
180
|
-
* @param initialScope The initial scope
|
|
181
|
-
* @param importSource Alternative import source of React Native (ex: "react-native-web")
|
|
182
|
-
* @returns True if the variable is initialized from React Native import
|
|
183
|
-
*/
|
|
184
|
-
function isAPIFromReactNative(name, initialScope, importSource = "react-native") {
|
|
185
|
-
return [
|
|
186
|
-
"react_native",
|
|
187
|
-
"reactnative",
|
|
188
|
-
"rn"
|
|
189
|
-
].includes(name.toLowerCase()) || Boolean(resolveImportSource(name, initialScope)?.startsWith(importSource));
|
|
190
|
-
}
|
|
191
167
|
const isCaptureOwnerStack = isAPI("captureOwnerStack");
|
|
192
168
|
const isChildrenCount = isAPI("Children.count");
|
|
193
169
|
const isChildrenForEach = isAPI("Children.forEach");
|
|
@@ -1298,4 +1274,4 @@ function getTypeVariants(types) {
|
|
|
1298
1274
|
}
|
|
1299
1275
|
|
|
1300
1276
|
//#endregion
|
|
1301
|
-
export { DEFAULT_COMPONENT_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall,
|
|
1277
|
+
export { DEFAULT_COMPONENT_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFunctionComponentDefinition, isFunctionComponentName, isFunctionComponentNameLoose, isFunctionComponentWrapperCall, isFunctionComponentWrapperCallback, isFunctionEmpty, isFunctionHasCallInInitPath, isFunctionHasDirective, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHookCall, isHookDefinition, isHookId, isHookName, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isStringType, isThisSetStateCall, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUse, isUseActionState, isUseActionStateCall, isUseCall, isUseCallback, isUseCallbackCall, isUseContext, isUseContextCall, isUseDebugValue, isUseDebugValueCall, isUseDeferredValue, isUseDeferredValueCall, isUseEffect, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatus, isUseFormStatusCall, isUseId, isUseIdCall, isUseImperativeHandle, isUseImperativeHandleCall, isUseInsertionEffect, isUseInsertionEffectCall, isUseLayoutEffect, isUseLayoutEffectCall, isUseMemo, isUseMemoCall, isUseOptimistic, isUseOptimisticCall, isUseReducer, isUseReducerCall, isUseRef, isUseRefCall, isUseState, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStore, isUseSyncExternalStoreCall, isUseTransition, isUseTransitionCall };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.1",
|
|
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,20 +29,20 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@typescript-eslint/scope-manager": "^8.62.
|
|
33
|
-
"@typescript-eslint/types": "^8.62.
|
|
34
|
-
"@typescript-eslint/utils": "^8.62.
|
|
32
|
+
"@typescript-eslint/scope-manager": "^8.62.1",
|
|
33
|
+
"@typescript-eslint/types": "^8.62.1",
|
|
34
|
+
"@typescript-eslint/utils": "^8.62.1",
|
|
35
35
|
"ts-pattern": "^5.9.0",
|
|
36
|
-
"@eslint-react/ast": "5.
|
|
37
|
-
"@eslint-react/eslint": "5.
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/var": "5.
|
|
36
|
+
"@eslint-react/ast": "5.10.1",
|
|
37
|
+
"@eslint-react/eslint": "5.10.1",
|
|
38
|
+
"@eslint-react/jsx": "5.10.1",
|
|
39
|
+
"@eslint-react/shared": "5.10.1",
|
|
40
|
+
"@eslint-react/var": "5.10.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@typescript-eslint/parser": "^8.62.
|
|
44
|
-
"@typescript-eslint/typescript-estree": "^8.62.
|
|
45
|
-
"eslint": "^10.
|
|
43
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
44
|
+
"@typescript-eslint/typescript-estree": "^8.62.1",
|
|
45
|
+
"eslint": "^10.6.0",
|
|
46
46
|
"tsdown": "^0.22.3",
|
|
47
47
|
"typescript": "6.0.3",
|
|
48
48
|
"vitest": "^4.1.9",
|