-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.js
More file actions
53 lines (44 loc) · 2.06 KB
/
node.js
File metadata and controls
53 lines (44 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import nodePlugin from 'eslint-plugin-n';
import { defineConfig } from 'eslint/config';
import baseConfig from './base.js';
export default defineConfig([
baseConfig,
nodePlugin.configs['flat/recommended'],
{
rules: {
// Require require() calls to be placed at top-level module scope
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md
'n/global-require': 'error',
// Enforce either Buffer or require("buffer").Buffer
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/buffer.md
'n/prefer-global/buffer': 'error',
// Disallow new operators with calls to require
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md
'n/no-new-require': 'error',
// Disallow string concatenation with __dirname and __filename
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md
'n/no-path-concat': 'error',
// Disallow the use of process.exit()
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
'n/no-process-exit': 'off',
// Disallow import declarations which import non-existence modules
// Since we are using TypeScript, we don't need this rule. ts will report an error if you are importing a non-existent module.
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-import.md
'n/no-missing-import': 'off',
// Prohibit default exports.
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
'import/no-default-export': 'error',
// Disallow dangling underscores in identifiers
// https://eslint.org/docs/rules/no-underscore-dangle
'no-underscore-dangle': [
'error',
{
allow: ['__typename', '_id'],
allowAfterThis: false,
allowAfterSuper: false,
enforceInMethodNames: true,
},
],
},
},
]);