@@ -11,6 +11,7 @@ const importXPlugin = require('eslint-plugin-import-x')
11
11
const nodePlugin = require ( 'eslint-plugin-n' )
12
12
const sortDestructureKeysPlugin = require ( 'eslint-plugin-sort-destructure-keys' )
13
13
const unicornPlugin = require ( 'eslint-plugin-unicorn' )
14
+ const globals = require ( 'globals' )
14
15
15
16
const constants = require ( '@socketsecurity/registry/lib/constants' )
16
17
const { BIOME_JSON , GIT_IGNORE , LATEST } = constants
@@ -30,17 +31,36 @@ module.exports = [
30
31
} ,
31
32
{
32
33
files : [ '**/*.{c,}js' ] ,
34
+ ...js . configs . recommended ,
33
35
...importXPlugin . flatConfigs . recommended ,
36
+ ...nodePlugin . configs [ 'flat/recommended-script' ] ,
34
37
languageOptions : {
38
+ ...js . configs . recommended . languageOptions ,
35
39
...importXPlugin . flatConfigs . recommended . languageOptions ,
40
+ ...nodePlugin . configs [ 'flat/recommended-script' ] . languageOptions ,
36
41
ecmaVersion : LATEST ,
42
+ globals : Object . fromEntries (
43
+ Object . entries ( globals . node ) . map ( ( [ k ] ) => [ k , 'readonly' ] )
44
+ ) ,
37
45
sourceType : 'script'
38
46
} ,
39
47
linterOptions : {
48
+ ...js . configs . recommended . linterOptions ,
49
+ ...importXPlugin . flatConfigs . recommended . linterOptions ,
50
+ ...nodePlugin . configs [ 'flat/recommended-script' ] . linterOptions ,
40
51
reportUnusedDisableDirectives : 'off'
41
52
} ,
53
+ plugins : {
54
+ ...js . configs . recommended . plugins ,
55
+ ...importXPlugin . flatConfigs . recommended . plugins ,
56
+ ...nodePlugin . configs [ 'flat/recommended-script' ] . plugins ,
57
+ 'sort-destructure-keys' : sortDestructureKeysPlugin ,
58
+ unicorn : unicornPlugin
59
+ } ,
42
60
rules : {
61
+ ...js . configs . recommended . rules ,
43
62
...importXPlugin . flatConfigs . recommended . rules ,
63
+ ...nodePlugin . configs [ 'flat/recommended-script' ] . rules ,
44
64
'import-x/extensions' : [
45
65
'error' ,
46
66
'never' ,
@@ -75,14 +95,7 @@ module.exports = [
75
95
order : 'asc'
76
96
}
77
97
}
78
- ]
79
- }
80
- } ,
81
- {
82
- files : [ 'scripts/**/*.{c,}js' , 'test/**/*.{c,}js' ] ,
83
- ...nodePlugin . configs [ 'flat/recommended-script' ] ,
84
- rules : {
85
- ...nodePlugin . configs [ 'flat/recommended-script' ] . rules ,
98
+ ] ,
86
99
'n/exports-style' : [ 'error' , 'module.exports' ] ,
87
100
// The n/no-unpublished-bin rule does does not support non-trivial glob
88
101
// patterns used in package.json "files" fields. In those cases we simplify
@@ -98,17 +111,7 @@ module.exports = [
98
111
version : constants . maintainedNodeVersions . previous
99
112
}
100
113
] ,
101
- 'n/prefer-node-protocol' : 'error'
102
- }
103
- } ,
104
- {
105
- files : [ 'scripts/**/*.{c,}js' , 'test/**/*.{c,}js' ] ,
106
- plugins : {
107
- 'sort-destructure-keys' : sortDestructureKeysPlugin ,
108
- unicorn : unicornPlugin
109
- } ,
110
- rules : {
111
- ...js . configs . recommended . rules ,
114
+ 'n/prefer-node-protocol' : 'error' ,
112
115
'no-await-in-loop' : 'error' ,
113
116
'no-control-regex' : 'error' ,
114
117
'no-empty' : [ 'error' , { allowEmptyCatch : true } ] ,
0 commit comments