-
Notifications
You must be signed in to change notification settings - Fork 1
/
react.js
122 lines (122 loc) · 4.41 KB
/
react.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
module.exports = {
extends: [
'./js',
'plugin:react/recommended',
],
env: {
amd: true,
browser: true,
node: true,
},
rules: {
'jsx-quotes': ['error', 'prefer-single'],
'object-curly-spacing': 'off',
'react/prop-types': 0,
'react/jsx-max-props-per-line': ['error', { 'maximum': 1, 'when': 'always' }],
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
'react/jsx-closing-bracket-location': ['error', 'tag-aligned'],
'react/jsx-closing-tag-location': 'error',
'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
'react/sort-comp': ['error', {
order: [
'static-variables',
'static-methods',
'instance-variables',
'lifecycle',
'/^on.+$/',
'getters',
'setters',
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
'instance-methods',
'everything-else',
'rendering',
],
groups: {
lifecycle: [
'displayName',
'propTypes',
'contextTypes',
'childContextTypes',
'mixins',
'statics',
'defaultProps',
'constructor',
'getDefaultProps',
'getInitialState',
'state',
'getChildContext',
'getDerivedStateFromProps',
'componentWillMount',
'UNSAFE_componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'UNSAFE_componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'UNSAFE_componentWillUpdate',
'getSnapshotBeforeUpdate',
'componentDidUpdate',
'componentDidCatch',
'componentWillUnmount',
],
rendering: [
'/^render.+$/',
'render',
],
},
}],
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
'react/jsx-pascal-case': ['error', {
allowAllCaps: true,
ignore: [],
}],
'react/no-danger': 'warn',
'react/prefer-es6-class': ['error', 'always'],
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
'react/react-in-jsx-scope': 'error',
'react/require-render-return': 'error',
'react/self-closing-comp': 'error',
'react/jsx-wrap-multilines': ['error', {
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',
}],
'react/no-danger-with-children': 'error',
'react/no-unused-prop-types': ['error', {
customValidators: [
],
skipShapeProps: true,
}],
'react/destructuring-assignment': ['error', 'always'],
'react/no-redundant-should-component-update': 'error',
'react/no-unused-state': 'error',
'react/no-typos': 'error',
'react/jsx-tag-spacing': ['error', {
closingSlash: 'never',
beforeSelfClosing: 'always',
afterOpening: 'never',
beforeClosing: 'never',
}],
'react/boolean-prop-naming': ['off', {
propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
message: '',
}],
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
'react/no-access-state-in-setstate': 'error',
'react/jsx-props-no-multi-spaces': 'error',
'react/jsx-curly-newline': ['error', {
multiline: 'consistent',
singleline: 'consistent',
}],
'react/jsx-props-no-spreading': ['warn', {
html: 'enforce',
custom: 'enforce',
exceptions: [],
}],
},
};