Skip to content

Commit 3318986

Browse files
committed
Update deps and linting rules
1 parent ee9ec78 commit 3318986

File tree

3 files changed

+141
-115
lines changed

3 files changed

+141
-115
lines changed

eslint.config.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const importXPlugin = require('eslint-plugin-import-x')
1111
const nodePlugin = require('eslint-plugin-n')
1212
const sortDestructureKeysPlugin = require('eslint-plugin-sort-destructure-keys')
1313
const unicornPlugin = require('eslint-plugin-unicorn')
14+
const globals = require('globals')
1415

1516
const constants = require('@socketsecurity/registry/lib/constants')
1617
const { BIOME_JSON, GIT_IGNORE, LATEST } = constants
@@ -30,17 +31,36 @@ module.exports = [
3031
},
3132
{
3233
files: ['**/*.{c,}js'],
34+
...js.configs.recommended,
3335
...importXPlugin.flatConfigs.recommended,
36+
...nodePlugin.configs['flat/recommended-script'],
3437
languageOptions: {
38+
...js.configs.recommended.languageOptions,
3539
...importXPlugin.flatConfigs.recommended.languageOptions,
40+
...nodePlugin.configs['flat/recommended-script'].languageOptions,
3641
ecmaVersion: LATEST,
42+
globals: Object.fromEntries(
43+
Object.entries(globals.node).map(([k]) => [k, 'readonly'])
44+
),
3745
sourceType: 'script'
3846
},
3947
linterOptions: {
48+
...js.configs.recommended.linterOptions,
49+
...importXPlugin.flatConfigs.recommended.linterOptions,
50+
...nodePlugin.configs['flat/recommended-script'].linterOptions,
4051
reportUnusedDisableDirectives: 'off'
4152
},
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+
},
4260
rules: {
61+
...js.configs.recommended.rules,
4362
...importXPlugin.flatConfigs.recommended.rules,
63+
...nodePlugin.configs['flat/recommended-script'].rules,
4464
'import-x/extensions': [
4565
'error',
4666
'never',
@@ -75,14 +95,7 @@ module.exports = [
7595
order: 'asc'
7696
}
7797
}
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+
],
8699
'n/exports-style': ['error', 'module.exports'],
87100
// The n/no-unpublished-bin rule does does not support non-trivial glob
88101
// patterns used in package.json "files" fields. In those cases we simplify
@@ -98,17 +111,7 @@ module.exports = [
98111
version: constants.maintainedNodeVersions.previous
99112
}
100113
],
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',
112115
'no-await-in-loop': 'error',
113116
'no-control-regex': 'error',
114117
'no-empty': ['error', { allowEmptyCatch: true }],

0 commit comments

Comments
 (0)