@@ -42,8 +42,74 @@ A Record of aliases for React's built-in Hooks. ESLint React will recognize thes
42
42
This is intended to cover edge cases. We suggest to use this option very sparingly, if at all.\
43
43
(e.g. ` { useLayoutEffect: ["useIsomorphicLayoutEffect"] } ` ).
44
44
45
+ ### ` additionalComponents ` (experimental)
46
+
47
+ A Array of aliases for built-in components. ESLint React will recognize these aliases as equivalent to the built-in components in all its rules.\
48
+ This is an experimental feature that can be unstable and lacks comprehensive documentation.\
49
+
45
50
## Examples
46
51
52
+ ### Basic Configuration
53
+
54
+ <ESLintConfig >
55
+
56
+ <Config >
57
+
58
+ ``` ts twoslash filename="eslint.config.js"
59
+ // ...
60
+ import react from " @eslint-react/eslint-plugin" ;
61
+
62
+ // ...
63
+ export default [
64
+ // ...
65
+ {
66
+ files: [" **/*.{ts,tsx}" ],
67
+ ... react .configs .recommended ,
68
+ settings: {
69
+ " react-x" : {
70
+ importSource: " react" ,
71
+ jsxPragma: " createElement" ,
72
+ jsxPragmaFrag: " Fragment" ,
73
+ additionalHooks: {
74
+ useLayoutEffect: [" useIsomorphicLayoutEffect" ],
75
+ // ...
76
+ },
77
+ version: " detect" ,
78
+ },
79
+ },
80
+ },
81
+ ];
82
+ ```
83
+
84
+ </Config >
85
+
86
+ <Config >
87
+
88
+ ``` js filename=".eslintrc.js"
89
+ // ...
90
+ module .exports = {
91
+ // ...
92
+ settings: {
93
+ " react-x" : {
94
+ importSource: " react" ,
95
+ jsxPragma: " createElement" ,
96
+ jsxPragmaFrag: " Fragment" ,
97
+ additionalHooks: {
98
+ useLayoutEffect: [" useIsomorphicLayoutEffect" ],
99
+ // ...
100
+ },
101
+ version: " detect" ,
102
+ },
103
+ },
104
+ };
105
+ ```
106
+
107
+ </Config >
108
+
109
+ </ESLintConfig >
110
+
111
+ ### Advanced Configuration
112
+
47
113
<ESLintConfig >
48
114
49
115
<Config >
@@ -67,6 +133,17 @@ export default [
67
133
useLayoutEffect: [" useIsomorphicLayoutEffect" ],
68
134
// ...
69
135
},
136
+ additionalComponents: [
137
+ {
138
+ name: " Link" ,
139
+ as: " a" ,
140
+ attributes: [
141
+ { name: " to" , as: " href" },
142
+ { name: " rel" , as: " rel" , defaultValue: " noopener noreferrer" },
143
+ ],
144
+ },
145
+ // ...
146
+ ],
70
147
version: " detect" ,
71
148
},
72
149
},
@@ -92,6 +169,17 @@ module.exports = {
92
169
useLayoutEffect: [" useIsomorphicLayoutEffect" ],
93
170
// ...
94
171
},
172
+ additionalComponents: [
173
+ {
174
+ name: " Link" ,
175
+ as: " a" ,
176
+ attributes: [
177
+ { name: " to" , as: " href" },
178
+ { name: " rel" , as: " rel" , defaultValue: " noopener noreferrer" },
179
+ ],
180
+ },
181
+ // ...
182
+ ],
95
183
version: " detect" ,
96
184
},
97
185
},
0 commit comments