This repository has been archived by the owner on Dec 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
react.js
89 lines (89 loc) · 2.53 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
/**
* React.js Apps and Components
*/
module.exports = {
env: {
node: true,
es6: true,
browser: true
},
extends: [
'eslint-config-mongodb-js',
'eslint-config-mongodb-js/rules/ecmascript-6'
],
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
},
parser: 'babel-eslint',
plugins: ['react'],
settings: {
react: {
version: 'detect'
}
},
rules: {
// Prevent missing displayName in a React component definition
'react/display-name': 0,
// Enforce boolean attributes notation in JSX
'react/jsx-boolean-value': 2,
// Enforce or disallow spaces inside of curly braces in JSX attributes
'react/jsx-curly-spacing': 0,
// Prevent duplicate props in JSX
'react/jsx-no-duplicate-props': 0,
// Disallow undeclared variables in JSX
'react/jsx-no-undef': 2,
// Enforce quote style for JSX attributes
'react/jsx-quotes': 0,
// Enforce propTypes declarations alphabetical sorting
'react/jsx-sort-prop-types': 0,
// Enforce props alphabetical sorting
'react/jsx-sort-props': 0,
// Prevent React to be incorrectly marked as unused
'react/jsx-uses-react': 2,
// Prevent variables used in JSX to be incorrectly marked as unused
'react/jsx-uses-vars': 2,
// Prevent usage of dangerous JSX properties
'react/no-danger': 0,
// Prevent usage of setState in componentDidMount
'react/no-did-mount-set-state': 2,
// Prevent usage of setState in componentDidUpdate
'react/no-did-update-set-state': 2,
// Prevent multiple component definition per file
'react/no-multi-comp': 2,
// Prevent usage of unknown DOM property
'react/no-unknown-property': 2,
// Prevent missing props validation in a React component definition
'react/prop-types': 2,
// Prevent missing React when using JSX
'react/react-in-jsx-scope': 2,
// Restrict file extensions that may be required
'react/require-extension': 0,
// Prevent extra closing tags for components without children
'react/self-closing-comp': [
2,
{
component: true
}
],
// Enforce component methods order
'react/sort-comp': [
2,
{
order: [
'lifecycle',
'/^on.+$/',
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
'everything-else',
'/^render.+$/',
'render'
]
}
],
// Prevent missing parentheses around multilines JSX
'react/jsx-wrap-multilines': 2
}
};