@@ -9,11 +9,15 @@ React specific linting rules for ESLint
9
9
10
10
Install [ ESLint] ( https://www.github.com/eslint/eslint ) either locally or globally.
11
11
12
- npm install eslint
12
+ ``` sh
13
+ $ npm install eslint
14
+ ```
13
15
14
16
If you installed ` ESLint ` globally, you have to install React plugin globally too. Otherwise, install it locally.
15
17
16
- $ npm install eslint-plugin-react
18
+ ``` sh
19
+ $ npm install eslint-plugin-react
20
+ ```
17
21
18
22
# Configuration
19
23
@@ -46,8 +50,8 @@ Finally, enable all of the rules that you would like to use.
46
50
"react/jsx-boolean-value" : 1 ,
47
51
"react/jsx-closing-bracket-location" : 1 ,
48
52
"react/jsx-curly-spacing" : 1 ,
49
- "react/jsx-max-props-per-line" : 1 ,
50
53
"react/jsx-indent-props" : 1 ,
54
+ "react/jsx-max-props-per-line" : 1 ,
51
55
"react/jsx-no-duplicate-props" : 1 ,
52
56
"react/jsx-no-undef" : 1 ,
53
57
"react/jsx-quotes" : 1 ,
@@ -56,10 +60,10 @@ Finally, enable all of the rules that you would like to use.
56
60
"react/jsx-uses-react" : 1 ,
57
61
"react/jsx-uses-vars" : 1 ,
58
62
"react/no-danger" : 1 ,
59
- "react/no-set-state" : 1 ,
60
63
"react/no-did-mount-set-state" : 1 ,
61
64
"react/no-did-update-set-state" : 1 ,
62
65
"react/no-multi-comp" : 1 ,
66
+ "react/no-set-state" : 1 ,
63
67
"react/no-unknown-property" : 1 ,
64
68
"react/prop-types" : 1 ,
65
69
"react/react-in-jsx-scope" : 1 ,
@@ -73,12 +77,12 @@ Finally, enable all of the rules that you would like to use.
73
77
74
78
# List of supported rules
75
79
76
- * [ display-name] ( docs/rules/display-name.md ) : Prevent missing displayName in a React component definition
80
+ * [ display-name] ( docs/rules/display-name.md ) : Prevent missing ` displayName ` in a React component definition
77
81
* [ jsx-boolean-value] ( docs/rules/jsx-boolean-value.md ) : Enforce boolean attributes notation in JSX
78
82
* [ jsx-closing-bracket-location] ( docs/rules/jsx-closing-bracket-location.md ) : Validate closing bracket location in JSX
79
83
* [ jsx-curly-spacing] ( docs/rules/jsx-curly-spacing.md ) : Enforce or disallow spaces inside of curly braces in JSX attributes
80
- * [ jsx-max-props-per-line] ( docs/rules/jsx-max-props-per-line.md ) : Limit maximum of props on a single line in JSX
81
84
* [ jsx-indent-props] ( docs/rules/jsx-indent-props.md ) : Validate props indentation in JSX
85
+ * [ jsx-max-props-per-line] ( docs/rules/jsx-max-props-per-line.md ) : Limit maximum of props on a single line in JSX
82
86
* [ jsx-no-duplicate-props] ( docs/rules/jsx-no-duplicate-props.md ) : Prevent duplicate props in JSX
83
87
* [ jsx-no-literals] ( docs/rules/jsx-no-literals.md ) : Prevent usage of unwrapped JSX strings
84
88
* [ jsx-no-undef] ( docs/rules/jsx-no-undef.md ) : Disallow undeclared variables in JSX
@@ -88,13 +92,13 @@ Finally, enable all of the rules that you would like to use.
88
92
* [ jsx-uses-react] ( docs/rules/jsx-uses-react.md ) : Prevent React to be incorrectly marked as unused
89
93
* [ jsx-uses-vars] ( docs/rules/jsx-uses-vars.md ) : Prevent variables used in JSX to be incorrectly marked as unused
90
94
* [ no-danger] ( docs/rules/no-danger.md ) : Prevent usage of dangerous JSX properties
91
- * [ no-set-state] ( docs/rules/no-set-state.md ) : Prevent usage of setState
92
- * [ no-did-mount-set-state] ( docs/rules/no-did-mount-set-state.md ) : Prevent usage of setState in componentDidMount
93
- * [ no-did-update-set-state] ( docs/rules/no-did-update-set-state.md ) : Prevent usage of setState in componentDidUpdate
95
+ * [ no-did-mount-set-state] ( docs/rules/no-did-mount-set-state.md ) : Prevent usage of ` setState ` in ` componentDidMount `
96
+ * [ no-did-update-set-state] ( docs/rules/no-did-update-set-state.md ) : Prevent usage of ` setState ` in ` componentDidUpdate `
94
97
* [ no-multi-comp] ( docs/rules/no-multi-comp.md ) : Prevent multiple component definition per file
98
+ * [ no-set-state] ( docs/rules/no-set-state.md ) : Prevent usage of ` setState `
95
99
* [ no-unknown-property] ( docs/rules/no-unknown-property.md ) : Prevent usage of unknown DOM property
96
100
* [ prop-types] ( docs/rules/prop-types.md ) : Prevent missing props validation in a React component definition
97
- * [ react-in-jsx-scope] ( docs/rules/react-in-jsx-scope.md ) : Prevent missing React when using JSX
101
+ * [ react-in-jsx-scope] ( docs/rules/react-in-jsx-scope.md ) : Prevent missing ` React ` when using JSX
98
102
* [ require-extension] ( docs/rules/require-extension.md ) : Restrict file extensions that may be required
99
103
* [ self-closing-comp] ( docs/rules/self-closing-comp.md ) : Prevent extra closing tags for components without children
100
104
* [ sort-comp] ( docs/rules/sort-comp.md ) : Enforce component methods order
0 commit comments