forked from atlassian/extract-react-types
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
97 lines (80 loc) · 2.82 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
module.exports = {
extends: [
'prettier',
'airbnb',
'prettier/react',
'plugin:jest/recommended',
'plugin:prettier/recommended'
],
parser: 'babel-eslint',
plugins: ['prettier', 'react', 'import', 'jest'],
env: {
es6: true,
browser: true,
node: true,
'jest/globals': true
},
globals: {
// flow globals
TimeoutID: true,
IntervalID: true,
AnimationFrameID: true
},
rules: {
// Error on prettier violations
'prettier/prettier': 'error',
'import/no-unresolved': 'off',
'prefer-const': 'off',
// New eslint style rules that is not disabled by prettier:
'lines-between-class-members': 'off',
// Allowing warning and error console logging
// use `invariant` and `warning`
'no-console': ['error'],
// Opting out of prefer destructuring (nicer with flow in lots of cases)
'prefer-destructuring': 'off',
// Disallowing the use of variables starting with `_` unless it called on `this`.
// Allowed: `this._secret = Symbol()`
// Not allowed: `const _secret = Symbol()`
'no-underscore-dangle': ['error', { allowAfterThis: true }],
// Cannot reassign function parameters but allowing modification
'no-param-reassign': ['error', { props: false }],
// Allowing ++ on numbers
'no-plusplus': 'off',
// Allowing Math.pow rather than forcing `**`
'no-restricted-properties': [
'off',
{
object: 'Math',
property: 'pow'
}
],
// Allowing jsx in files with any file extension (old components have jsx but not the extension)
'react/jsx-filename-extension': 'off',
// Not requiring default prop declarations all the time
'react/require-default-props': 'off',
// Opt out of preferring stateless functions
'react/prefer-stateless-function': 'off',
// Allowing files to have multiple components in it
'react/no-multi-comp': 'off',
// Sometimes we use the PropTypes.object PropType for simplicity
'react/forbid-prop-types': 'off',
// Allowing the non function setState approach
'react/no-access-state-in-setstate': 'off',
// Opting out of this
'react/destructuring-assignment': 'off',
// Adding 'skipShapeProps' as the rule has issues with correctly handling PropTypes.shape
'react/no-unused-prop-types': ['error', { skipShapeProps: true }],
// Having issues with this rule not working correctly
'react/default-props-match-prop-types': 'off',
// Allowing importing from dev deps (for stories and tests)
'import/no-extraneous-dependencies': 'off',
'spaced-comment': 'off',
'consistent-return': 'off',
'no-else-return': 'off',
'react/jsx-curly-brace-presence': 'off',
'import/no-useless-path-segments': 'off',
'react/sort-comp': 'off',
'no-use-before-define': 'off',
'no-restricted-syntax': 'off'
}
};