You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+20-3
Original file line number
Diff line number
Diff line change
@@ -89,15 +89,15 @@ Add `plugin:jsx-a11y/recommended` or `plugin:jsx-a11y/strict` in `extends`:
89
89
}
90
90
```
91
91
92
-
> As you are extending our configuration, you can omit `"plugins": ["jsx-a11y"]` from your `.eslintrc` configuration file.
92
+
### Configurations
93
93
94
-
To enable your custom components to be checked as DOM elements, you can set global settings in your
95
-
configuration file by mapping each custom component name to a DOM element type.
94
+
> As you are extending our configuration, you can omit `"plugins": ["jsx-a11y"]` from your `.eslintrc` configuration file.
96
95
97
96
```json
98
97
{
99
98
"settings": {
100
99
"jsx-a11y": {
100
+
"polymorphicPropName": "as",
101
101
"components": {
102
102
"CityInput": "input",
103
103
"CustomButton": "button",
@@ -109,6 +109,23 @@ configuration file by mapping each custom component name to a DOM element type.
109
109
}
110
110
```
111
111
112
+
#### Component Mapping
113
+
114
+
To enable your custom components to be checked as DOM elements, you can set global settings in your configuration file by mapping each custom component name to a DOM element type.
115
+
116
+
#### Polymorphic Components
117
+
118
+
You can optionally use the `polymorphicPropName` setting to define the prop your code uses to create polymorphic components.
119
+
This setting will be used determine the element type in rules that require semantic context.
120
+
121
+
For example, if you set the `polymorphicPropName` setting to `as` then this element:
122
+
123
+
`<Box as="h3">Configurations </Box>`
124
+
125
+
will be evaluated as an `h3`. If no `polymorphicPropName` is set, then the component will be evaluated as `Box`.
126
+
127
+
⚠️ Polymorphic components can make code harder to maintain; please use this feature with caution.
0 commit comments