You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Docs] use markdown-magic to automatically sort all rules alphabetically
To make it easier to find rules.
This adds a script to auto-generate the list of rules and embeds special tags to README.
Usage:
$ npm run generate-list-of-rules
Check whether the auto-generated changes are committed:
$ npm run generate-list-of-rules:check
Use `markdown-magic` package to transform README
https://www.npmjs.com/package/markdown-magic
*[react/boolean-prop-naming](docs/rules/boolean-prop-naming.md): Enforces consistent naming for boolean props
101
102
*[react/button-has-type](docs/rules/button-has-type.md): Forbid "button" element without an explicit "type" attribute
102
-
*[react/default-props-match-prop-types](docs/rules/default-props-match-prop-types.md): Prevent extraneous defaultProps on components
103
-
*[react/destructuring-assignment](docs/rules/destructuring-assignment.md): Rule enforces consistent usage of destructuring assignment in component
104
-
*[react/display-name](docs/rules/display-name.md): Prevent missing `displayName` in a React component definition
105
-
*[react/forbid-component-props](docs/rules/forbid-component-props.md): Forbid certain props on Components
103
+
*[react/default-props-match-prop-types](docs/rules/default-props-match-prop-types.md): Enforce all defaultProps are defined and not "required" in propTypes.
104
+
*[react/destructuring-assignment](docs/rules/destructuring-assignment.md): Enforce consistent usage of destructuring assignment of props, state, and context
105
+
*[react/display-name](docs/rules/display-name.md): Prevent missing displayName in a React component definition
106
+
*[react/forbid-component-props](docs/rules/forbid-component-props.md): Forbid certain props on components
106
107
*[react/forbid-dom-props](docs/rules/forbid-dom-props.md): Forbid certain props on DOM Nodes
107
108
*[react/forbid-elements](docs/rules/forbid-elements.md): Forbid certain elements
109
+
*[react/forbid-foreign-prop-types](docs/rules/forbid-foreign-prop-types.md): Forbid using another component's propTypes
108
110
*[react/forbid-prop-types](docs/rules/forbid-prop-types.md): Forbid certain propTypes
*[react/no-access-state-in-setstate](docs/rules/no-access-state-in-setstate.md): Prevent using this.state inside this.setState
111
-
*[react/no-array-index-key](docs/rules/no-array-index-key.md): Prevent using Array index in `key` props
112
-
*[react/no-children-prop](docs/rules/no-children-prop.md): Prevent passing children as props
113
-
*[react/no-danger](docs/rules/no-danger.md): Prevent usage of dangerous JSX properties
114
-
*[react/no-danger-with-children](docs/rules/no-danger-with-children.md): Prevent problem with children and props.dangerouslySetInnerHTML
115
-
*[react/no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods, including component lifecycle methods
116
-
*[react/no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of `setState` in `componentDidMount`
117
-
*[react/no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of `setState` in `componentDidUpdate`
118
-
*[react/no-direct-mutation-state](docs/rules/no-direct-mutation-state.md): Prevent direct mutation of `this.state`
119
-
*[react/no-find-dom-node](docs/rules/no-find-dom-node.md): Prevent usage of `findDOMNode`
120
-
*[react/no-is-mounted](docs/rules/no-is-mounted.md): Prevent usage of `isMounted`
111
+
*[react/function-component-definition](docs/rules/function-component-definition.md): Standardize the way function component get defined (fixable)
112
+
*[react/no-access-state-in-setstate](docs/rules/no-access-state-in-setstate.md): Reports when this.state is accessed within setState
113
+
*[react/no-adjacent-inline-elements](docs/rules/no-adjacent-inline-elements.md): Prevent adjacent inline elements not separated by whitespace.
114
+
*[react/no-array-index-key](docs/rules/no-array-index-key.md): Prevent usage of Array index in keys
115
+
*[react/no-children-prop](docs/rules/no-children-prop.md): Prevent passing of children as props.
116
+
*[react/no-danger](docs/rules/no-danger.md): Prevent usage of dangerous JSX props
117
+
*[react/no-danger-with-children](docs/rules/no-danger-with-children.md): Report when a DOM element is using both children and dangerouslySetInnerHTML
118
+
*[react/no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods
119
+
*[react/no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of setState in componentDidMount
120
+
*[react/no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of setState in componentDidUpdate
121
+
*[react/no-direct-mutation-state](docs/rules/no-direct-mutation-state.md): Prevent direct mutation of this.state
122
+
*[react/no-find-dom-node](docs/rules/no-find-dom-node.md): Prevent usage of findDOMNode
123
+
*[react/no-is-mounted](docs/rules/no-is-mounted.md): Prevent usage of isMounted
121
124
*[react/no-multi-comp](docs/rules/no-multi-comp.md): Prevent multiple component definition per file
122
-
*[react/no-redundant-should-component-update](docs/rules/no-redundant-should-component-update.md): Prevent usage of `shouldComponentUpdate` when extending React.PureComponent
123
-
*[react/no-render-return-value](docs/rules/no-render-return-value.md): Prevent usage of the return value of `React.render`
124
-
*[react/no-set-state](docs/rules/no-set-state.md): Prevent usage of `setState`
125
-
*[react/no-typos](docs/rules/no-typos.md): Prevent common casing typos
126
-
*[react/no-string-refs](docs/rules/no-string-refs.md): Prevent using string references in `ref` attribute.
127
-
*[react/no-this-in-sfc](docs/rules/no-this-in-sfc.md): Prevent using `this` in stateless functional components
128
-
*[react/no-unescaped-entities](docs/rules/no-unescaped-entities.md): Prevent invalid characters from appearing in markup
125
+
*[react/no-redundant-should-component-update](docs/rules/no-redundant-should-component-update.md): Flag shouldComponentUpdate when extending PureComponent
126
+
*[react/no-render-return-value](docs/rules/no-render-return-value.md): Prevent usage of the return value of React.render
127
+
*[react/no-set-state](docs/rules/no-set-state.md): Prevent usage of setState
128
+
*[react/no-string-refs](docs/rules/no-string-refs.md): Prevent string definitions for references and prevent referencing this.refs
129
+
*[react/no-this-in-sfc](docs/rules/no-this-in-sfc.md): Report "this" being used in stateless components
130
+
*[react/no-typos](docs/rules/no-typos.md): Prevent common typos
131
+
*[react/no-unescaped-entities](docs/rules/no-unescaped-entities.md): Detect unescaped HTML entities, which might represent malformed tags
129
132
*[react/no-unknown-property](docs/rules/no-unknown-property.md): Prevent usage of unknown DOM property (fixable)
130
133
*[react/no-unsafe](docs/rules/no-unsafe.md): Prevent usage of unsafe lifecycle methods
131
134
*[react/no-unused-prop-types](docs/rules/no-unused-prop-types.md): Prevent definitions of unused prop types
132
-
*[react/no-unused-state](docs/rules/no-unused-state.md): Prevent definitions of unused state properties
133
-
*[react/no-will-update-set-state](docs/rules/no-will-update-set-state.md): Prevent usage of `setState` in `componentWillUpdate`
135
+
*[react/no-unused-state](docs/rules/no-unused-state.md): Prevent definition of unused state fields
136
+
*[react/no-will-update-set-state](docs/rules/no-will-update-set-state.md): Prevent usage of setState in componentWillUpdate
134
137
*[react/prefer-es6-class](docs/rules/prefer-es6-class.md): Enforce ES5 or ES6 class for React Components
135
-
*[react/prefer-read-only-props](docs/rules/prefer-read-only-props.md): Enforce that props are read-only
136
-
*[react/prefer-stateless-function](docs/rules/prefer-stateless-function.md): Enforce stateless React Components to be written as a pure function
*[react/state-in-constructor](docs/rules/state-in-constructor.md): Enforce the state initialization style to be either in a constructor or with a class property
146
-
*[react/static-property-placement](docs/rules/static-property-placement.md): Enforces where React component static properties should be positioned.
147
-
*[react/style-prop-object](docs/rules/style-prop-object.md): Enforce style prop value being an object
148
-
*[react/void-dom-elements-no-children](docs/rules/void-dom-elements-no-children.md): Prevent void DOM elements (e.g. `<img />`, `<br />`) from receiving children
148
+
*[react/state-in-constructor](docs/rules/state-in-constructor.md): State initialization in an ES6 class component should be in a constructor
149
+
*[react/static-property-placement](docs/rules/static-property-placement.md): Defines where React component static properties should be positioned.
150
+
*[react/style-prop-object](docs/rules/style-prop-object.md): Enforce style prop value is an object
151
+
*[react/void-dom-elements-no-children](docs/rules/void-dom-elements-no-children.md): Prevent passing of children to void DOM elements (e.g. `<br />`).
152
+
<!-- AUTO-GENERATED-CONTENT:END -->
149
153
150
154
## JSX-specific rules
151
155
156
+
<!-- AUTO-GENERATED-CONTENT:START (JSX_RULES) -->
152
157
*[react/jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX (fixable)
153
-
*[react/jsx-child-element-spacing](docs/rules/jsx-child-element-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes and expressions.
158
+
*[react/jsx-child-element-spacing](docs/rules/jsx-child-element-spacing.md): Ensures inline tags are not rendered without spaces between them
154
159
*[react/jsx-closing-bracket-location](docs/rules/jsx-closing-bracket-location.md): Validate closing bracket location in JSX (fixable)
155
-
*[react/jsx-closing-tag-location](docs/rules/jsx-closing-tag-location.md): Validate closing tag location in JSX (fixable)
156
-
*[react/jsx-curly-newline](docs/rules/jsx-curly-newline.md): Enforce or disallow newlines inside of curly braces in JSX attributes and expressions (fixable)
157
-
*[react/jsx-curly-spacing](docs/rules/jsx-curly-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes and expressions (fixable)
158
-
*[react/jsx-equals-spacing](docs/rules/jsx-equals-spacing.md): Enforce or disallow spaces around equal signs in JSX attributes (fixable)
160
+
*[react/jsx-closing-tag-location](docs/rules/jsx-closing-tag-location.md): Validate closing tag location for multiline JSX (fixable)
161
+
*[react/jsx-curly-brace-presence](docs/rules/jsx-curly-brace-presence.md): Disallow unnecessary JSX expressions when literals alone are sufficient or enfore JSX expressions on literals in JSX children or attributes (fixable)
162
+
*[react/jsx-curly-newline](docs/rules/jsx-curly-newline.md): enforce consistent line breaks inside jsx curly (fixable)
163
+
*[react/jsx-curly-spacing](docs/rules/jsx-curly-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes (fixable)
164
+
*[react/jsx-equals-spacing](docs/rules/jsx-equals-spacing.md): Disallow or enforce spaces around equal signs in JSX attributes (fixable)
159
165
*[react/jsx-filename-extension](docs/rules/jsx-filename-extension.md): Restrict file extensions that may contain JSX
160
-
*[react/jsx-first-prop-new-line](docs/rules/jsx-first-prop-new-line.md): Enforce position of the first prop in JSX (fixable)
166
+
*[react/jsx-first-prop-new-line](docs/rules/jsx-first-prop-new-line.md): Ensure proper position of the first property in JSX (fixable)
167
+
*[react/jsx-fragments](docs/rules/jsx-fragments.md): Enforce shorthand or standard form for React fragments (fixable)
161
168
*[react/jsx-handler-names](docs/rules/jsx-handler-names.md): Enforce event handler naming conventions in JSX
0 commit comments