-
Notifications
You must be signed in to change notification settings - Fork 44
/
.eslintrc.js
128 lines (122 loc) · 4.43 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const noRestrictedProperies = require('eslint-config-airbnb-base/rules/best-practices').rules['no-restricted-properties'].filter(
rule => !(
// Disable options which force code that doesn't work in IE11
(rule.object === 'Math' && rule.property === 'pow') ||
(rule.object === 'window' && rule.property === 'isNaN')
)
);
module.exports = {
env: {
browser : true,
es6 : true,
node : true,
},
plugins: [
'align-assignments',
],
extends: [
'airbnb-base',
],
parser : '@babel/eslint-parser',
parserOptions : {
requireConfigFile : false,
ecmaVersion : 8,
sourceType : 'module',
},
globals: {
Genoverse: true,
},
ignorePatterns: [
'node_modules',
'dist',
'**/*.min.js',
'src/js/lib/dalliance/*.js',
'src/js/lib/jquery-plugins/*.js',
],
rules: {
'align-assignments/align-assignments' : [ 'error', { requiresOnly: false }],
'padding-line-between-statements' : [
'error', ...[
[ '*', [ 'multiline-block-like', 'return', 'break', 'export', 'throw', 'cjs-export' ]],
[ '*', [ 'cjs-import', 'import', 'const', 'let', 'var' ]],
[[ 'multiline-block-like', 'return', 'break', 'export', 'throw', 'cjs-export' ], '*' ],
[[ 'cjs-import', 'import', 'const', 'let', 'var' ], '*' ],
[ 'cjs-import', 'cjs-import', 'any' ],
[ 'import', 'import', 'any' ],
[ 'singleline-const', 'const', 'any' ],
[ 'singleline-let', 'let', 'any' ],
[ 'singleline-var', 'var', 'any' ],
[ 'expression', 'expression', 'any' ],
].map(
([ prev, next = '*', blankLine = 'always' ]) => ({ prev, next, blankLine })
),
],
'max-len' : 'off',
'no-multi-spaces' : 'off',
'no-multi-assign' : 'off',
'no-nested-ternary' : 'off',
'no-prototype-builtins' : 'off',
'no-plusplus' : 'off',
'operator-linebreak' : 'off',
'prefer-destructuring' : 'off',
'quote-props' : 'off',
'template-curly-spacing' : 'off',
'yoda' : 'off',
'no-underscore-dangle' : 'off',
'newline-per-chained-call' : 'off',
'default-param-last' : 'off',
'no-promise-executor-return' : 'off',
'no-continue' : 'off',
'no-fallthrough' : 'off',
'no-bitwise' : 'off',
'func-names' : 'off',
'no-param-reassign' : 'off',
'array-bracket-spacing' : [ 'warn', 'always', { objectsInArrays: false, arraysInArrays: false }],
'quotes' : [ 'warn', 'single', { avoidEscape: true }],
'arrow-parens' : [ 'error', 'as-needed', { requireForBlockBody: true }],
'function-paren-newline' : [ 'error', 'consistent' ],
'function-call-argument-newline' : [ 'error', 'consistent' ],
'linebreak-style' : [ 'error', 'unix' ],
'object-shorthand' : [ 'error', 'consistent' ],
'comma-dangle': [ 'error', {
arrays : 'always-multiline',
objects : 'always-multiline',
imports : 'always-multiline',
exports : 'always-multiline',
functions : 'never',
}],
'key-spacing': [ 'error', {
singleLine : { beforeColon: false, afterColon: true },
multiLine : { beforeColon: false, afterColon: true },
align : { beforeColon: true, afterColon: true, on: 'colon' },
}],
'object-curly-newline': [ 'error', {
ObjectExpression : { multiline: true, consistent: true },
ObjectPattern : { multiline: true, consistent: true },
}],
'import/no-extraneous-dependencies' : [ 'error' ],
'import/order' : [ 'error', {
alphabetize : { order: 'asc' },
groups : [ 'builtin', 'external', 'internal', 'parent', 'sibling' ],
}],
'no-restricted-globals' : [ 'error', 'event', 'isFinite' ],
'no-restricted-properties' : noRestrictedProperies,
'consistent-return': 'off', // FIXME: async functions and $.events
},
overrides: [
{
files : [ 'test/**/*.js' ],
globals : {
jest : true,
describe : true,
it : true,
expect : true,
fail : true,
beforeAll : true,
afterAll : true,
afterEach : true,
beforeEach : true,
},
},
],
};