@@ -108,6 +108,16 @@ Another approach for customizing ESLint config by paths is through [ESLint Casca
108
108
109
109
## Shareable configurations
110
110
111
+ > [ !NOTE]
112
+ >
113
+ > ` eslint.config.js ` compatible versions of configs are available prefixed with
114
+ > ` flat/ ` , though most of the plugin documentation still currently uses
115
+ > ` .eslintrc ` syntax.
116
+ >
117
+ > Refer to the
118
+ > [ ESLint documentation on the new configuration file format] ( https://eslint.org/docs/latest/use/configure/configuration-files-new )
119
+ > for more.
120
+
111
121
This plugin exports several recommended configurations that enforce good practices for specific Testing Library packages.
112
122
You can find more info about enabled rules in the [ Supported Rules section] ( #supported-rules ) , under the ` Configurations ` column.
113
123
@@ -140,6 +150,22 @@ module.exports = {
140
150
};
141
151
```
142
152
153
+ To enable this configuration with ` eslint.config.js ` , use
154
+ ` testingLibrary.configs['flat/dom'] ` :
155
+
156
+ ``` js
157
+ const testingLibrary = require (' eslint-plugin-testing-library' );
158
+
159
+ module .exports = [
160
+ {
161
+ files: [
162
+ /* glob matching your test files */
163
+ ],
164
+ ... testingLibrary .configs [' flat/dom' ],
165
+ },
166
+ ];
167
+ ```
168
+
143
169
### Angular
144
170
145
171
Enforces recommended rules for Angular Testing Library.
@@ -153,6 +179,22 @@ module.exports = {
153
179
};
154
180
```
155
181
182
+ To enable this configuration with ` eslint.config.js ` , use
183
+ ` testingLibrary.configs['flat/angular'] ` :
184
+
185
+ ``` js
186
+ const testingLibrary = require (' eslint-plugin-testing-library' );
187
+
188
+ module .exports = [
189
+ {
190
+ files: [
191
+ /* glob matching your test files */
192
+ ],
193
+ ... testingLibrary .configs [' flat/angular' ],
194
+ },
195
+ ];
196
+ ```
197
+
156
198
### React
157
199
158
200
Enforces recommended rules for React Testing Library.
@@ -166,6 +208,22 @@ module.exports = {
166
208
};
167
209
```
168
210
211
+ To enable this configuration with ` eslint.config.js ` , use
212
+ ` testingLibrary.configs['flat/react'] ` :
213
+
214
+ ``` js
215
+ const testingLibrary = require (' eslint-plugin-testing-library' );
216
+
217
+ module .exports = [
218
+ {
219
+ files: [
220
+ /* glob matching your test files */
221
+ ],
222
+ ... testingLibrary .configs [' flat/react' ],
223
+ },
224
+ ];
225
+ ```
226
+
169
227
### Vue
170
228
171
229
Enforces recommended rules for Vue Testing Library.
@@ -179,6 +237,22 @@ module.exports = {
179
237
};
180
238
```
181
239
240
+ To enable this configuration with ` eslint.config.js ` , use
241
+ ` testingLibrary.configs['flat/vue'] ` :
242
+
243
+ ``` js
244
+ const testingLibrary = require (' eslint-plugin-testing-library' );
245
+
246
+ module .exports = [
247
+ {
248
+ files: [
249
+ /* glob matching your test files */
250
+ ],
251
+ ... testingLibrary .configs [' flat/vue' ],
252
+ },
253
+ ];
254
+ ```
255
+
182
256
### Marko
183
257
184
258
Enforces recommended rules for Marko Testing Library.
@@ -192,6 +266,22 @@ module.exports = {
192
266
};
193
267
```
194
268
269
+ To enable this configuration with ` eslint.config.js ` , use
270
+ ` testingLibrary.configs['flat/marko'] ` :
271
+
272
+ ``` js
273
+ const testingLibrary = require (' eslint-plugin-testing-library' );
274
+
275
+ module .exports = [
276
+ {
277
+ files: [
278
+ /* glob matching your test files */
279
+ ],
280
+ ... testingLibrary .configs [' flat/marko' ],
281
+ },
282
+ ];
283
+ ```
284
+
195
285
## Supported Rules
196
286
197
287
> Remember that all rules from this plugin are prefixed by ` "testing-library/" `
0 commit comments