forked from af/envalid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
82 lines (76 loc) · 2.5 KB
/
.eslintrc.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
82
const [OFF, WARN, ERR] = [0, 1, 2]
module.exports = {
extends: 'eslint:recommended',
plugins: ['prettier'],
parserOptions: {
impliedStrict: true,
sourceType: 'module',
ecmaVersion: 7
},
env: {
es6: true,
node: true,
browser: true
},
globals: {},
rules: {
// Possible errors & best practices
complexity: [WARN, 7],
// "consistent-return": ERR,
'dot-notation': WARN,
eqeqeq: [ERR, 'allow-null'],
'linebreak-style': [ERR, 'unix'],
'no-empty': WARN,
'no-else-return': OFF,
'no-extra-bind': ERR,
// "no-magic-numbers": [ERR, { "ignore": [0, 1, 2, -1] }],
'no-param-reassign': WARN,
'no-throw-literal': WARN,
'no-warning-comments': WARN,
'no-unexpected-multiline': ERR,
radix: [WARN, 'as-needed'],
'wrap-iife': [WARN, 'outside'],
yoda: ERR,
// Variables
'init-declarations': [WARN, 'always'],
'no-redeclare': WARN,
'no-shadow': WARN,
'no-undef-init': ERR,
'no-use-before-define': WARN,
// Node/commonjs
'callback-return': WARN,
'handle-callback-err': ERR,
// Style
camelcase: [ERR, { properties: 'never' }],
'comma-dangle': OFF,
'max-depth': [ERR, 4],
'max-nested-callbacks': [WARN, 4],
'new-cap': OFF,
'no-bitwise': OFF, // Could enable later, but we do use bitwise ops in a few places
'no-case-declarations': OFF,
'no-console': WARN,
'no-lonely-if': WARN,
'no-new-object': ERR,
'no-restricted-syntax': [ERR, 'WithStatement'],
'no-unneeded-ternary': ERR,
'no-unused-vars': [WARN, { vars: 'all', args: 'none' }], // Should be err, but can trigger on commented-out code
'object-curly-spacing': [OFF, 'always'],
'one-var': [WARN, 'never'],
'spaced-comment': [ERR, 'always'],
// ES6
// Any rules here set to OFF are things to turn on eventually
'no-confusing-arrow': ERR,
'no-const-assign': ERR,
'no-dupe-class-members': ERR,
'no-var': ERR,
'object-shorthand': OFF,
'prefer-arrow-callback': OFF,
'prefer-const': WARN,
'prefer-spread': OFF,
'prefer-template': OFF,
// JSDoc
// "require-jsdoc": OFF,
// "valid-jsdoc": WARN
'prettier/prettier': [ERR, { singleQuote: true, semi: false, printWidth: 100, tabWidth: 4 }]
}
}