-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.cjs
90 lines (81 loc) · 3.69 KB
/
.eslintrc.cjs
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
module.exports = {
'root': true,
'env': {
'browser': true,
'node': true,
'es2018': true
},
'parserOptions': {
'ecmaVersion': 2018,
'sourceType': 'module'
},
'plugins': [
'html',
'import'
],
'globals': {
'Nanobar': 'readonly'
},
'extends': 'eslint:recommended',
'rules': {
/* Override eslint:recommended */
'no-constant-condition': ['error', { 'checkLoops': false }], // modified: sometimes use while(true) and break inside
'no-fallthrough': ['error', { 'allowEmptyCase': true }], // modified: set allowEmptyCase to true to allow empty cases
'no-inner-declarations': 'off', // modified: sometimes use function inside function
'no-irregular-whitespace': ['error', { 'skipStrings': true, 'skipComments': false, 'skipRegExps': true, 'skipTemplates': true }], // set options
'no-prototype-builtins': 'off', // modified: sometimes use object.hasOwnProperty
'no-unused-vars': ['error', { 'vars': 'all', 'args': 'none', 'caughtErrors': 'none', 'ignoreRestSiblings': true }], // modified: ignore in some cases
'no-empty': ['error', { 'allowEmptyCatch': true }], // modified: set allowEmptyCatch to true to allow empty catch blocks
/* Possible Problems */
'array-callback-return': 'error',
'no-template-curly-in-string': 'error',
/* Suggestions */
'curly': ['warn', 'multi-line', 'consistent'],
'comma-dangle': ['warn', 'never'],
'arrow-parens': ['warn', 'as-needed'],
'func-name-matching': ['warn', 'always', { 'includeCommonJSModuleExports': false }],
'no-var': 'warn',
'prefer-const': ['warn', { 'destructuring': 'all', 'ignoreReadBeforeAssign': false }],
'new-cap': ['warn', { 'newIsCap': true, 'capIsNew': false, 'properties': true }],
'max-depth': ['warn', 5],
'max-nested-callbacks': ['warn', 3],
/* Layout & Formatting */
'array-bracket-spacing': ['warn', 'never'],
'block-spacing': ['warn', 'always'],
'brace-style': ['warn', '1tbs', { 'allowSingleLine': true }],
'comma-spacing': ['warn', { 'before': false, 'after': true }],
'comma-style': ['warn', 'last'],
'computed-property-spacing': ['warn', 'never'],
'func-call-spacing': ['warn', 'never'],
'indent': ['warn', 'tab', { 'SwitchCase': 1 }],
'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': 'strict' }],
'new-parens': 'warn',
'no-trailing-spaces': 'warn',
'no-whitespace-before-property': 'warn',
'object-curly-spacing': ['warn', 'always'],
'padded-blocks': ['warn', { 'blocks': 'never', 'classes': 'always', 'switches': 'never' }],
'semi': ['warn', 'always', { 'omitLastInOneLineBlock': true }],
'semi-spacing': ['warn', { 'before': false, 'after': true }],
'space-before-blocks': ['warn', 'always'],
'space-before-function-paren': ['warn', { 'anonymous': 'never', 'named': 'never', 'asyncArrow': 'ignore' }],
'space-in-parens': ['warn', 'never'],
'space-infix-ops': 'warn',
'space-unary-ops': ['warn', { 'words': true, 'nonwords': false }],
'keyword-spacing': ['warn', { 'before': true, 'after': true }],
'spaced-comment': ['warn', 'always', { 'block': { 'exceptions': ['*'], 'balanced': true } }],
'switch-colon-spacing': ['warn', { 'after': true, 'before': false }],
'template-tag-spacing': ['warn', 'never'],
'arrow-spacing': ['warn', { 'before': true, 'after': true }],
'generator-star-spacing': ['warn', { 'before': false, 'after': true }],
'rest-spread-spacing': ['warn', 'never'],
'template-curly-spacing': ['warn', 'never'],
'yield-star-spacing': ['warn', 'after'],
'no-multi-spaces': 'warn',
'quotes': ['warn', 'single'],
'semi-style': ['warn', 'last'],
'no-multiple-empty-lines': ['warn', { 'max': 3, 'maxEOF': 1, 'maxBOF': 1 }],
// 'eol-last': ['warn', 'always'],
/* Import(plugin) */
'import/extensions': ['warn', 'always']
}
};