-
Notifications
You must be signed in to change notification settings - Fork 33
/
.eslintrc.js
120 lines (113 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
module.exports = {
// So parent files don't get applied
root: true,
globals: {
preval: false,
},
env: {
es6: true,
browser: true,
node: true,
mocha: true,
},
extends: ['airbnb', 'plugin:import/recommended'],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 7,
sourceType: 'module',
},
plugins: ['babel', 'import', 'jsx-a11y', 'mocha', 'prettier'],
settings: {
'import/resolver': {
node: {
// As configured in webpack
moduleDirectory: ['src', 'node_modules'],
},
},
},
rules: {
// Disable for convenience
'global-require': 'off',
'no-underscore-dangle': 'off',
'linebreak-style': 'off', // Don't play nicely with Windows.
'arrow-body-style': 'off', // Not our taste?
'arrow-parens': 'off', // Incompatible with prettier
'object-curly-newline': 'off', // Incompatible with prettier
'function-paren-newline': 'off', // Incompatible with prettier
indent: 'off', // Incompatible with prettier
'space-before-function-paren': 'off', // Incompatible with prettier
'no-mixed-operators': 'off', // Incompatible with prettier
'consistent-this': ['error', 'self'],
'max-len': [
'error',
100,
2,
{
ignoreUrls: true,
},
], // airbnb is allowing some edge cases
'no-console': 'error', // airbnb is using warn
'no-alert': 'error', // airbnb is using warn
'no-param-reassign': 'off', // Not our taste?
'no-prototype-builtins': 'off', // airbnb use error
'object-curly-spacing': 'off', // use babel plugin rule
'no-restricted-properties': 'off', // To remove once react-docgen support ** operator.
'prefer-destructuring': 'off', // To remove once react-docgen support ** operator.
'babel/object-curly-spacing': ['error', 'always'],
'import/no-extraneous-dependencies': 'off',
'import/unambiguous': 'off',
'import/no-unresolved': 'off',
'import/extensions': 'off',
'react/jsx-indent': 'off', // Incompatible with prettier
'react/jsx-closing-bracket-location': 'off', // Incompatible with prettier
'react/jsx-wrap-multilines': 'off', // Incompatible with prettier
'react/jsx-indent-props': 'off', // Incompatible with prettier
'react/jsx-handler-names': [
'error',
{
// airbnb is disabling this rule
eventHandlerPrefix: 'handle',
eventHandlerPropPrefix: 'on',
},
],
'react/require-default-props': 'off', // airbnb use error
'react/forbid-prop-types': 'off', // airbnb use error
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }], // airbnb is using .jsx
'react/no-danger': 'error', // airbnb is using warn
'react/no-direct-mutation-state': 'error', // airbnb is disabling this rule
'react/no-find-dom-node': 'off', // I don't know
'react/no-unused-prop-types': 'off', // Is still buggy
'react/sort-prop-types': 'error', // airbnb do nothing here.
'react/sort-comp': [
2,
{
order: [
'type-annotations',
'static-methods',
'lifecycle',
// '/^handle.+$/', // wishlist -- needs above first
// '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', // wishlist -- needs above first
'everything-else',
'/^render.+$/',
'render',
],
},
],
'react/default-props-match-prop-types': 'off', // Buggy
'react/jsx-curly-brace-presence': 'off', // Buggy
'mocha/handle-done-callback': 'error',
'mocha/no-exclusive-tests': 'error',
'mocha/no-global-tests': 'error',
'mocha/no-pending-tests': 'error',
'mocha/no-skipped-tests': 'error',
'prettier/prettier': ['error'],
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['to'],
aspects: ['noHref', 'invalidHref', 'preferButton'],
},
],
},
};