Skip to content

Latest commit

 

History

History
167 lines (157 loc) · 13.9 KB

File metadata and controls

167 lines (157 loc) · 13.9 KB

@eslint-react/core

Namespaces

Namespace Description
isReactAPI -
isReactAPICall -
useComponentCollector -
useComponentCollectorLegacy -
useHookCollector -

Interfaces

Interface Description
ClassComponentSemanticNode Represents a React Class Component
ClientFunctionSemanticNode Represents a React Client Function
FunctionComponentSemanticNode Represents a React Function Component
HookSemanticNode Represents a semantic hook node in the AST This interface extends SemanticNode and provides additional properties for React hook analysis
JsxConfig -
SemanticFunc Represents a semantic function node in the AST This interface extends SemanticNode and provides additional properties for function analysis
SemanticNode Represents a semantic node in the AST This is the base interface for all semantic nodes in the React semantic analysis
ServerFunctionSemanticNode Represents a React Server Function

Type Aliases

Type Alias Description
ComponentDetectionHint -
ComponentFlag -
ComponentKind Represents the kind of a React function
ComponentSemanticNode Represents a React Component
FindEnclosingComponentOrHookFilter -
FunctionSemanticNode Represents a React Function
JsxAttributeValue Represents possible JSX attribute value types that can be resolved
JsxDetectionHint BitFlags for configuring JSX detection behavior

Variables

Variable Description
ComponentDetectionHint Hints for component collector
ComponentFlag Component flag constants
DEFAULT_COMPONENT_DETECTION_HINT Default component detection hint
DEFAULT_JSX_DETECTION_HINT Default JSX detection configuration Skips undefined and boolean literals (common in React)
isCaptureOwnerStack -
isCaptureOwnerStackCall -
isChildrenCount -
isChildrenCountCall -
isChildrenForEach -
isChildrenForEachCall -
isChildrenMap -
isChildrenMapCall -
isChildrenOnly -
isChildrenOnlyCall -
isChildrenToArray -
isChildrenToArrayCall -
isCloneElement -
isCloneElementCall -
isComponentDidCatch -
isComponentDidMount -
isComponentDidUpdate -
isComponentWillMount -
isComponentWillReceiveProps -
isComponentWillUnmount -
isComponentWillUpdate -
isCreateContext -
isCreateContextCall -
isCreateElement -
isCreateElementCall -
isCreateRef -
isCreateRefCall -
isForwardRef -
isForwardRefCall -
isGetChildContext -
isGetDefaultProps -
isGetDerivedStateFromError -
isGetDerivedStateFromProps -
isGetInitialState -
isGetSnapshotBeforeUpdate -
isLazy -
isLazyCall -
isMemo -
isMemoCall -
isRender -
isShouldComponentUpdate -
isUnsafeComponentWillMount -
isUnsafeComponentWillReceiveProps -
isUnsafeComponentWillUpdate -
isUseActionStateCall -
isUseCall -
isUseCallbackCall -
isUseContextCall -
isUseDebugValueCall -
isUseDeferredValueCall -
isUseEffectCall -
isUseFormStatusCall -
isUseIdCall -
isUseImperativeHandleCall -
isUseInsertionEffectCall -
isUseLayoutEffectCall -
isUseMemoCall -
isUseOptimisticCall -
isUseReducerCall -
isUseRefCall -
isUseStateCall -
isUseSyncExternalStoreCall -
isUseTransitionCall -
JsxDetectionHint -
JsxEmit -
REACT_BUILTIN_HOOK_NAMES -

Functions

Function Description
findEnclosingComponentOrHook Find the enclosing React component or hook for a given AST node
findParentJsxAttribute Traverses up the AST to find a parent JSX attribute node that matches a given test
getComponentFlagFromInitPath Get component flag from init path
getFunctionComponentId Get function component identifier from const Component = memo(() => {});
getJsxAttribute Creates a helper function to find a specific JSX attribute by name Handles direct attributes and spread attributes (variables or object literals)
getJsxAttributeName Get the stringified name of a JSX attribute
getJsxConfigFromAnnotation Get JsxConfig from pragma comments (annotations) in the source code
getJsxConfigFromContext Get JsxConfig from the rule context by reading compiler options
getJsxElementType Extracts the element type name from a JSX element or fragment For JSX elements, returns the stringified name (e.g., "div", "Button", "React.Fragment") For JSX fragments, returns an empty string
isClassComponent Check if a node is a React class component
isComponentDefinition Determine if a function node represents a valid React component definition
isComponentDidMountCallback Check if the given node is a componentDidMount callback
isComponentName Check if a string matches the strict component name pattern
isComponentNameLoose Check if a string matches the loose component name pattern
isComponentWillUnmountCallback Check if the given node is a componentWillUnmount callback
isComponentWrapperCall Check if the node is a call expression for a component wrapper
isComponentWrapperCallback Check if the node is a callback function passed to a component wrapper
isComponentWrapperCallbackLoose Check if the node is a callback function passed to a component wrapper loosely
isComponentWrapperCallLoose Check if the node is a call expression for a component wrapper loosely
isDeclaredInRenderPropLoose Unsafe check whether given node is declared inside a render prop _ = <Component renderRow={"node"} /> ^^^^^^ _ = <Component rows={ [{ render: "node" }] } /> ^^^^^^ ``
isFunctionWithLooseComponentName Check if a function has a loose component name
isHook Determine if a function node is a React Hook based on its name.
isHookCall Check if the given node is a React Hook call by its name.
isHookCallWithName Check if a node is a call to a specific React hook. Returns a function that accepts a hook name to check against.
isHookId Checks if the given node is a hook identifier
isHookName Catch all identifiers that begin with "use" followed by an uppercase Latin character to exclude identifiers like "user".
isInitializedFromReact Check if a variable is initialized from React import
isInitializedFromReactNative if a variable is initialized from React Native import
isInitializedFromRef Check if the variable with the given name is initialized or derived from a ref
isInsideComponentOrHook Check if a given AST node is inside a React component or hook
isJsxFragmentElement Determine if a JSX element is a React Fragment Fragments can be imported from React and used like or <React.Fragment>
isJsxHostElement Determine if a JSX element is a host element Host elements in React start with lowercase letters (e.g., div, span)
isJsxLike Determine if a node represents JSX-like content based on heuristics Supports configuration through hint flags to customize detection behavior
isJsxText Check if a node is a JSXText or a Literal node
isPureComponent Check if a node is a React PureComponent
isReactAPI Check if the node is a React API identifier or member expression
isReactAPICall Check if the node is a call expression to a specific React API
isRefName Check if a given name corresponds to a ref name
isRenderFunctionLoose Unsafe check whether given node is a render function const renderRow = () => <div /> ^^^^^^^^^^^^_ = <Component renderRow={() => <div />} /> ^^^^^^^^^^^^^ ``
isRenderMethodLike Check whether given node is a render method of a class component
isRenderPropLoose Unsafe check whether given JSXAttribute is a render prop _ = <Component renderRow={() => <div />} /> ^^^^^^^^^^^^^^^^^^^^^^^^^ ``
isUseEffectCleanupCallback Determine if a node is the cleanup function returned by a useEffect-like hook's setup function.
isUseEffectLikeCall Detect useEffect calls and variations (useLayoutEffect, etc.) using a regex pattern
isUseEffectSetupCallback Determine if a node is the setup function passed to a useEffect-like hook
isUseStateLikeCall Detect useState calls and variations (useCustomState, etc.) using a regex pattern
resolveJsxAttributeValue Resolve the static value of a JSX attribute or spread attribute
stringifyJsx Incomplete but sufficient stringification of JSX nodes for common use cases
useComponentCollector Get a ctx and visitor object for the rule to collect function components
useComponentCollectorLegacy Get a ctx and visitor object for the rule to collect class componentss
useHookCollector Get a ctx and visitor object for the rule to collect hooks