Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions packages/core/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
- [isChildrenToArrayCall](variables/isChildrenToArrayCall.md)
- [isCloneElement](variables/isCloneElement.md)
- [isCloneElementCall](variables/isCloneElementCall.md)
- [isComponentDidCatch](variables/isComponentDidCatch.md)
- [isComponentDidMount](variables/isComponentDidMount.md)
- [isComponentDidUpdate](variables/isComponentDidUpdate.md)
- [isComponentWillMount](variables/isComponentWillMount.md)
- [isComponentWillReceiveProps](variables/isComponentWillReceiveProps.md)
- [isComponentWillUnmount](variables/isComponentWillUnmount.md)
- [isComponentWillUpdate](variables/isComponentWillUpdate.md)
- [isCreateContext](variables/isCreateContext.md)
- [isCreateContextCall](variables/isCreateContextCall.md)
- [isCreateElement](variables/isCreateElement.md)
Expand All @@ -63,11 +70,22 @@
- [isCreateRefCall](variables/isCreateRefCall.md)
- [isForwardRef](variables/isForwardRef.md)
- [isForwardRefCall](variables/isForwardRefCall.md)
- [isGetChildContext](variables/isGetChildContext.md)
- [isGetDefaultProps](variables/isGetDefaultProps.md)
- [isGetDerivedStateFromError](variables/isGetDerivedStateFromError.md)
- [isGetDerivedStateFromProps](variables/isGetDerivedStateFromProps.md)
- [isGetInitialState](variables/isGetInitialState.md)
- [isGetSnapshotBeforeUpdate](variables/isGetSnapshotBeforeUpdate.md)
- [isInversePhase](variables/isInversePhase.md)
- [isLazy](variables/isLazy.md)
- [isLazyCall](variables/isLazyCall.md)
- [isMemo](variables/isMemo.md)
- [isMemoCall](variables/isMemoCall.md)
- [isRender](variables/isRender.md)
- [isShouldComponentUpdate](variables/isShouldComponentUpdate.md)
- [isUnsafeComponentWillMount](variables/isUnsafeComponentWillMount.md)
- [isUnsafeComponentWillReceiveProps](variables/isUnsafeComponentWillReceiveProps.md)
- [isUnsafeComponentWillUpdate](variables/isUnsafeComponentWillUpdate.md)
- [isUseActionStateCall](variables/isUseActionStateCall.md)
- [isUseCall](variables/isUseCall.md)
- [isUseCallbackCall](variables/isUseCallbackCall.md)
Expand Down Expand Up @@ -107,27 +125,14 @@
- [isAssignmentToThisState](functions/isAssignmentToThisState.md)
- [isChildrenOfCreateElement](functions/isChildrenOfCreateElement.md)
- [isClassComponent](functions/isClassComponent.md)
- [isComponentDidCatch](functions/isComponentDidCatch.md)
- [isComponentDidMount](functions/isComponentDidMount.md)
- [isComponentDidUpdate](functions/isComponentDidUpdate.md)
- [isComponentDefinition](functions/isComponentDefinition.md)
- [isComponentName](functions/isComponentName.md)
- [isComponentNameLoose](functions/isComponentNameLoose.md)
- [isComponentWillMount](functions/isComponentWillMount.md)
- [isComponentWillReceiveProps](functions/isComponentWillReceiveProps.md)
- [isComponentWillUnmount](functions/isComponentWillUnmount.md)
- [isComponentWillUpdate](functions/isComponentWillUpdate.md)
- [isComponentWrapperCall](functions/isComponentWrapperCall.md)
- [isComponentWrapperCallLoose](functions/isComponentWrapperCallLoose.md)
- [isDeclaredInRenderPropLoose](functions/isDeclaredInRenderPropLoose.md)
- [isFragmentElement](functions/isFragmentElement.md)
- [isFunctionOfRender](functions/isFunctionOfRender.md)
- [isFunctionOfRenderMethod](functions/isFunctionOfRenderMethod.md)
- [isGetChildContext](functions/isGetChildContext.md)
- [isGetDefaultProps](functions/isGetDefaultProps.md)
- [isGetDerivedStateFromError](functions/isGetDerivedStateFromError.md)
- [isGetDerivedStateFromProps](functions/isGetDerivedStateFromProps.md)
- [isGetInitialState](functions/isGetInitialState.md)
- [isGetSnapshotBeforeUpdate](functions/isGetSnapshotBeforeUpdate.md)
- [isHostElement](functions/isHostElement.md)
- [isJsxLike](functions/isJsxLike.md)
- [isJsxText](functions/isJsxText.md)
Expand All @@ -142,16 +147,10 @@
- [isReactHookId](functions/isReactHookId.md)
- [isReactHookName](functions/isReactHookName.md)
- [isRenderFunctionLoose](functions/isRenderFunctionLoose.md)
- [isRenderLike](functions/isRenderLike.md)
- [isRenderMethodLike](functions/isRenderMethodLike.md)
- [isRenderPropLoose](functions/isRenderPropLoose.md)
- [isShouldComponentUpdate](functions/isShouldComponentUpdate.md)
- [isThisSetState](functions/isThisSetState.md)
- [isUnsafeComponentWillMount](functions/isUnsafeComponentWillMount.md)
- [isUnsafeComponentWillReceiveProps](functions/isUnsafeComponentWillReceiveProps.md)
- [isUnsafeComponentWillUpdate](functions/isUnsafeComponentWillUpdate.md)
- [isUseEffectCallLoose](functions/isUseEffectCallLoose.md)
- [isValidComponentDefinition](functions/isValidComponentDefinition.md)
- [stringifyJsx](functions/stringifyJsx.md)
- [useComponentCollector](functions/useComponentCollector.md)
- [useComponentCollectorLegacy](functions/useComponentCollectorLegacy.md)
Expand Down
9 changes: 5 additions & 4 deletions packages/core/docs/functions/findParentAttribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@

> **findParentAttribute**(`node`, `test`): `undefined` \| `JSXAttribute`

Find the parent JSX attribute node of a node
Traverses up the AST to find a parent JSX attribute node that matches a given test

## Parameters

### node

`Node`

The node to find the parent attribute of
The starting AST node

### test

(`node`) => `boolean`

The test to apply to the parent attribute
Optional predicate function to test if the attribute meets criteria
Defaults to always returning true (matches any attribute)

## Returns

`undefined` \| `JSXAttribute`

The parent attribute node or undefined
The first matching JSX attribute node found when traversing upwards, or undefined
13 changes: 7 additions & 6 deletions packages/core/docs/functions/getAttribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,37 @@

> **getAttribute**(`context`, `name`, `attributes`, `initialScope?`): `undefined` \| `JSXAttribute` \| `JSXSpreadAttribute`

Get the JSX attribute node with the given name
Searches for a specific JSX attribute by name in a list of attributes
Returns the last matching attribute (rightmost in JSX)

## Parameters

### context

`RuleContext`

The ESLint rule context
ESLint rule context

### name

`string`

The name of the attribute
The name of the attribute to find

### attributes

(`JSXAttribute` \| `JSXSpreadAttribute`)[]

The attributes to search
Array of JSX attributes to search through

### initialScope?

`Scope`

The initial scope to use for variable resolution
Optional scope for resolving variables

## Returns

`undefined` \| `JSXAttribute` \| `JSXSpreadAttribute`

The JSX attribute node or undefined
The found attribute or undefined
10 changes: 5 additions & 5 deletions packages/core/docs/functions/getAttributeValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@

> **getAttributeValue**(`context`, `node`, `name`): \{ `initialScope`: `undefined` \| `Scope`; `kind`: `"none"`; `node`: `Node`; \} \| \{ `initialScope`: `undefined` \| `Scope`; `kind`: `"some"`; `node`: `Node`; `value`: `unknown`; \}

Get a StaticValue of the attribute value
Extracts the value of a JSX attribute by name

## Parameters

### context

`RuleContext`

The rule context
ESLint rule context

### node

The JSX attribute node
JSX attribute or spread attribute node

`JSXAttribute` | `JSXSpreadAttribute`

### name

`string`

The name of the attribute
Name of the attribute to extract

## Returns

\{ `initialScope`: `undefined` \| `Scope`; `kind`: `"none"`; `node`: `Node`; \} \| \{ `initialScope`: `undefined` \| `Scope`; `kind`: `"some"`; `node`: `Node`; `value`: `unknown`; \}

The StaticValue of the attribute value
The extracted attribute value in a structured format
10 changes: 6 additions & 4 deletions packages/core/docs/functions/getElementType.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@

> **getElementType**(`context`, `node`): `string`

Get the stringified type of a JSX element
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

## Parameters

### context

`RuleContext`

The ESLint rule context
ESLint rule context

### node

The JSX element node
JSX element or fragment node

`JSXElement` | `JSXFragment`

## Returns

`string`

The type of the element
String representation of the element type
12 changes: 12 additions & 0 deletions packages/core/docs/functions/hasAnyAttribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@

> **hasAnyAttribute**(`context`, `names`, `attributes`, `initialScope?`): `boolean`

Checks if a JSX element has at least one of the specified attributes

## Parameters

### context

`RuleContext`

ESLint rule context

### names

`string`[]

Array of attribute names to check for

### attributes

(`JSXAttribute` \| `JSXSpreadAttribute`)[]

List of JSX attributes from opening element

### initialScope?

`Scope`

Optional scope for resolving variables in spread attributes

## Returns

`boolean`

boolean indicating whether any of the attributes exist
12 changes: 12 additions & 0 deletions packages/core/docs/functions/hasAttribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@

> **hasAttribute**(`context`, `name`, `attributes`, `initialScope?`): `boolean`

Checks if a JSX element has a specific attribute

## Parameters

### context

`RuleContext`

ESLint rule context

### name

`string`

Name of the attribute to check for

### attributes

(`JSXAttribute` \| `JSXSpreadAttribute`)[]

List of JSX attributes from opening element

### initialScope?

`Scope`

Optional scope for resolving variables in spread attributes

## Returns

`boolean`

boolean indicating whether the attribute exists
12 changes: 12 additions & 0 deletions packages/core/docs/functions/hasEveryAttribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@

> **hasEveryAttribute**(`context`, `names`, `attributes`, `initialScope?`): `boolean`

Checks if a JSX element has all of the specified attributes

## Parameters

### context

`RuleContext`

ESLint rule context

### names

`string`[]

Array of attribute names to check for

### attributes

(`JSXAttribute` \| `JSXSpreadAttribute`)[]

List of JSX attributes from opening element

### initialScope?

`Scope`

Optional scope for resolving variables in spread attributes

## Returns

`boolean`

boolean indicating whether all of the attributes exist
37 changes: 37 additions & 0 deletions packages/core/docs/functions/isComponentDefinition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[**@eslint-react/core**](../README.md)

***

[@eslint-react/core](../README.md) / isComponentDefinition

# Function: isComponentDefinition()

> **isComponentDefinition**(`context`, `node`, `hint`): `boolean`

Determines if a function node represents a valid React component definition

## Parameters

### context

`RuleContext`

The rule context

### node

`TSESTreeFunction`

The function node to check

### hint

`bigint`

Component detection hints as bit flags

## Returns

`boolean`

`true` if the node is a valid component definition, `false` otherwise
9 changes: 9 additions & 0 deletions packages/core/docs/functions/isFragmentElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@

> **isFragmentElement**(`context`, `node`): `node is JSXElement`

Determines if a JSX element is a React Fragment
Fragments can be imported from React and used like <Fragment> or <React.Fragment>

## Parameters

### context

`RuleContext`

ESLint rule context

### node

`Node`

AST node to check

## Returns

`node is JSXElement`

boolean indicating if the element is a Fragment with type narrowing
Loading