| 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 |