forked from heiseonline/eslint-config-heise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
81 lines (76 loc) · 1.95 KB
/
index.js
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
const {STATUS_CODES} = require('http')
const statusCodes = Object.keys(STATUS_CODES).map(s => parseInt(s, 10))
module.exports = {
root: true,
plugins: [
'prettier',
'sonarjs',
'security',
'jest',
'no-loops',
'toplevel',
],
extends: [
'eslint:recommended',
'plugin:security/recommended',
'plugin:promise/recommended',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
],
rules: {
'security/detect-object-injection': 'off',
'no-console': ['warn', { 'allow': ['warn', 'error'] }],
'prettier/prettier': ['warn', {
semi: false,
singleQuote: true,
trailingComma: 'es5',
}],
complexity: ['error', {
max: 5
}],
'max-depth': ['error', 3],
'prefer-const': ['error',{
destructuring: 'all',
ignoreReadBeforeAssign: true,
}],
'consistent-return': 'error',
'no-warning-comments': ['warn'],
'sonarjs/cognitive-complexity': ['error', 5],
'sonarjs/no-duplicate-string': ['error', 5],
// https://github.com/expressjs/generator/issues/78
'no-unused-vars': ['error', { 'argsIgnorePattern': '^(_|next)' }],
'no-magic-numbers': ['error', {
ignoreArrayIndexes: true,
ignore: [
-1,
0,
1,
...statusCodes
]
}],
'no-useless-concat': 'error',
'prefer-template': 'error',
'no-nested-ternary': 'error',
'no-var': 'error',
'no-loops/no-loops': 'error',
'toplevel/no-toplevel-side-effect': 'error',
'unicorn/prevent-abbreviations': 'off',
'dot-notation': 'error',
'no-extra-semi': 'off',
// IE11 Does not support `Number` static props
'unicorn/prefer-number-properties': 'off',
'unicorn/prefer-set-has': 'off'
},
overrides: [{
files: ['*.test.js', '**/test/**', '**/__mocks__/**'],
rules: {
'no-magic-numbers': 'off',
'toplevel/no-toplevel-side-effect': 'off',
}
}],
env: {
node: true,
jest: true,
es6: true
}
}