-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy path.eslintrc.js
More file actions
91 lines (87 loc) · 2.47 KB
/
.eslintrc.js
File metadata and controls
91 lines (87 loc) · 2.47 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module.exports = {
env: {
browser: true,
commonjs: true,
es2022: true,
node: true,
jest: true
},
extends: [
'eslint:recommended',
'plugin:security/recommended',
'plugin:import/recommended',
'plugin:promise/recommended'
],
plugins: ['security', 'import', 'promise'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.json']
}
}
},
rules: {
// Code style
'indent': ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single', { avoidEscape: true }],
'semi': ['error', 'always'],
// Best practices
'no-unused-vars': ['error', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'caughtErrorsIgnorePattern': '^_'
}],
'no-console': 'warn',
'prefer-const': 'error',
'no-var': 'error',
'prefer-arrow-callback': 'error',
'arrow-spacing': 'error',
'no-duplicate-imports': 'error',
// Security
'security/detect-object-injection': 'warn',
'security/detect-non-literal-regexp': 'warn',
'security/detect-unsafe-regex': 'error',
'security/detect-buffer-noassert': 'error',
'security/detect-child-process': 'warn',
'security/detect-disable-mustache-escape': 'error',
'security/detect-eval-with-expression': 'error',
'security/detect-no-csrf-before-method-override': 'error',
'security/detect-non-literal-fs-filename': 'warn',
'security/detect-non-literal-require': 'warn',
'security/detect-possible-timing-attacks': 'warn',
'security/detect-pseudoRandomBytes': 'error',
// Import rules
'import/order': ['error', {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always'
}],
'import/no-unresolved': 'error',
'import/no-cycle': 'error',
// Promise rules
'promise/always-return': 'error',
'promise/no-return-wrap': 'error',
'promise/param-names': 'error',
'promise/catch-or-return': 'error',
'promise/no-native': 'off',
'promise/no-nesting': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn'
},
overrides: [
{
files: ['*.test.js', '*.spec.js'],
env: {
jest: true
},
rules: {
'security/detect-object-injection': 'off',
'no-unused-expressions': 'off'
}
}
]
};