-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
144 lines (142 loc) · 3.86 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
const ignore = rules => withSeverity(rules, 0)
const warn = rules => withSeverity(rules, 1)
const error = rules => withSeverity(rules, 2)
const withSeverity = (rules, severity) => (
rules.reduce((obj, entry) => {
if (typeof entry === 'string') {
obj[entry] = severity
} else {
const rule = entry[0]
const options = entry.slice(1)
obj[rule] = [ severity, ...options ]
}
return obj
}, {})
)
module.exports = {
extends: [
'standard',
'eslint:recommended',
'airbnb',
'plugin:react/recommended',
'prettier',
],
parser: 'babel-eslint',
plugins: [
'react',
'standard',
'prefer-import',
'prettier',
],
rules: {
...ignore([
'array-bracket-spacing',
'camelcase',
'class-methods-use-this',
'comma-dangle',
'curly',
'default-case',
'eqeqeq',
'func-names',
'function-paren-newline',
'implicit-arrow-linebreak',
'import/extensions',
'import/no-dynamic-require',
'import/no-unresolved',
'import/prefer-default-export',
'indent',
'jsx-a11y/control-has-associated-label',
'jsx-a11y/label-has-associated-control',
'jsx-a11y/no-autofocus',
'jsx-a11y/no-autofocus',
'jsx-quotes',
'lines-between-class-members',
'max-classes-per-file',
'max-params',
'no-bitwise',
'no-multi-assign',
'no-confusing-arrow',
'no-continue',
'no-plusplus',
'no-return-assign',
'no-underscore-dangle',
'nonblock-statement-body-position',
'object-curly-newline',
'one-var',
'operator-linebreak',
'prefer-arrow-callback',
'prefer-rest-params',
'react/boolean-prop-naming',
'react/button-has-type',
'react/destructuring-assignment',
'react/jsx-curly-brace-presence',
'react/jsx-props-no-spreading',
'react/no-array-index-key',
'react/no-children-prop',
'react/prefer-stateless-function',
'react/prop-types',
'react/require-default-props',
'react/sort-comp',
'valid-jsdoc',
]),
...error([
'array-callback-return',
'arrow-spacing',
'block-spacing',
'brace-style',
'comma-style',
'computed-property-spacing',
'dot-location',
'eol-last',
'func-call-spacing',
'func-name-matching',
'no-catch-shadow',
['no-console', { allow: [ 'warn', 'error' ] }],
'no-duplicate-imports',
'no-implicit-globals',
'no-mixed-requires',
['no-param-reassign', { props: false }],
'no-script-url',
'no-trailing-spaces',
'no-useless-rename',
['no-use-before-define', { functions: false }],
'no-whitespace-before-property',
['object-curly-spacing', 'always'],
'prefer-import/prefer-import-over-require',
'prettier/prettier',
'react/default-props-match-prop-types',
'react/no-typos',
'react/no-unused-prop-types',
'react/no-unused-state',
'react/prefer-es6-class',
'react/style-prop-object',
'react/jsx-closing-bracket-location',
'react/jsx-closing-tag-location',
['react/jsx-filename-extension', { extensions: ['.js', '.jsx'] }],
['react/jsx-first-prop-new-line', 'multiline'],
['react/jsx-indent', 2],
['react/jsx-indent-props', 2],
'react/jsx-one-expression-per-line',
'react/jsx-tag-spacing',
['react/jsx-wrap-multilines', {
declaration: 'parens-new-line',
assignment: 'parens-new-line',
return: 'parens-new-line',
arrow: 'parens-new-line',
condition: 'parens-new-line',
logical: 'parens-new-line',
prop: 'parens-new-line',
}],
'rest-spread-spacing',
['semi', 'never'],
'wrap-iife',
]),
},
settings: {
polyfills: [
"Promise",
"Object.assign",
"Object.values"
]
}
};