Skip to content

Commit 2508576

Browse files
appsforartistsyannickcr
authored andcommitted
Update README to add react/ prefix to rule names
1 parent 0aeebaf commit 2508576

File tree

1 file changed

+66
-61
lines changed

1 file changed

+66
-61
lines changed

README.md

Lines changed: 66 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -68,60 +68,65 @@ With ESLint 2.x.x:
6868
}
6969
```
7070

71-
Finally, enable all of the rules that you would like to use.
71+
Finally, enable all of the rules that you would like to use. Use [our preset](#user-content-recommended-configuration) to get reasonable defaults quickly, and/or choose your own:
7272

73-
The plugin has a [recommended configuration](#user-content-recommended-configuration) that enforces React good practices.
73+
```json
74+
"rules": {
75+
"react/jsx-uses-react": "error",
76+
"react/jsx-uses-vars": "error",
77+
}
78+
```
7479

7580
# List of supported rules
7681

77-
* [display-name](docs/rules/display-name.md): Prevent missing `displayName` in a React component definition
78-
* [forbid-prop-types](docs/rules/forbid-prop-types.md): Forbid certain propTypes
79-
* [no-danger](docs/rules/no-danger.md): Prevent usage of dangerous JSX properties
80-
* [no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods
81-
* [no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of `setState` in `componentDidMount`
82-
* [no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of `setState` in `componentDidUpdate`
83-
* [no-direct-mutation-state](docs/rules/no-direct-mutation-state.md): Prevent direct mutation of `this.state`
84-
* [no-is-mounted](docs/rules/no-is-mounted.md): Prevent usage of `isMounted`
85-
* [no-multi-comp](docs/rules/no-multi-comp.md): Prevent multiple component definition per file
86-
* [no-render-return-value](docs/rules/no-render-return-value.md): Prevent usage of the return value of `React.render`
87-
* [no-set-state](docs/rules/no-set-state.md): Prevent usage of `setState`
88-
* [no-string-refs](docs/rules/no-string-refs.md): Prevent using string references in `ref` attribute.
89-
* [no-unknown-property](docs/rules/no-unknown-property.md): Prevent usage of unknown DOM property (fixable)
90-
* [prefer-es6-class](docs/rules/prefer-es6-class.md): Enforce ES5 or ES6 class for React Components
91-
* [prefer-stateless-function](docs/rules/prefer-stateless-function.md): Enforce stateless React Components to be written as a pure function
92-
* [prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition
93-
* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing `React` when using JSX
94-
* [require-extension](docs/rules/require-extension.md): Restrict file extensions that may be required
95-
* [require-optimization](docs/rules/require-optimization.md): Enforce React components to have a shouldComponentUpdate method
96-
* [require-render-return](docs/rules/require-render-return.md): Enforce ES5 or ES6 class for returning value in render function
97-
* [self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children
98-
* [sort-comp](docs/rules/sort-comp.md): Enforce component methods order
99-
* [sort-prop-types](docs/rules/sort-prop-types.md): Enforce propTypes declarations alphabetical sorting
100-
* [wrap-multilines](docs/rules/wrap-multilines.md): Prevent missing parentheses around multilines JSX (fixable)
82+
* [react/display-name](docs/rules/display-name.md): Prevent missing `displayName` in a React component definition
83+
* [react/forbid-prop-types](docs/rules/forbid-prop-types.md): Forbid certain propTypes
84+
* [react/no-danger](docs/rules/no-danger.md): Prevent usage of dangerous JSX properties
85+
* [react/no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods
86+
* [react/no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of `setState` in `componentDidMount`
87+
* [react/no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of `setState` in `componentDidUpdate`
88+
* [react/no-direct-mutation-state](docs/rules/no-direct-mutation-state.md): Prevent direct mutation of `this.state`
89+
* [react/no-is-mounted](docs/rules/no-is-mounted.md): Prevent usage of `isMounted`
90+
* [react/no-multi-comp](docs/rules/no-multi-comp.md): Prevent multiple component definition per file
91+
* [react/no-render-return-value](docs/rules/no-render-return-value.md): Prevent usage of the return value of `React.render`
92+
* [react/no-set-state](docs/rules/no-set-state.md): Prevent usage of `setState`
93+
* [react/no-string-refs](docs/rules/no-string-refs.md): Prevent using string references in `ref` attribute.
94+
* [react/no-unknown-property](docs/rules/no-unknown-property.md): Prevent usage of unknown DOM property (fixable)
95+
* [react/prefer-es6-class](docs/rules/prefer-es6-class.md): Enforce ES5 or ES6 class for React Components
96+
* [react/prefer-stateless-function](docs/rules/prefer-stateless-function.md): Enforce stateless React Components to be written as a pure function
97+
* [react/prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition
98+
* [react/react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing `React` when using JSX
99+
* [react/require-extension](docs/rules/require-extension.md): Restrict file extensions that may be required
100+
* [react/require-optimization](docs/rules/require-optimization.md): Enforce React components to have a shouldComponentUpdate method
101+
* [react/require-render-return](docs/rules/require-render-return.md): Enforce ES5 or ES6 class for returning value in render function
102+
* [react/self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children
103+
* [react/sort-comp](docs/rules/sort-comp.md): Enforce component methods order
104+
* [react/sort-prop-types](docs/rules/sort-prop-types.md): Enforce propTypes declarations alphabetical sorting
105+
* [react/wrap-multilines](docs/rules/wrap-multilines.md): Prevent missing parentheses around multilines JSX (fixable)
101106

102107
## JSX-specific rules
103108

104-
* [jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX (fixable)
105-
* [jsx-closing-bracket-location](docs/rules/jsx-closing-bracket-location.md): Validate closing bracket location in JSX (fixable)
106-
* [jsx-curly-spacing](docs/rules/jsx-curly-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes (fixable)
107-
* [jsx-equals-spacing](docs/rules/jsx-equals-spacing.md): Enforce or disallow spaces around equal signs in JSX attributes (fixable)
108-
* [jsx-filename-extension](docs/rules/jsx-filename-extension.md): Restrict file extensions that may contain JSX
109-
* [jsx-first-prop-new-line](docs/rules/jsx-first-prop-new-line.md): Enforce position of the first prop in JSX
110-
* [jsx-handler-names](docs/rules/jsx-handler-names.md): Enforce event handler naming conventions in JSX
111-
* [jsx-indent](docs/rules/jsx-indent.md): Validate JSX indentation
112-
* [jsx-indent-props](docs/rules/jsx-indent-props.md): Validate props indentation in JSX (fixable)
113-
* [jsx-key](docs/rules/jsx-key.md): Validate JSX has key prop when in array or iterator
114-
* [jsx-max-props-per-line](docs/rules/jsx-max-props-per-line.md): Limit maximum of props on a single line in JSX
115-
* [jsx-no-bind](docs/rules/jsx-no-bind.md): Prevent usage of `.bind()` and arrow functions in JSX props
116-
* [jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md): Prevent duplicate props in JSX
117-
* [jsx-no-literals](docs/rules/jsx-no-literals.md): Prevent usage of unwrapped JSX strings
118-
* [jsx-no-target-blank](docs/rules/jsx-no-target-blank.md): Prevent usage of unsafe `target='_blank'`
119-
* [jsx-no-undef](docs/rules/jsx-no-undef.md): Disallow undeclared variables in JSX
120-
* [jsx-pascal-case](docs/rules/jsx-pascal-case.md): Enforce PascalCase for user-defined JSX components
121-
* [jsx-sort-props](docs/rules/jsx-sort-props.md): Enforce props alphabetical sorting
122-
* [jsx-space-before-closing](docs/rules/jsx-space-before-closing.md): Validate spacing before closing bracket in JSX (fixable)
123-
* [jsx-uses-react](docs/rules/jsx-uses-react.md): Prevent React to be incorrectly marked as unused
124-
* [jsx-uses-vars](docs/rules/jsx-uses-vars.md): Prevent variables used in JSX to be incorrectly marked as unused
109+
* [react/jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX (fixable)
110+
* [react/jsx-closing-bracket-location](docs/rules/jsx-closing-bracket-location.md): Validate closing bracket location in JSX (fixable)
111+
* [react/jsx-curly-spacing](docs/rules/jsx-curly-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes (fixable)
112+
* [react/jsx-equals-spacing](docs/rules/jsx-equals-spacing.md): Enforce or disallow spaces around equal signs in JSX attributes (fixable)
113+
* [react/jsx-filename-extension](docs/rules/jsx-filename-extension.md): Restrict file extensions that may contain JSX
114+
* [react/jsx-first-prop-new-line](docs/rules/jsx-first-prop-new-line.md): Enforce position of the first prop in JSX
115+
* [react/jsx-handler-names](docs/rules/jsx-handler-names.md): Enforce event handler naming conventions in JSX
116+
* [react/jsx-indent](docs/rules/jsx-indent.md): Validate JSX indentation
117+
* [react/jsx-indent-props](docs/rules/jsx-indent-props.md): Validate props indentation in JSX (fixable)
118+
* [react/jsx-key](docs/rules/jsx-key.md): Validate JSX has key prop when in array or iterator
119+
* [react/jsx-max-props-per-line](docs/rules/jsx-max-props-per-line.md): Limit maximum of props on a single line in JSX
120+
* [react/jsx-no-bind](docs/rules/jsx-no-bind.md): Prevent usage of `.bind()` and arrow functions in JSX props
121+
* [react/jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md): Prevent duplicate props in JSX
122+
* [react/jsx-no-literals](docs/rules/jsx-no-literals.md): Prevent usage of unwrapped JSX strings
123+
* [react/jsx-no-target-blank](docs/rules/jsx-no-target-blank.md): Prevent usage of unsafe `target='_blank'`
124+
* [react/jsx-no-undef](docs/rules/jsx-no-undef.md): Disallow undeclared variables in JSX
125+
* [react/jsx-pascal-case](docs/rules/jsx-pascal-case.md): Enforce PascalCase for user-defined JSX components
126+
* [react/jsx-sort-props](docs/rules/jsx-sort-props.md): Enforce props alphabetical sorting
127+
* [react/jsx-space-before-closing](docs/rules/jsx-space-before-closing.md): Validate spacing before closing bracket in JSX (fixable)
128+
* [react/jsx-uses-react](docs/rules/jsx-uses-react.md): Prevent React to be incorrectly marked as unused
129+
* [react/jsx-uses-vars](docs/rules/jsx-uses-vars.md): Prevent variables used in JSX to be incorrectly marked as unused
125130

126131
## React Native rules
127132

@@ -146,20 +151,20 @@ See [ESLint documentation](http://eslint.org/docs/user-guide/configuring#extendi
146151

147152
The rules enabled in this configuration are:
148153

149-
* [display-name](docs/rules/display-name.md)
150-
* [jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md)
151-
* [jsx-no-undef](docs/rules/jsx-no-undef.md)
152-
* [jsx-uses-react](docs/rules/jsx-uses-react.md)
153-
* [jsx-uses-vars](docs/rules/jsx-uses-vars.md)
154-
* [no-danger](docs/rules/no-danger.md)
155-
* [no-deprecated](docs/rules/no-deprecated.md)
156-
* [no-did-mount-set-state](docs/rules/no-did-mount-set-state.md) with `allow-in-func` option
157-
* [no-did-update-set-state](docs/rules/no-did-update-set-state.md) with `allow-in-func` option
158-
* [no-direct-mutation-state](docs/rules/no-direct-mutation-state.md)
159-
* [no-is-mounted](docs/rules/no-is-mounted.md)
160-
* [no-unknown-property](docs/rules/no-unknown-property.md)
161-
* [prop-types](docs/rules/prop-types.md)
162-
* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md)
154+
* [react/display-name](docs/rules/display-name.md)
155+
* [react/jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md)
156+
* [react/jsx-no-undef](docs/rules/jsx-no-undef.md)
157+
* [react/jsx-uses-react](docs/rules/jsx-uses-react.md)
158+
* [react/jsx-uses-vars](docs/rules/jsx-uses-vars.md)
159+
* [react/no-danger](docs/rules/no-danger.md)
160+
* [react/no-deprecated](docs/rules/no-deprecated.md)
161+
* [react/no-did-mount-set-state](docs/rules/no-did-mount-set-state.md) with `allow-in-func` option
162+
* [react/no-did-update-set-state](docs/rules/no-did-update-set-state.md) with `allow-in-func` option
163+
* [react/no-direct-mutation-state](docs/rules/no-direct-mutation-state.md)
164+
* [react/no-is-mounted](docs/rules/no-is-mounted.md)
165+
* [react/no-unknown-property](docs/rules/no-unknown-property.md)
166+
* [react/prop-types](docs/rules/prop-types.md)
167+
* [react/react-in-jsx-scope](docs/rules/react-in-jsx-scope.md)
163168

164169
**Note**: This configuration will also enable JSX in [parser options](http://eslint.org/docs/user-guide/configuring#specifying-parser-options).
165170

0 commit comments

Comments
 (0)