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
46 changes: 0 additions & 46 deletions apps/website/content/docs/configuration/configure-analyzer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,6 @@ Example with `polymorphicPropName` set to `as`:
// Evaluated as an h3 element
```

### `additionalComponents` (Experimental)

<Callout type="info">
Consider using `polymorphicPropName` instead when possible, as it's simpler
and more efficient.
</Callout>

<Callout type="warn">
Experimental feature that may lack stability and documentation.
</Callout>

Maps components and their attributes for comprehensive analysis. Supports default attribute values.

Example configuration:

```json
[
{
"name": "EmbedContent",
"as": "iframe",
"attributes": [
{
"name": "sandbox",
"defaultValue": ""
}
]
}
]
```

This makes `<EmbedContent src="https://eslint-react.xyz" />{:tsx}` evaluate as `<iframe src="https://eslint-react.xyz" sandbox="" />{:tsx}`.

### `additionalHooks` (Experimental)

<Callout type="warn">
Expand Down Expand Up @@ -127,20 +95,6 @@ export default [
useEffect: ["useIsomorphicLayoutEffect"],
useLayoutEffect: ["useIsomorphicLayoutEffect"],
},

// (Experimental) Configure mapping for custom components and their attributes for more comprehensive analysis
additionalComponents: [
{
name: "Link",
as: "a",
attributes: [{ name: "to", as: "href" }],
},
{
name: "EmbedContent",
as: "iframe",
attributes: [{ name: "sandbox", defaultValue: "" }],
},
],
},
},
},
Expand Down
21 changes: 0 additions & 21 deletions apps/website/content/docs/configuration/configure-analyzer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,6 @@ const properties = {
/>
),
},
additionalComponents: {
type: "CustomComponent[]",
description: <Link href="#additionalcomponents">An array of components and its attributes mapping ⤵</Link>,
default: "[]",
typeDescription: (
<CodeBlock
code={dedent`
type CustomComponent = {
name: string;
as?: string;
attributes?: {
name: string;
as?: string;
defaultValue?: string;
}[]
}
`}
lang="ts"
/>
),
},
polymorphicPropName: {
type: "string",
description: <Link href="#polymorphicpropname">The prop your code uses to create polymorphic components ⤵</Link>,
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion apps/website/content/docs/configuration/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"!configure-language-preference",
"configure-project-config",
"!---Advanced Configuration---",
"!enhanced-additional-components",
"!using-custom-parsers"
]
}
3 changes: 2 additions & 1 deletion packages/core/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

## Type Aliases

- [AttributeValue](type-aliases/AttributeValue.md)
- [Component](type-aliases/Component.md)
- [ComponentDetectionHint](type-aliases/ComponentDetectionHint.md)
- [ComponentEffectPhaseKind](type-aliases/ComponentEffectPhaseKind.md)
Expand Down Expand Up @@ -113,7 +114,6 @@
- [findParentAttribute](functions/findParentAttribute.md)
- [getAttribute](functions/getAttribute.md)
- [getAttributeName](functions/getAttributeName.md)
- [getAttributeValue](functions/getAttributeValue.md)
- [getComponentFlagFromInitPath](functions/getComponentFlagFromInitPath.md)
- [getComponentNameFromId](functions/getComponentNameFromId.md)
- [getElementType](functions/getElementType.md)
Expand Down Expand Up @@ -151,6 +151,7 @@
- [isRenderPropLoose](functions/isRenderPropLoose.md)
- [isThisSetState](functions/isThisSetState.md)
- [isUseEffectCallLoose](functions/isUseEffectCallLoose.md)
- [resolveAttributeValue](functions/resolveAttributeValue.md)
- [stringifyJsx](functions/stringifyJsx.md)
- [useComponentCollector](functions/useComponentCollector.md)
- [useComponentCollectorLegacy](functions/useComponentCollectorLegacy.md)
Expand Down
31 changes: 12 additions & 19 deletions packages/core/docs/functions/getAttribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,32 @@

# Function: getAttribute()

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

Searches for a specific JSX attribute by name in a list of attributes
Returns the last matching attribute (rightmost in JSX)
> **getAttribute**(`context`, `attributes`, `initialScope?`): (`name`) => `undefined` \| `TSESTreeJSXAttributeLike`

## Parameters

### context

`RuleContext`

ESLint rule context

### name

`string`

The name of the attribute to find

### attributes

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

Array of JSX attributes to search through
`TSESTreeJSXAttributeLike`[]

### initialScope?

`Scope`

Optional scope for resolving variables

## Returns

`undefined` \| `JSXAttribute` \| `JSXSpreadAttribute`
> (`name`): `undefined` \| `TSESTreeJSXAttributeLike`

### Parameters

#### name

`string`

### Returns

The found attribute or undefined
`undefined` \| `TSESTreeJSXAttributeLike`
37 changes: 0 additions & 37 deletions packages/core/docs/functions/getAttributeValue.md

This file was deleted.

23 changes: 23 additions & 0 deletions packages/core/docs/functions/resolveAttributeValue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[**@eslint-react/core**](../README.md)

***

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

# Function: resolveAttributeValue()

> **resolveAttributeValue**(`context`, `attribute`): \{ `kind`: `"boolean"`; `node?`: `undefined`; `toStatic`: `true`; \} \| \{ `kind`: `"literal"`; `node`: `BigIntLiteral` \| `BooleanLiteral` \| `NullLiteral` \| `NumberLiteral` \| `RegExpLiteral` \| `StringLiteral`; `toStatic`: `null` \| `string` \| `number` \| `bigint` \| `boolean` \| [`RegExp`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp); \} \| \{ `kind`: `"expression"`; `node`: `JSXEmptyExpression` \| `Expression`; `toStatic`: `unknown`; \} \| \{ `kind`: `"element"`; `node`: `JSXElement`; `toStatic`: `undefined`; \} \| \{ `kind`: `"spreadChild"`; `node`: `JSXEmptyExpression` \| `Expression`; `toStatic`: `undefined`; \} \| \{ `kind`: `"spreadProps"`; `node`: `Expression`; `toStatic`: `unknown`; \}

## Parameters

### context

`RuleContext`

### attribute

`TSESTreeJSXAttributeLike`

## Returns

\{ `kind`: `"boolean"`; `node?`: `undefined`; `toStatic`: `true`; \} \| \{ `kind`: `"literal"`; `node`: `BigIntLiteral` \| `BooleanLiteral` \| `NullLiteral` \| `NumberLiteral` \| `RegExpLiteral` \| `StringLiteral`; `toStatic`: `null` \| `string` \| `number` \| `bigint` \| `boolean` \| [`RegExp`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp); \} \| \{ `kind`: `"expression"`; `node`: `JSXEmptyExpression` \| `Expression`; `toStatic`: `unknown`; \} \| \{ `kind`: `"element"`; `node`: `JSXElement`; `toStatic`: `undefined`; \} \| \{ `kind`: `"spreadChild"`; `node`: `JSXEmptyExpression` \| `Expression`; `toStatic`: `undefined`; \} \| \{ `kind`: `"spreadProps"`; `node`: `Expression`; `toStatic`: `unknown`; \}
11 changes: 11 additions & 0 deletions packages/core/docs/type-aliases/AttributeValue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[**@eslint-react/core**](../README.md)

***

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

# Type Alias: AttributeValue

> **AttributeValue** = \{ `kind`: `"boolean"`; `toStatic`: `true`; \} \| \{ `kind`: `"element"`; `node`: `TSESTree.JSXElement`; `toStatic`: `unknown`; \} \| \{ `kind`: `"literal"`; `node`: `TSESTree.Literal`; `toStatic`: `null` \| `string` \| `number` \| `bigint` \| `boolean` \| [`RegExp`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp); \} \| \{ `kind`: `"expression"`; `node`: `TSESTree.JSXExpressionContainer`\[`"expression"`\]; `toStatic`: `unknown`; \} \| \{ `kind`: `"spreadProps"`; `node`: `TSESTree.JSXSpreadAttribute`\[`"argument"`\]; `toStatic`: `unknown`; \} \| \{ `kind`: `"spreadChild"`; `node`: `TSESTree.JSXSpreadChild`\[`"expression"`\]; `toStatic`: `unknown`; \}

Represents possible JSX attribute value types that can be resolved
Loading