forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
107 lines (105 loc) · 3.57 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
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
parser: 'babel-eslint',
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:flowtype/recommended',
'prettier',
'prettier/flowtype',
'prettier/react',
],
parserOptions: {
ecmaVersion: '2017',
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true,
},
sourceType: 'module',
},
plugins: ['babel', 'react', 'flowtype', 'import', 'prettier'],
rules: {
// Plugin rules:
'import/no-duplicates': 'error',
'import/no-unresolved': 'error',
'import/named': 'error',
'prettier/prettier': 'error',
'react/button-has-type': 'error',
'react/no-access-state-in-setstate': 'error',
'react/no-danger': 'error',
'react/no-did-mount-set-state': 'error',
'react/no-did-update-set-state': 'error',
'react/no-will-update-set-state': 'error',
'react/no-redundant-should-component-update': 'error',
'react/no-this-in-sfc': 'error',
'react/no-typos': 'error',
// Flow provides enough coverage over the prop types, and there can be errors
// with some of the more complicated Flow types.
'react/prop-types': 'off',
"react/jsx-curly-brace-presence": ['error', { "props": 'never', "children": 'never' }],
// `no-unused-prop-types` is buggy when we use destructuring parameters in
// functions as it misunderstands them as functional components.
// See https://github.com/yannickcr/eslint-plugin-react/issues/1561
// 'react/no-unused-prop-types': 'error',
'react/no-unused-state': 'error',
'react/jsx-no-bind': 'error',
'flowtype/require-valid-file-annotation': [ 'error', 'always', { annotationStyle: 'line' } ],
// no-dupe-keys crashes with recent eslint. See
// https://github.com/gajus/eslint-plugin-flowtype/pull/266 and
// https://github.com/gajus/eslint-plugin-flowtype/pull/302
// 'flowtype/no-dupe-keys': 'error',
// overriding recommended rules
'no-constant-condition': ['error', { checkLoops: false }],
'no-console': ['error', { allow: ['log', 'warn', 'error'] }],
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
// possible errors
'array-callback-return': 'error',
'consistent-return': 'error',
'default-case': 'error',
'dot-notation': 'error',
eqeqeq: 'error',
'for-direction': 'error',
'no-alert': 'error',
'no-caller': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-label': 'error',
'no-implied-eval': 'error',
// We use the version from the babel plugin so that `this` in a function
// class property doesn't give a false positive.
'babel/no-invalid-this': 'error',
'no-return-await': 'error',
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-unmodified-loop-condition': 'error',
// We use the version from the flowtype plugin so that flow assertions don't
// output an error.
'flowtype/no-unused-expressions': 'error',
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': 'error',
'no-with': 'error',
'prefer-const': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'no-else-return': 'error',
},
settings: {
react: {
pragma: 'React',
version: '15.0',
flowVersion: '0.63.1',
},
},
};