1
- import fs from "node:fs/promises" ;
2
1
import url from "node:url" ;
3
2
3
+ import { fixupPluginRules } from "@eslint/compat" ;
4
4
import { FlatCompat } from "@eslint/eslintrc" ;
5
5
import eslintPluginJs from "@eslint/js" ;
6
6
import eslintPluginStylisticJs from "@stylistic/eslint-plugin-js" ;
@@ -19,6 +19,34 @@ import eslintPluginPrettierInternalRules from "./scripts/tools/eslint-plugin-pre
19
19
20
20
const toPath = ( file ) => url . fileURLToPath ( new URL ( file , import . meta. url ) ) ;
21
21
const compat = new FlatCompat ( { baseDirectory : toPath ( "./" ) } ) ;
22
+ eslintPluginReactConfigRecommended . plugins . react = fixupPluginRules (
23
+ eslintPluginReactConfigRecommended . plugins . react ,
24
+ ) ;
25
+
26
+ const ignores = `
27
+ .tmp
28
+ # Ignore directories and files in 'tests/format'
29
+ tests/format/**/*
30
+ # Unignore directories and 'jsfmt.spec.js', 'format.test.js' file
31
+ !tests/format/**/
32
+ !tests/format/**/format.test.js
33
+ # TODO: Remove this in 2025
34
+ !tests/format/**/jsfmt.spec.js
35
+ tests/integration/cli/
36
+ test*.*
37
+ scripts/release/node_modules
38
+ coverage/
39
+ dist*/
40
+ **/node_modules/**
41
+ website/build/
42
+ website/static/playground.js
43
+ website/static/lib/
44
+ scripts/benchmark/*/
45
+ **/.yarn/**
46
+ **/.pnp.*
47
+ `
48
+ . split ( "\n" )
49
+ . filter ( ( pattern ) => pattern && ! pattern . startsWith ( "#" ) ) ;
22
50
23
51
export default [
24
52
eslintPluginJs . configs . recommended ,
@@ -253,11 +281,13 @@ export default [
253
281
"unicorn/relative-url-style" : "off" ,
254
282
"unicorn/switch-case-braces" : [ "error" , "avoid" ] ,
255
283
} ,
284
+
285
+ linterOptions : {
286
+ reportUnusedDisableDirectives : "error" ,
287
+ } ,
256
288
} ,
257
289
{
258
- ignores : ( await fs . readFile ( "./.eslintignore" , "utf8" ) )
259
- . split ( "\n" )
260
- . filter ( ( pattern ) => pattern && ! pattern . startsWith ( "#" ) ) ,
290
+ ignores,
261
291
} ,
262
292
// CommonJS modules
263
293
{
@@ -420,6 +450,7 @@ export default [
420
450
...compat
421
451
. env ( { browser : true , worker : true } )
422
452
. map ( ( config ) => ( { ...config , files : [ "website/**/*" ] } ) ) ,
453
+ // Use `Object.assign` since it contains non-enumerable properties
423
454
Object . assign ( eslintPluginReactConfigRecommended , {
424
455
files : [ "website/**/*" ] ,
425
456
settings : {
@@ -443,6 +474,13 @@ export default [
443
474
sourceType : "module" ,
444
475
} ,
445
476
} ,
477
+ // `import/no-extraneous-dependencies` reports on Windows but not on CI
478
+ {
479
+ files : [ "website/siteConfig.js" ] ,
480
+ linterOptions : {
481
+ reportUnusedDisableDirectives : "off" ,
482
+ } ,
483
+ } ,
446
484
{
447
485
files : [ "bin/prettier.cjs" ] ,
448
486
languageOptions : {
0 commit comments