Skip to content

Commit 6702f15

Browse files
committed
Move nodePlugin to shared lint config
1 parent 7b3873d commit 6702f15

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

eslint.config.mjs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,30 @@ const nodeGlobalsConfig = Object.fromEntries(
3737
)
3838

3939
const sharedPlugins = {
40+
...nodePlugin.configs['flat/recommended-script'].plugins,
4041
'sort-destructure-keys': sortDestructureKeysPlugin,
4142
unicorn: unicornPlugin
4243
}
4344

4445
const sharedRules = {
46+
'n/exports-style': ['error', 'module.exports'],
47+
'n/no-missing-require': ['off'],
48+
// The n/no-unpublished-bin rule does does not support non-trivial glob
49+
// patterns used in package.json "files" fields. In those cases we simplify
50+
// the glob patterns used.
51+
'n/no-unpublished-bin': 'error',
52+
'n/no-unsupported-features/es-builtins': 'error',
53+
'n/no-unsupported-features/es-syntax': 'error',
54+
'n/no-unsupported-features/node-builtins': [
55+
'error',
56+
{
57+
ignores: ['test', 'test.describe'],
58+
// Lazily access constants.maintainedNodeVersions.
59+
version: constants.maintainedNodeVersions.last
60+
}
61+
],
62+
'n/prefer-node-protocol': 'error',
63+
'unicorn/consistent-function-scoping': 'error',
4564
curly: 'error',
4665
'no-await-in-loop': 'error',
4766
'no-control-regex': 'error',
@@ -61,8 +80,7 @@ const sharedRules = {
6180
'no-warning-comments': ['warn', { terms: ['fixme'] }],
6281
'prefer-const': 'error',
6382
'sort-destructure-keys/sort-destructure-keys': 'error',
64-
'sort-imports': ['error', { ignoreDeclarationSort: true }],
65-
'unicorn/consistent-function-scoping': 'error'
83+
'sort-imports': ['error', { ignoreDeclarationSort: true }]
6684
}
6785

6886
const sharedRulesForImportX = {
@@ -243,31 +261,13 @@ export default [
243261
plugins: {
244262
...jsPlugin.configs.recommended.plugins,
245263
...importFlatConfigsForScript.recommended.plugins,
246-
...nodePlugin.configs['flat/recommended-script'].plugins,
247264
...sharedPlugins
248265
},
249266
rules: {
250267
...jsPlugin.configs.recommended.rules,
251268
...importFlatConfigsForScript.recommended.rules,
252269
...nodePlugin.configs['flat/recommended-script'].rules,
253-
...sharedRules,
254-
'n/exports-style': ['error', 'module.exports'],
255-
'n/no-missing-require': ['off'],
256-
// The n/no-unpublished-bin rule does does not support non-trivial glob
257-
// patterns used in package.json "files" fields. In those cases we simplify
258-
// the glob patterns used.
259-
'n/no-unpublished-bin': 'error',
260-
'n/no-unsupported-features/es-builtins': 'error',
261-
'n/no-unsupported-features/es-syntax': 'error',
262-
'n/no-unsupported-features/node-builtins': [
263-
'error',
264-
{
265-
ignores: ['test', 'test.describe'],
266-
// Lazily access constants.maintainedNodeVersions.
267-
version: constants.maintainedNodeVersions.last
268-
}
269-
],
270-
'n/prefer-node-protocol': 'error'
270+
...sharedRules
271271
}
272272
},
273273
{

0 commit comments

Comments
 (0)