-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
128 lines (105 loc) · 3.69 KB
/
index.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
'use strict'
const ESLint = require('eslint')
const Merge = require('deepmerge')
const AirbnbConfig = require('eslint-config-airbnb')
const StandardConfig = require('eslint-config-standard')
const StandardPlugin = require('eslint-plugin-standard')
const FlowtypePlugin = require('eslint-plugin-flowtype')
const ImportPlugin = require('eslint-plugin-import')
const JsxA11yPlugin = require('eslint-plugin-jsx-a11y')
const PromisePlugin = require('eslint-plugin-promise')
const ReactPlugin = require('eslint-plugin-react')
const merged = Merge.all([
StandardPlugin,
FlowtypePlugin,
ImportPlugin,
JsxA11yPlugin,
PromisePlugin,
ReactPlugin,
])
module.exports = {
eslint: ESLint,
rules: merged.rules,
rulesConfig: merged.rulesConfig,
deprecatedRules: merged.deprecatedRules,
configs: {
airbnb: AirbnbConfig,
standard: StandardConfig,
recommended: {
extends: [
'airbnb',
'standard',
'plugin:flowtype/recommended',
],
parser: 'babel-eslint',
plugins: [
'flowtype',
],
rules: {
'arrow-body-style': ['error', 'as-needed'],
'arrow-parens': ['error', 'as-needed'],
'brace-style': ['error', 'stroustrup'],
'comma-dangle': ['error', 'always-multiline'],
'import/extensions': ['error', {
js: 'never',
jsx: 'never',
}],
'import/no-extraneous-dependencies': ['error', {
devDependencies: true,
}],
'import/no-duplicates': ['error', 'always'],
'no-duplicate-imports': 0, // handled by import/no-duplicates
'quote-props': ['error', 'as-needed', { numbers: true }],
'react/jsx-filename-extension': [0],
'react/require-extension': [0],
'react/prefer-stateless-function': [
0,
{ ignorePureComponents: true },
],
// Since there's currently no way for eslint to enforce
// React.PureComponent and detect when a component should _not_ be a
// PureComponent, we will warn whenever using React.Component for now.
// https://github.com/yannickcr/eslint-plugin-react/issues/971#issuecomment-262733418
// 'no-restricted-syntax': [2, {
// object: 'React',
// property: 'Component',
// message: 'Please consider using PureComponent instead, and use Flow covariant modifiers to enforce immutable Objects and Arrays. See https://goo.gl/zgqmH2 for examples.',
// }],
'no-restricted-syntax': [1, {
selector: 'ImportDeclaration[source.value="react"] > ImportSpecifier[imported.name="Component"]',
message: 'Please consider using PureComponent instead with Flow covariant modifiers to enforce immutable Objects and Arrays. See https://goo.gl/zgqmH2 for examples.',
}],
strict: 0,
'max-len': ['error', {
code: 80,
tabWidth: 2,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreUrls: true,
}],
'operator-linebreak': ['error', 'before'],
'no-multiple-empty-lines': ['error', {
max: 2,
maxEOF: 0,
}],
'no-underscore-dangle': [0],
'padded-blocks': ['error', 'always'],
// Included in https://github.com/airbnb/javascript/pull/1648 which
// will land in the next major release for eslint-config-airbnb
'jsx-a11y/anchor-is-valid': ['error', {
components: ['Link'],
specialLink: ['to'],
aspects: ['noHref', 'invalidHref', 'preferButton'],
}],
},
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: false,
},
},
env: {
jest: true,
},
},
},
}