diff --git a/README.md b/README.md index b1efbcd0de..884b86dc47 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,32 @@ Enable the rules that you would like to use. ✔: Enabled in the [`recommended`](#recommended) configuration.\ 🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems). - +## Possible Problems + + +| ✔ | 🔧 | Rule | Description | +| :---: | :---: | :--- | :--- | +| ✔ | | [react/jsx-key](docs/rules/jsx-key.md) | Report missing `key` props in iterators/collection literals | +| ✔ | | [react/jsx-no-comment-textnodes](docs/rules/jsx-no-comment-textnodes.md) | Comments inside children section of tag should be placed inside braces | +| ✔ | | [react/jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md) | Enforce no duplicate props | +| ✔ | | [react/jsx-no-undef](docs/rules/jsx-no-undef.md) | Disallow undeclared variables in JSX | +| | | [react/no-access-state-in-setstate](docs/rules/no-access-state-in-setstate.md) | Reports when this.state is accessed within setState | +| ✔ | | [react/no-danger-with-children](docs/rules/no-danger-with-children.md) | Report when a DOM element is using both children and dangerouslySetInnerHTML | +| ✔ | | [react/no-direct-mutation-state](docs/rules/no-direct-mutation-state.md) | Prevent direct mutation of this.state | +| | 🔧 | [react/no-invalid-html-attribute](docs/rules/no-invalid-html-attribute.md) | Forbid attribute with an invalid values` | +| | | [react/no-namespace](docs/rules/no-namespace.md) | Enforce that namespaces are not used in React elements | +| | | [react/no-redundant-should-component-update](docs/rules/no-redundant-should-component-update.md) | Flag shouldComponentUpdate when extending PureComponent | +| | | [react/no-this-in-sfc](docs/rules/no-this-in-sfc.md) | Report "this" being used in stateless components | +| ✔ | | [react/no-unescaped-entities](docs/rules/no-unescaped-entities.md) | Detect unescaped HTML entities, which might represent malformed tags | +| ✔ | 🔧 | [react/no-unknown-property](docs/rules/no-unknown-property.md) | Prevent usage of unknown DOM property | +| ✔ | | [react/react-in-jsx-scope](docs/rules/react-in-jsx-scope.md) | Prevent missing React when using JSX | +| ✔ | | [react/require-render-return](docs/rules/require-render-return.md) | Enforce ES5 or ES6 class for returning value in render function | +| | | [react/style-prop-object](docs/rules/style-prop-object.md) | Enforce style prop value is an object | + + +## Suggestions + + | ✔ | 🔧 | Rule | Description | | :---: | :---: | :--- | :--- | | | | [react/boolean-prop-naming](docs/rules/boolean-prop-naming.md) | Enforces consistent naming for boolean props | @@ -133,30 +158,35 @@ Enable the rules that you would like to use. | | 🔧 | [react/function-component-definition](docs/rules/function-component-definition.md) | Standardize the way function component get defined | | | | [react/hook-use-state](docs/rules/hook-use-state.md) | Ensure symmetric naming of useState hook value and setter variables | | | | [react/iframe-missing-sandbox](docs/rules/iframe-missing-sandbox.md) | Enforce sandbox attribute on iframe elements | -| | | [react/no-access-state-in-setstate](docs/rules/no-access-state-in-setstate.md) | Reports when this.state is accessed within setState | +| | 🔧 | [react/jsx-boolean-value](docs/rules/jsx-boolean-value.md) | Enforce boolean attributes notation in JSX | +| | | [react/jsx-filename-extension](docs/rules/jsx-filename-extension.md) | Restrict file extensions that may contain JSX | +| | 🔧 | [react/jsx-fragments](docs/rules/jsx-fragments.md) | Enforce shorthand or standard form for React fragments | +| | | [react/jsx-handler-names](docs/rules/jsx-handler-names.md) | Enforce event handler naming conventions in JSX | +| | | [react/jsx-max-depth](docs/rules/jsx-max-depth.md) | Validate JSX maximum depth | +| | | [react/jsx-no-bind](docs/rules/jsx-no-bind.md) | Prevents usage of Function.prototype.bind and arrow functions in React component props | +| | | [react/jsx-no-constructed-context-values](docs/rules/jsx-no-constructed-context-values.md) | Prevents JSX context provider values from taking values that will cause needless rerenders. | +| | | [react/jsx-no-script-url](docs/rules/jsx-no-script-url.md) | Forbid `javascript:` URLs | +| ✔ | 🔧 | [react/jsx-no-target-blank](docs/rules/jsx-no-target-blank.md) | Forbid `target="_blank"` attribute without `rel="noreferrer"` | +| | 🔧 | [react/jsx-no-useless-fragment](docs/rules/jsx-no-useless-fragment.md) | Disallow unnecessary fragments | +| | | [react/jsx-pascal-case](docs/rules/jsx-pascal-case.md) | Enforce PascalCase for user-defined JSX components | +| | | [react/jsx-props-no-spreading](docs/rules/jsx-props-no-spreading.md) | Prevent JSX prop spreading | +| ✔ | | [react/jsx-uses-react](docs/rules/jsx-uses-react.md) | Prevent React to be marked as unused | +| ✔ | | [react/jsx-uses-vars](docs/rules/jsx-uses-vars.md) | Prevent variables used in JSX to be marked as unused | | | | [react/no-adjacent-inline-elements](docs/rules/no-adjacent-inline-elements.md) | Prevent adjacent inline elements not separated by whitespace. | | | | [react/no-array-index-key](docs/rules/no-array-index-key.md) | Prevent usage of Array index in keys | | | 🔧 | [react/no-arrow-function-lifecycle](docs/rules/no-arrow-function-lifecycle.md) | Lifecycle methods should be methods on the prototype, not class fields | | ✔ | | [react/no-children-prop](docs/rules/no-children-prop.md) | Prevent passing of children as props. | | | | [react/no-danger](docs/rules/no-danger.md) | Prevent usage of dangerous JSX props | -| ✔ | | [react/no-danger-with-children](docs/rules/no-danger-with-children.md) | Report when a DOM element is using both children and dangerouslySetInnerHTML | | ✔ | | [react/no-deprecated](docs/rules/no-deprecated.md) | Prevent usage of deprecated methods | | | | [react/no-did-mount-set-state](docs/rules/no-did-mount-set-state.md) | Prevent usage of setState in componentDidMount | | | | [react/no-did-update-set-state](docs/rules/no-did-update-set-state.md) | Prevent usage of setState in componentDidUpdate | -| ✔ | | [react/no-direct-mutation-state](docs/rules/no-direct-mutation-state.md) | Prevent direct mutation of this.state | | ✔ | | [react/no-find-dom-node](docs/rules/no-find-dom-node.md) | Prevent usage of findDOMNode | -| | 🔧 | [react/no-invalid-html-attribute](docs/rules/no-invalid-html-attribute.md) | Forbid attribute with an invalid values` | | ✔ | | [react/no-is-mounted](docs/rules/no-is-mounted.md) | Prevent usage of isMounted | | | | [react/no-multi-comp](docs/rules/no-multi-comp.md) | Prevent multiple component definition per file | -| | | [react/no-namespace](docs/rules/no-namespace.md) | Enforce that namespaces are not used in React elements | -| | | [react/no-redundant-should-component-update](docs/rules/no-redundant-should-component-update.md) | Flag shouldComponentUpdate when extending PureComponent | | ✔ | | [react/no-render-return-value](docs/rules/no-render-return-value.md) | Prevent usage of the return value of React.render | | | | [react/no-set-state](docs/rules/no-set-state.md) | Prevent usage of setState | | ✔ | | [react/no-string-refs](docs/rules/no-string-refs.md) | Prevent string definitions for references and prevent referencing this.refs | -| | | [react/no-this-in-sfc](docs/rules/no-this-in-sfc.md) | Report "this" being used in stateless components | | | | [react/no-typos](docs/rules/no-typos.md) | Prevent common typos | -| ✔ | | [react/no-unescaped-entities](docs/rules/no-unescaped-entities.md) | Detect unescaped HTML entities, which might represent malformed tags | -| ✔ | 🔧 | [react/no-unknown-property](docs/rules/no-unknown-property.md) | Prevent usage of unknown DOM property | | | | [react/no-unsafe](docs/rules/no-unsafe.md) | Prevent usage of unsafe lifecycle methods | | | | [react/no-unstable-nested-components](docs/rules/no-unstable-nested-components.md) | Prevent creating unstable components inside components | | | | [react/no-unused-class-component-methods](docs/rules/no-unused-class-component-methods.md) | Prevent declaring unused methods of component class | @@ -168,25 +198,17 @@ Enable the rules that you would like to use. | | 🔧 | [react/prefer-read-only-props](docs/rules/prefer-read-only-props.md) | Require read-only props. | | | | [react/prefer-stateless-function](docs/rules/prefer-stateless-function.md) | Enforce stateless components to be written as a pure function | | ✔ | | [react/prop-types](docs/rules/prop-types.md) | Prevent missing props validation in a React component definition | -| ✔ | | [react/react-in-jsx-scope](docs/rules/react-in-jsx-scope.md) | Prevent missing React when using JSX | | | | [react/require-default-props](docs/rules/require-default-props.md) | Enforce a defaultProps definition for every prop that is not a required prop. | | | | [react/require-optimization](docs/rules/require-optimization.md) | Enforce React components to have a shouldComponentUpdate method | -| ✔ | | [react/require-render-return](docs/rules/require-render-return.md) | Enforce ES5 or ES6 class for returning value in render function | -| | 🔧 | [react/self-closing-comp](docs/rules/self-closing-comp.md) | Prevent extra closing tags for components without children | -| | | [react/sort-comp](docs/rules/sort-comp.md) | Enforce component methods order | -| | | [react/sort-prop-types](docs/rules/sort-prop-types.md) | Enforce propTypes declarations alphabetical sorting | | | | [react/state-in-constructor](docs/rules/state-in-constructor.md) | State initialization in an ES6 class component should be in a constructor | -| | | [react/static-property-placement](docs/rules/static-property-placement.md) | Defines where React component static properties should be positioned. | -| | | [react/style-prop-object](docs/rules/style-prop-object.md) | Enforce style prop value is an object | | | | [react/void-dom-elements-no-children](docs/rules/void-dom-elements-no-children.md) | Prevent passing of children to void DOM elements (e.g. `
`). | -## JSX-specific rules +## Layout & Formatting - + | ✔ | 🔧 | Rule | Description | | :---: | :---: | :--- | :--- | -| | 🔧 | [react/jsx-boolean-value](docs/rules/jsx-boolean-value.md) | Enforce boolean attributes notation in JSX | | | | [react/jsx-child-element-spacing](docs/rules/jsx-child-element-spacing.md) | Ensures inline tags are not rendered without spaces between them | | | 🔧 | [react/jsx-closing-bracket-location](docs/rules/jsx-closing-bracket-location.md) | Validate closing bracket location in JSX | | | 🔧 | [react/jsx-closing-tag-location](docs/rules/jsx-closing-tag-location.md) | Validate closing tag location for multiline JSX | @@ -194,36 +216,23 @@ Enable the rules that you would like to use. | | 🔧 | [react/jsx-curly-newline](docs/rules/jsx-curly-newline.md) | Enforce consistent line breaks inside jsx curly | | | 🔧 | [react/jsx-curly-spacing](docs/rules/jsx-curly-spacing.md) | Enforce or disallow spaces inside of curly braces in JSX attributes | | | 🔧 | [react/jsx-equals-spacing](docs/rules/jsx-equals-spacing.md) | Disallow or enforce spaces around equal signs in JSX attributes | -| | | [react/jsx-filename-extension](docs/rules/jsx-filename-extension.md) | Restrict file extensions that may contain JSX | | | 🔧 | [react/jsx-first-prop-new-line](docs/rules/jsx-first-prop-new-line.md) | Ensure proper position of the first property in JSX | -| | 🔧 | [react/jsx-fragments](docs/rules/jsx-fragments.md) | Enforce shorthand or standard form for React fragments | -| | | [react/jsx-handler-names](docs/rules/jsx-handler-names.md) | Enforce event handler naming conventions in JSX | | | 🔧 | [react/jsx-indent](docs/rules/jsx-indent.md) | Validate JSX indentation | | | 🔧 | [react/jsx-indent-props](docs/rules/jsx-indent-props.md) | Validate props indentation in JSX | -| ✔ | | [react/jsx-key](docs/rules/jsx-key.md) | Report missing `key` props in iterators/collection literals | -| | | [react/jsx-max-depth](docs/rules/jsx-max-depth.md) | Validate JSX maximum depth | | | 🔧 | [react/jsx-max-props-per-line](docs/rules/jsx-max-props-per-line.md) | Limit maximum of props on a single line in JSX | | | 🔧 | [react/jsx-newline](docs/rules/jsx-newline.md) | Require or prevent a new line after jsx elements and expressions. | -| | | [react/jsx-no-bind](docs/rules/jsx-no-bind.md) | Prevents usage of Function.prototype.bind and arrow functions in React component props | -| ✔ | | [react/jsx-no-comment-textnodes](docs/rules/jsx-no-comment-textnodes.md) | Comments inside children section of tag should be placed inside braces | -| | | [react/jsx-no-constructed-context-values](docs/rules/jsx-no-constructed-context-values.md) | Prevents JSX context provider values from taking values that will cause needless rerenders. | -| ✔ | | [react/jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md) | Enforce no duplicate props | | | | [react/jsx-no-literals](docs/rules/jsx-no-literals.md) | Prevent using string literals in React component definition | -| | | [react/jsx-no-script-url](docs/rules/jsx-no-script-url.md) | Forbid `javascript:` URLs | -| ✔ | 🔧 | [react/jsx-no-target-blank](docs/rules/jsx-no-target-blank.md) | Forbid `target="_blank"` attribute without `rel="noreferrer"` | -| ✔ | | [react/jsx-no-undef](docs/rules/jsx-no-undef.md) | Disallow undeclared variables in JSX | -| | 🔧 | [react/jsx-no-useless-fragment](docs/rules/jsx-no-useless-fragment.md) | Disallow unnecessary fragments | | | 🔧 | [react/jsx-one-expression-per-line](docs/rules/jsx-one-expression-per-line.md) | Limit to one expression per line in JSX | -| | | [react/jsx-pascal-case](docs/rules/jsx-pascal-case.md) | Enforce PascalCase for user-defined JSX components | | | 🔧 | [react/jsx-props-no-multi-spaces](docs/rules/jsx-props-no-multi-spaces.md) | Disallow multiple spaces between inline JSX props | -| | | [react/jsx-props-no-spreading](docs/rules/jsx-props-no-spreading.md) | Prevent JSX prop spreading | | | | [react/jsx-sort-default-props](docs/rules/jsx-sort-default-props.md) | Enforce default props alphabetical sorting | | | 🔧 | [react/jsx-sort-props](docs/rules/jsx-sort-props.md) | Enforce props alphabetical sorting | | | 🔧 | [react/jsx-space-before-closing](docs/rules/jsx-space-before-closing.md) | Validate spacing before closing bracket in JSX | | | 🔧 | [react/jsx-tag-spacing](docs/rules/jsx-tag-spacing.md) | Validate whitespace in and around the JSX opening and closing brackets | -| ✔ | | [react/jsx-uses-react](docs/rules/jsx-uses-react.md) | Prevent React to be marked as unused | -| ✔ | | [react/jsx-uses-vars](docs/rules/jsx-uses-vars.md) | Prevent variables used in JSX to be marked as unused | | | 🔧 | [react/jsx-wrap-multilines](docs/rules/jsx-wrap-multilines.md) | Prevent missing parentheses around multilines JSX | +| | 🔧 | [react/self-closing-comp](docs/rules/self-closing-comp.md) | Prevent extra closing tags for components without children | +| | | [react/sort-comp](docs/rules/sort-comp.md) | Enforce component methods order | +| | | [react/sort-prop-types](docs/rules/sort-prop-types.md) | Enforce propTypes declarations alphabetical sorting | +| | | [react/static-property-placement](docs/rules/static-property-placement.md) | Defines where React component static properties should be positioned. | ## Other useful plugins diff --git a/lib/rules/boolean-prop-naming.js b/lib/rules/boolean-prop-naming.js index 5e0a420b7a..9cc8f79ff5 100644 --- a/lib/rules/boolean-prop-naming.js +++ b/lib/rules/boolean-prop-naming.js @@ -22,7 +22,7 @@ const messages = { module.exports = { meta: { docs: { - category: 'Stylistic Issues', + category: 'suggestion', description: 'Enforces consistent naming for boolean props', recommended: false, url: docsUrl('boolean-prop-naming'), diff --git a/lib/rules/button-has-type.js b/lib/rules/button-has-type.js index add42d69ca..e0eb446284 100644 --- a/lib/rules/button-has-type.js +++ b/lib/rules/button-has-type.js @@ -32,7 +32,7 @@ module.exports = { meta: { docs: { description: 'Forbid "button" element without an explicit "type" attribute', - category: 'Possible Errors', + category: 'suggestion', recommended: false, url: docsUrl('button-has-type'), }, diff --git a/lib/rules/default-props-match-prop-types.js b/lib/rules/default-props-match-prop-types.js index 81b5ebb392..8164ba7a2c 100644 --- a/lib/rules/default-props-match-prop-types.js +++ b/lib/rules/default-props-match-prop-types.js @@ -23,7 +23,7 @@ module.exports = { meta: { docs: { description: 'Enforce all defaultProps are defined and not "required" in propTypes.', - category: 'Best Practices', + category: 'suggestion', url: docsUrl('default-props-match-prop-types'), }, diff --git a/lib/rules/destructuring-assignment.js b/lib/rules/destructuring-assignment.js index 8850df0d3d..9c60c59c67 100644 --- a/lib/rules/destructuring-assignment.js +++ b/lib/rules/destructuring-assignment.js @@ -56,7 +56,7 @@ module.exports = { meta: { docs: { description: 'Enforce consistent usage of destructuring assignment of props, state, and context', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('destructuring-assignment'), }, diff --git a/lib/rules/display-name.js b/lib/rules/display-name.js index 528b8f2d80..c563cfe27b 100644 --- a/lib/rules/display-name.js +++ b/lib/rules/display-name.js @@ -25,7 +25,7 @@ module.exports = { meta: { docs: { description: 'Prevent missing displayName in a React component definition', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('display-name'), }, diff --git a/lib/rules/forbid-component-props.js b/lib/rules/forbid-component-props.js index 5b09323a9d..79f343a5ef 100644 --- a/lib/rules/forbid-component-props.js +++ b/lib/rules/forbid-component-props.js @@ -26,7 +26,7 @@ module.exports = { meta: { docs: { description: 'Forbid certain props on components', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('forbid-component-props'), }, diff --git a/lib/rules/forbid-dom-props.js b/lib/rules/forbid-dom-props.js index 45beef4083..ef0b591010 100644 --- a/lib/rules/forbid-dom-props.js +++ b/lib/rules/forbid-dom-props.js @@ -26,7 +26,7 @@ module.exports = { meta: { docs: { description: 'Forbid certain props on DOM Nodes', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('forbid-dom-props'), }, diff --git a/lib/rules/forbid-elements.js b/lib/rules/forbid-elements.js index a88ccea8fb..09555cc979 100644 --- a/lib/rules/forbid-elements.js +++ b/lib/rules/forbid-elements.js @@ -23,7 +23,7 @@ module.exports = { meta: { docs: { description: 'Forbid certain elements', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('forbid-elements'), }, diff --git a/lib/rules/forbid-foreign-prop-types.js b/lib/rules/forbid-foreign-prop-types.js index 2346e107f6..3148ff8f58 100644 --- a/lib/rules/forbid-foreign-prop-types.js +++ b/lib/rules/forbid-foreign-prop-types.js @@ -17,7 +17,7 @@ module.exports = { meta: { docs: { description: 'Forbid using another component\'s propTypes', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('forbid-foreign-prop-types'), }, diff --git a/lib/rules/forbid-prop-types.js b/lib/rules/forbid-prop-types.js index 0eea6a78d2..25c76e7c5b 100644 --- a/lib/rules/forbid-prop-types.js +++ b/lib/rules/forbid-prop-types.js @@ -29,7 +29,7 @@ module.exports = { meta: { docs: { description: 'Forbid certain propTypes', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('forbid-prop-types'), }, diff --git a/lib/rules/function-component-definition.js b/lib/rules/function-component-definition.js index 8f20e63366..50e1eec444 100644 --- a/lib/rules/function-component-definition.js +++ b/lib/rules/function-component-definition.js @@ -102,7 +102,7 @@ module.exports = { meta: { docs: { description: 'Standardize the way function component get defined', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('function-component-definition'), }, diff --git a/lib/rules/hook-use-state.js b/lib/rules/hook-use-state.js index 6bfb604ae8..c479091299 100644 --- a/lib/rules/hook-use-state.js +++ b/lib/rules/hook-use-state.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Ensure symmetric naming of useState hook value and setter variables', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('hook-use-state'), }, diff --git a/lib/rules/iframe-missing-sandbox.js b/lib/rules/iframe-missing-sandbox.js index 9a8bd4774d..b743d66551 100644 --- a/lib/rules/iframe-missing-sandbox.js +++ b/lib/rules/iframe-missing-sandbox.js @@ -113,7 +113,7 @@ module.exports = { meta: { docs: { description: 'Enforce sandbox attribute on iframe elements', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('iframe-missing-sandbox'), }, diff --git a/lib/rules/jsx-boolean-value.js b/lib/rules/jsx-boolean-value.js index d68b1ebdf6..4ec59ac180 100644 --- a/lib/rules/jsx-boolean-value.js +++ b/lib/rules/jsx-boolean-value.js @@ -58,7 +58,7 @@ module.exports = { meta: { docs: { description: 'Enforce boolean attributes notation in JSX', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('jsx-boolean-value'), }, diff --git a/lib/rules/jsx-child-element-spacing.js b/lib/rules/jsx-child-element-spacing.js index 2f8b41a574..20812fabbb 100644 --- a/lib/rules/jsx-child-element-spacing.js +++ b/lib/rules/jsx-child-element-spacing.js @@ -48,7 +48,7 @@ module.exports = { meta: { docs: { description: 'Ensures inline tags are not rendered without spaces between them', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-child-element-spacing'), }, diff --git a/lib/rules/jsx-closing-bracket-location.js b/lib/rules/jsx-closing-bracket-location.js index 324d0e7642..2b89a8a5d4 100644 --- a/lib/rules/jsx-closing-bracket-location.js +++ b/lib/rules/jsx-closing-bracket-location.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Validate closing bracket location in JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-closing-bracket-location'), }, diff --git a/lib/rules/jsx-closing-tag-location.js b/lib/rules/jsx-closing-tag-location.js index 6299994186..80245dd3bd 100644 --- a/lib/rules/jsx-closing-tag-location.js +++ b/lib/rules/jsx-closing-tag-location.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Validate closing tag location for multiline JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-closing-tag-location'), }, diff --git a/lib/rules/jsx-curly-brace-presence.js b/lib/rules/jsx-curly-brace-presence.js index b5a0e99537..8ff3872bc0 100755 --- a/lib/rules/jsx-curly-brace-presence.js +++ b/lib/rules/jsx-curly-brace-presence.js @@ -40,7 +40,7 @@ module.exports = { meta: { docs: { description: 'Disallow unnecessary JSX expressions when literals alone are sufficient or enfore JSX expressions on literals in JSX children or attributes', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-curly-brace-presence'), }, diff --git a/lib/rules/jsx-curly-newline.js b/lib/rules/jsx-curly-newline.js index f9c7c4a961..80cd24992e 100644 --- a/lib/rules/jsx-curly-newline.js +++ b/lib/rules/jsx-curly-newline.js @@ -47,7 +47,7 @@ module.exports = { docs: { description: 'Enforce consistent line breaks inside jsx curly', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-curly-newline'), }, diff --git a/lib/rules/jsx-curly-spacing.js b/lib/rules/jsx-curly-spacing.js index db6a80cbcc..71ffe70d8e 100644 --- a/lib/rules/jsx-curly-spacing.js +++ b/lib/rules/jsx-curly-spacing.js @@ -38,7 +38,7 @@ module.exports = { meta: { docs: { description: 'Enforce or disallow spaces inside of curly braces in JSX attributes', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-curly-spacing'), }, diff --git a/lib/rules/jsx-equals-spacing.js b/lib/rules/jsx-equals-spacing.js index 41d123152e..a58f0afbe9 100644 --- a/lib/rules/jsx-equals-spacing.js +++ b/lib/rules/jsx-equals-spacing.js @@ -23,7 +23,7 @@ module.exports = { meta: { docs: { description: 'Disallow or enforce spaces around equal signs in JSX attributes', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-equals-spacing'), }, diff --git a/lib/rules/jsx-filename-extension.js b/lib/rules/jsx-filename-extension.js index fee466f152..5ae03a2aec 100644 --- a/lib/rules/jsx-filename-extension.js +++ b/lib/rules/jsx-filename-extension.js @@ -31,7 +31,7 @@ module.exports = { meta: { docs: { description: 'Restrict file extensions that may contain JSX', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('jsx-filename-extension'), }, diff --git a/lib/rules/jsx-first-prop-new-line.js b/lib/rules/jsx-first-prop-new-line.js index 7d944fc0b7..f2ace7de2d 100644 --- a/lib/rules/jsx-first-prop-new-line.js +++ b/lib/rules/jsx-first-prop-new-line.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Ensure proper position of the first property in JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-first-prop-new-line'), }, diff --git a/lib/rules/jsx-fragments.js b/lib/rules/jsx-fragments.js index 38b4dd8b4b..9123530ba1 100644 --- a/lib/rules/jsx-fragments.js +++ b/lib/rules/jsx-fragments.js @@ -31,7 +31,7 @@ module.exports = { meta: { docs: { description: 'Enforce shorthand or standard form for React fragments', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('jsx-fragments'), }, diff --git a/lib/rules/jsx-handler-names.js b/lib/rules/jsx-handler-names.js index e82db76474..b213580e44 100644 --- a/lib/rules/jsx-handler-names.js +++ b/lib/rules/jsx-handler-names.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Enforce event handler naming conventions in JSX', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('jsx-handler-names'), }, diff --git a/lib/rules/jsx-indent-props.js b/lib/rules/jsx-indent-props.js index 5d33ded173..942d4dca7e 100644 --- a/lib/rules/jsx-indent-props.js +++ b/lib/rules/jsx-indent-props.js @@ -46,7 +46,7 @@ module.exports = { meta: { docs: { description: 'Validate props indentation in JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-indent-props'), }, diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index 88d177d30e..463544d813 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -50,7 +50,7 @@ module.exports = { meta: { docs: { description: 'Validate JSX indentation', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-indent'), }, diff --git a/lib/rules/jsx-key.js b/lib/rules/jsx-key.js index 65f9e37ea0..587fad4906 100644 --- a/lib/rules/jsx-key.js +++ b/lib/rules/jsx-key.js @@ -35,7 +35,7 @@ module.exports = { meta: { docs: { description: 'Report missing `key` props in iterators/collection literals', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('jsx-key'), }, diff --git a/lib/rules/jsx-max-depth.js b/lib/rules/jsx-max-depth.js index b4554c28d3..be9a0cfb48 100644 --- a/lib/rules/jsx-max-depth.js +++ b/lib/rules/jsx-max-depth.js @@ -24,7 +24,7 @@ module.exports = { meta: { docs: { description: 'Validate JSX maximum depth', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('jsx-max-depth'), }, diff --git a/lib/rules/jsx-max-props-per-line.js b/lib/rules/jsx-max-props-per-line.js index 9ae1f6f00d..76211052b5 100644 --- a/lib/rules/jsx-max-props-per-line.js +++ b/lib/rules/jsx-max-props-per-line.js @@ -27,7 +27,7 @@ module.exports = { meta: { docs: { description: 'Limit maximum of props on a single line in JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-max-props-per-line'), }, diff --git a/lib/rules/jsx-newline.js b/lib/rules/jsx-newline.js index e3de9daef3..e21773e8ce 100644 --- a/lib/rules/jsx-newline.js +++ b/lib/rules/jsx-newline.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Require or prevent a new line after jsx elements and expressions.', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-newline'), }, diff --git a/lib/rules/jsx-no-bind.js b/lib/rules/jsx-no-bind.js index 709fc98548..0cc73b8b5c 100644 --- a/lib/rules/jsx-no-bind.js +++ b/lib/rules/jsx-no-bind.js @@ -28,7 +28,7 @@ module.exports = { meta: { docs: { description: 'Prevents usage of Function.prototype.bind and arrow functions in React component props', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('jsx-no-bind'), }, diff --git a/lib/rules/jsx-no-comment-textnodes.js b/lib/rules/jsx-no-comment-textnodes.js index fbc6d151e6..b3b81a3521 100644 --- a/lib/rules/jsx-no-comment-textnodes.js +++ b/lib/rules/jsx-no-comment-textnodes.js @@ -37,7 +37,7 @@ module.exports = { meta: { docs: { description: 'Comments inside children section of tag should be placed inside braces', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('jsx-no-comment-textnodes'), }, diff --git a/lib/rules/jsx-no-constructed-context-values.js b/lib/rules/jsx-no-constructed-context-values.js index da0409791a..bdcea2e619 100644 --- a/lib/rules/jsx-no-constructed-context-values.js +++ b/lib/rules/jsx-no-constructed-context-values.js @@ -132,7 +132,7 @@ module.exports = { meta: { docs: { description: 'Prevents JSX context provider values from taking values that will cause needless rerenders.', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('jsx-no-constructed-context-values'), }, diff --git a/lib/rules/jsx-no-duplicate-props.js b/lib/rules/jsx-no-duplicate-props.js index 109a8c736c..494a29148b 100644 --- a/lib/rules/jsx-no-duplicate-props.js +++ b/lib/rules/jsx-no-duplicate-props.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Enforce no duplicate props', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('jsx-no-duplicate-props'), }, diff --git a/lib/rules/jsx-no-literals.js b/lib/rules/jsx-no-literals.js index 7ad1ff62e1..b2aa496f07 100644 --- a/lib/rules/jsx-no-literals.js +++ b/lib/rules/jsx-no-literals.js @@ -28,7 +28,7 @@ module.exports = { meta: { docs: { description: 'Prevent using string literals in React component definition', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-no-literals'), }, diff --git a/lib/rules/jsx-no-script-url.js b/lib/rules/jsx-no-script-url.js index 4dfd642dad..9e4df6bdb0 100644 --- a/lib/rules/jsx-no-script-url.js +++ b/lib/rules/jsx-no-script-url.js @@ -51,7 +51,7 @@ module.exports = { meta: { docs: { description: 'Forbid `javascript:` URLs', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('jsx-no-script-url'), }, diff --git a/lib/rules/jsx-no-target-blank.js b/lib/rules/jsx-no-target-blank.js index 1f6edc9e07..1bdfe98e8e 100644 --- a/lib/rules/jsx-no-target-blank.js +++ b/lib/rules/jsx-no-target-blank.js @@ -106,7 +106,7 @@ module.exports = { fixable: 'code', docs: { description: 'Forbid `target="_blank"` attribute without `rel="noreferrer"`', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('jsx-no-target-blank'), }, diff --git a/lib/rules/jsx-no-undef.js b/lib/rules/jsx-no-undef.js index d7a42ccff2..49411733d4 100644 --- a/lib/rules/jsx-no-undef.js +++ b/lib/rules/jsx-no-undef.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Disallow undeclared variables in JSX', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('jsx-no-undef'), }, diff --git a/lib/rules/jsx-no-useless-fragment.js b/lib/rules/jsx-no-useless-fragment.js index ac197e9da9..cdacf0e396 100644 --- a/lib/rules/jsx-no-useless-fragment.js +++ b/lib/rules/jsx-no-useless-fragment.js @@ -89,7 +89,7 @@ module.exports = { fixable: 'code', docs: { description: 'Disallow unnecessary fragments', - category: 'Possible Errors', + category: 'suggestion', recommended: false, url: docsUrl('jsx-no-useless-fragment'), }, diff --git a/lib/rules/jsx-one-expression-per-line.js b/lib/rules/jsx-one-expression-per-line.js index 3ef929394c..49d8e8c61d 100644 --- a/lib/rules/jsx-one-expression-per-line.js +++ b/lib/rules/jsx-one-expression-per-line.js @@ -25,7 +25,7 @@ module.exports = { meta: { docs: { description: 'Limit to one expression per line in JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-one-expression-per-line'), }, diff --git a/lib/rules/jsx-pascal-case.js b/lib/rules/jsx-pascal-case.js index 901294fa52..ff6fdad64d 100644 --- a/lib/rules/jsx-pascal-case.js +++ b/lib/rules/jsx-pascal-case.js @@ -80,7 +80,7 @@ module.exports = { meta: { docs: { description: 'Enforce PascalCase for user-defined JSX components', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('jsx-pascal-case'), }, diff --git a/lib/rules/jsx-props-no-multi-spaces.js b/lib/rules/jsx-props-no-multi-spaces.js index b0d34d59dd..83cdf16cdc 100644 --- a/lib/rules/jsx-props-no-multi-spaces.js +++ b/lib/rules/jsx-props-no-multi-spaces.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Disallow multiple spaces between inline JSX props', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-props-no-multi-spaces'), }, diff --git a/lib/rules/jsx-props-no-spreading.js b/lib/rules/jsx-props-no-spreading.js index 99f7cc5bfa..bcac7164fb 100644 --- a/lib/rules/jsx-props-no-spreading.js +++ b/lib/rules/jsx-props-no-spreading.js @@ -42,7 +42,7 @@ module.exports = { meta: { docs: { description: 'Prevent JSX prop spreading', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('jsx-props-no-spreading'), }, diff --git a/lib/rules/jsx-sort-default-props.js b/lib/rules/jsx-sort-default-props.js index d291066d45..8f6f1e4b26 100644 --- a/lib/rules/jsx-sort-default-props.js +++ b/lib/rules/jsx-sort-default-props.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Enforce default props alphabetical sorting', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-sort-default-props'), }, diff --git a/lib/rules/jsx-sort-props.js b/lib/rules/jsx-sort-props.js index 8daf981908..b1ba7f7635 100644 --- a/lib/rules/jsx-sort-props.js +++ b/lib/rules/jsx-sort-props.js @@ -273,7 +273,7 @@ module.exports = { meta: { docs: { description: 'Enforce props alphabetical sorting', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-sort-props'), }, diff --git a/lib/rules/jsx-space-before-closing.js b/lib/rules/jsx-space-before-closing.js index c053d84393..eae6ad024d 100644 --- a/lib/rules/jsx-space-before-closing.js +++ b/lib/rules/jsx-space-before-closing.js @@ -27,7 +27,7 @@ module.exports = { deprecated: true, docs: { description: 'Validate spacing before closing bracket in JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-space-before-closing'), }, diff --git a/lib/rules/jsx-tag-spacing.js b/lib/rules/jsx-tag-spacing.js index 546dd082cf..fc2ceba6ad 100644 --- a/lib/rules/jsx-tag-spacing.js +++ b/lib/rules/jsx-tag-spacing.js @@ -217,7 +217,7 @@ module.exports = { meta: { docs: { description: 'Validate whitespace in and around the JSX opening and closing brackets', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-tag-spacing'), }, diff --git a/lib/rules/jsx-uses-react.js b/lib/rules/jsx-uses-react.js index a433d795f3..23e953ec36 100644 --- a/lib/rules/jsx-uses-react.js +++ b/lib/rules/jsx-uses-react.js @@ -16,7 +16,7 @@ module.exports = { meta: { docs: { description: 'Prevent React to be marked as unused', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('jsx-uses-react'), }, diff --git a/lib/rules/jsx-uses-vars.js b/lib/rules/jsx-uses-vars.js index 28d1cb2d60..733fb809ab 100644 --- a/lib/rules/jsx-uses-vars.js +++ b/lib/rules/jsx-uses-vars.js @@ -18,7 +18,7 @@ module.exports = { meta: { docs: { description: 'Prevent variables used in JSX to be marked as unused', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('jsx-uses-vars'), }, diff --git a/lib/rules/jsx-wrap-multilines.js b/lib/rules/jsx-wrap-multilines.js index 94600efa61..28b930b8f6 100644 --- a/lib/rules/jsx-wrap-multilines.js +++ b/lib/rules/jsx-wrap-multilines.js @@ -37,7 +37,7 @@ module.exports = { meta: { docs: { description: 'Prevent missing parentheses around multilines JSX', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('jsx-wrap-multilines'), }, diff --git a/lib/rules/no-access-state-in-setstate.js b/lib/rules/no-access-state-in-setstate.js index e3e76a2323..ff494033f5 100644 --- a/lib/rules/no-access-state-in-setstate.js +++ b/lib/rules/no-access-state-in-setstate.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Reports when this.state is accessed within setState', - category: 'Possible Errors', + category: 'problem', recommended: false, url: docsUrl('no-access-state-in-setstate'), }, diff --git a/lib/rules/no-adjacent-inline-elements.js b/lib/rules/no-adjacent-inline-elements.js index 7c622f2eb2..268eac2212 100644 --- a/lib/rules/no-adjacent-inline-elements.js +++ b/lib/rules/no-adjacent-inline-elements.js @@ -80,7 +80,7 @@ module.exports = { meta: { docs: { description: 'Prevent adjacent inline elements not separated by whitespace.', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-adjacent-inline-elements'), }, diff --git a/lib/rules/no-array-index-key.js b/lib/rules/no-array-index-key.js index fa18924d38..518179562d 100644 --- a/lib/rules/no-array-index-key.js +++ b/lib/rules/no-array-index-key.js @@ -45,7 +45,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of Array index in keys', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-array-index-key'), }, diff --git a/lib/rules/no-arrow-function-lifecycle.js b/lib/rules/no-arrow-function-lifecycle.js index e2a69f3d68..d07b7863f7 100644 --- a/lib/rules/no-arrow-function-lifecycle.js +++ b/lib/rules/no-arrow-function-lifecycle.js @@ -35,7 +35,7 @@ module.exports = { meta: { docs: { description: 'Lifecycle methods should be methods on the prototype, not class fields', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-arrow-function-lifecycle'), }, diff --git a/lib/rules/no-children-prop.js b/lib/rules/no-children-prop.js index 5bd114a464..a8ecc390e3 100644 --- a/lib/rules/no-children-prop.js +++ b/lib/rules/no-children-prop.js @@ -41,7 +41,7 @@ module.exports = { meta: { docs: { description: 'Prevent passing of children as props.', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('no-children-prop'), }, diff --git a/lib/rules/no-danger-with-children.js b/lib/rules/no-danger-with-children.js index 399d202313..bded39da7a 100644 --- a/lib/rules/no-danger-with-children.js +++ b/lib/rules/no-danger-with-children.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Report when a DOM element is using both children and dangerouslySetInnerHTML', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('no-danger-with-children'), }, diff --git a/lib/rules/no-danger.js b/lib/rules/no-danger.js index 2fb3ddc999..9c38fc6212 100644 --- a/lib/rules/no-danger.js +++ b/lib/rules/no-danger.js @@ -47,7 +47,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of dangerous JSX props', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-danger'), }, diff --git a/lib/rules/no-deprecated.js b/lib/rules/no-deprecated.js index 08f8cebce6..a61f38ec68 100644 --- a/lib/rules/no-deprecated.js +++ b/lib/rules/no-deprecated.js @@ -37,7 +37,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of deprecated methods', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('no-deprecated'), }, diff --git a/lib/rules/no-direct-mutation-state.js b/lib/rules/no-direct-mutation-state.js index 6a30ed8908..537c227773 100644 --- a/lib/rules/no-direct-mutation-state.js +++ b/lib/rules/no-direct-mutation-state.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Prevent direct mutation of this.state', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('no-direct-mutation-state'), }, diff --git a/lib/rules/no-find-dom-node.js b/lib/rules/no-find-dom-node.js index 510a79efc8..5654d098b6 100644 --- a/lib/rules/no-find-dom-node.js +++ b/lib/rules/no-find-dom-node.js @@ -20,7 +20,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of findDOMNode', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('no-find-dom-node'), }, diff --git a/lib/rules/no-invalid-html-attribute.js b/lib/rules/no-invalid-html-attribute.js index 274f2586da..17a582eca0 100644 --- a/lib/rules/no-invalid-html-attribute.js +++ b/lib/rules/no-invalid-html-attribute.js @@ -533,8 +533,8 @@ module.exports = { meta: { fixable: 'code', docs: { - description: 'Forbid attribute with an invalid values`', - category: 'Possible Errors', + description: 'Forbid attribute with an invalid values', + category: 'problem', url: docsUrl('no-invalid-html-attribute'), }, messages, diff --git a/lib/rules/no-is-mounted.js b/lib/rules/no-is-mounted.js index dc9db24f28..15c99bdd6e 100644 --- a/lib/rules/no-is-mounted.js +++ b/lib/rules/no-is-mounted.js @@ -20,7 +20,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of isMounted', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('no-is-mounted'), }, diff --git a/lib/rules/no-multi-comp.js b/lib/rules/no-multi-comp.js index 4900063f1f..557001db24 100644 --- a/lib/rules/no-multi-comp.js +++ b/lib/rules/no-multi-comp.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Prevent multiple component definition per file', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('no-multi-comp'), }, diff --git a/lib/rules/no-namespace.js b/lib/rules/no-namespace.js index 929fb2bf88..62481e152b 100644 --- a/lib/rules/no-namespace.js +++ b/lib/rules/no-namespace.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Enforce that namespaces are not used in React elements', - category: 'Possible Errors', + category: 'problem', recommended: false, url: docsUrl('no-namespace'), }, diff --git a/lib/rules/no-redundant-should-component-update.js b/lib/rules/no-redundant-should-component-update.js index 4298666fb7..230aa5b8dc 100644 --- a/lib/rules/no-redundant-should-component-update.js +++ b/lib/rules/no-redundant-should-component-update.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Flag shouldComponentUpdate when extending PureComponent', - category: 'Possible Errors', + category: 'problem', recommended: false, url: docsUrl('no-redundant-should-component-update'), }, diff --git a/lib/rules/no-render-return-value.js b/lib/rules/no-render-return-value.js index c243f30759..83d5a040bc 100644 --- a/lib/rules/no-render-return-value.js +++ b/lib/rules/no-render-return-value.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of the return value of React.render', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('no-render-return-value'), }, diff --git a/lib/rules/no-set-state.js b/lib/rules/no-set-state.js index 444840d5e6..98d27e40ce 100644 --- a/lib/rules/no-set-state.js +++ b/lib/rules/no-set-state.js @@ -21,7 +21,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of setState', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('no-set-state'), }, diff --git a/lib/rules/no-string-refs.js b/lib/rules/no-string-refs.js index 88ef59b80d..61b5fb9fbc 100644 --- a/lib/rules/no-string-refs.js +++ b/lib/rules/no-string-refs.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Prevent string definitions for references and prevent referencing this.refs', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('no-string-refs'), }, diff --git a/lib/rules/no-this-in-sfc.js b/lib/rules/no-this-in-sfc.js index e5af824064..2db79f5586 100644 --- a/lib/rules/no-this-in-sfc.js +++ b/lib/rules/no-this-in-sfc.js @@ -20,7 +20,7 @@ module.exports = { meta: { docs: { description: 'Report "this" being used in stateless components', - category: 'Possible Errors', + category: 'problem', recommended: false, url: docsUrl('no-this-in-sfc'), }, diff --git a/lib/rules/no-typos.js b/lib/rules/no-typos.js index 76783729ae..cd3eff1e30 100644 --- a/lib/rules/no-typos.js +++ b/lib/rules/no-typos.js @@ -31,7 +31,7 @@ module.exports = { meta: { docs: { description: 'Prevent common typos', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('no-typos'), }, diff --git a/lib/rules/no-unescaped-entities.js b/lib/rules/no-unescaped-entities.js index e5a16da9a8..63f03fac7c 100644 --- a/lib/rules/no-unescaped-entities.js +++ b/lib/rules/no-unescaped-entities.js @@ -39,7 +39,7 @@ module.exports = { meta: { docs: { description: 'Detect unescaped HTML entities, which might represent malformed tags', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('no-unescaped-entities'), }, diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index a1a155216c..6d9638eb50 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -221,7 +221,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of unknown DOM property', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('no-unknown-property'), }, diff --git a/lib/rules/no-unsafe.js b/lib/rules/no-unsafe.js index fed9830469..74696e33ed 100644 --- a/lib/rules/no-unsafe.js +++ b/lib/rules/no-unsafe.js @@ -23,7 +23,7 @@ module.exports = { meta: { docs: { description: 'Prevent usage of unsafe lifecycle methods', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-unsafe'), }, diff --git a/lib/rules/no-unstable-nested-components.js b/lib/rules/no-unstable-nested-components.js index ca4ddff560..83d34fecfd 100644 --- a/lib/rules/no-unstable-nested-components.js +++ b/lib/rules/no-unstable-nested-components.js @@ -270,7 +270,7 @@ module.exports = { meta: { docs: { description: 'Prevent creating unstable components inside components', - category: 'Possible Errors', + category: 'suggestion', recommended: false, url: docsUrl('no-unstable-nested-components'), }, diff --git a/lib/rules/no-unused-class-component-methods.js b/lib/rules/no-unused-class-component-methods.js index 3bcadd1d53..877960aa8c 100644 --- a/lib/rules/no-unused-class-component-methods.js +++ b/lib/rules/no-unused-class-component-methods.js @@ -102,7 +102,7 @@ module.exports = { meta: { docs: { description: 'Prevent declaring unused methods of component class', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-unused-class-component-methods'), }, diff --git a/lib/rules/no-unused-prop-types.js b/lib/rules/no-unused-prop-types.js index d001da57b1..26852f42ad 100644 --- a/lib/rules/no-unused-prop-types.js +++ b/lib/rules/no-unused-prop-types.js @@ -24,7 +24,7 @@ module.exports = { meta: { docs: { description: 'Prevent definitions of unused prop types', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-unused-prop-types'), }, diff --git a/lib/rules/no-unused-state.js b/lib/rules/no-unused-state.js index 0854d0740f..5106838c62 100644 --- a/lib/rules/no-unused-state.js +++ b/lib/rules/no-unused-state.js @@ -81,7 +81,7 @@ module.exports = { meta: { docs: { description: 'Prevent definition of unused state fields', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('no-unused-state'), }, diff --git a/lib/rules/prefer-es6-class.js b/lib/rules/prefer-es6-class.js index 01ac32ffdb..b00338ccb1 100644 --- a/lib/rules/prefer-es6-class.js +++ b/lib/rules/prefer-es6-class.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Enforce ES5 or ES6 class for React Components', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('prefer-es6-class'), }, diff --git a/lib/rules/prefer-exact-props.js b/lib/rules/prefer-exact-props.js index 037fa29914..c43525a196 100644 --- a/lib/rules/prefer-exact-props.js +++ b/lib/rules/prefer-exact-props.js @@ -24,7 +24,7 @@ module.exports = { meta: { docs: { description: 'Prefer exact proptype definitions', - category: 'Possible Errors', + category: 'suggestion', recommended: false, url: docsUrl('prefer-exact-props'), }, diff --git a/lib/rules/prefer-read-only-props.js b/lib/rules/prefer-read-only-props.js index f1eb3c3d7c..ac2aafafa3 100644 --- a/lib/rules/prefer-read-only-props.js +++ b/lib/rules/prefer-read-only-props.js @@ -36,7 +36,7 @@ module.exports = { meta: { docs: { description: 'Require read-only props.', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('prefer-read-only-props'), }, diff --git a/lib/rules/prefer-stateless-function.js b/lib/rules/prefer-stateless-function.js index 3ade763a4d..f449f2a367 100644 --- a/lib/rules/prefer-stateless-function.js +++ b/lib/rules/prefer-stateless-function.js @@ -25,7 +25,7 @@ module.exports = { meta: { docs: { description: 'Enforce stateless components to be written as a pure function', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('prefer-stateless-function'), }, diff --git a/lib/rules/prop-types.js b/lib/rules/prop-types.js index 5533d9d3cb..4872ea3672 100644 --- a/lib/rules/prop-types.js +++ b/lib/rules/prop-types.js @@ -24,7 +24,7 @@ module.exports = { meta: { docs: { description: 'Prevent missing props validation in a React component definition', - category: 'Best Practices', + category: 'suggestion', recommended: true, url: docsUrl('prop-types'), }, diff --git a/lib/rules/react-in-jsx-scope.js b/lib/rules/react-in-jsx-scope.js index 4c277ce140..7f973fdb9d 100644 --- a/lib/rules/react-in-jsx-scope.js +++ b/lib/rules/react-in-jsx-scope.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Prevent missing React when using JSX', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('react-in-jsx-scope'), }, diff --git a/lib/rules/require-default-props.js b/lib/rules/require-default-props.js index 8067e25cc5..71083f8491 100644 --- a/lib/rules/require-default-props.js +++ b/lib/rules/require-default-props.js @@ -23,7 +23,7 @@ module.exports = { meta: { docs: { description: 'Enforce a defaultProps definition for every prop that is not a required prop.', - category: 'Best Practices', + category: 'suggestion', url: docsUrl('require-default-props'), }, diff --git a/lib/rules/require-optimization.js b/lib/rules/require-optimization.js index 8f61d2148e..0ba01a9ad9 100644 --- a/lib/rules/require-optimization.js +++ b/lib/rules/require-optimization.js @@ -17,7 +17,7 @@ module.exports = { meta: { docs: { description: 'Enforce React components to have a shouldComponentUpdate method', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('require-optimization'), }, diff --git a/lib/rules/require-render-return.js b/lib/rules/require-render-return.js index 460683e4c5..807d833ac9 100644 --- a/lib/rules/require-render-return.js +++ b/lib/rules/require-render-return.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Enforce ES5 or ES6 class for returning value in render function', - category: 'Possible Errors', + category: 'problem', recommended: true, url: docsUrl('require-render-return'), }, diff --git a/lib/rules/self-closing-comp.js b/lib/rules/self-closing-comp.js index 94672ecac8..57c320fb2d 100644 --- a/lib/rules/self-closing-comp.js +++ b/lib/rules/self-closing-comp.js @@ -23,7 +23,7 @@ module.exports = { meta: { docs: { description: 'Prevent extra closing tags for components without children', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('self-closing-comp'), }, diff --git a/lib/rules/sort-comp.js b/lib/rules/sort-comp.js index 842dd561e9..1321b22b26 100644 --- a/lib/rules/sort-comp.js +++ b/lib/rules/sort-comp.js @@ -89,7 +89,7 @@ module.exports = { meta: { docs: { description: 'Enforce component methods order', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('sort-comp'), }, diff --git a/lib/rules/sort-prop-types.js b/lib/rules/sort-prop-types.js index 977f246432..7504c3b40b 100644 --- a/lib/rules/sort-prop-types.js +++ b/lib/rules/sort-prop-types.js @@ -25,7 +25,7 @@ module.exports = { meta: { docs: { description: 'Enforce propTypes declarations alphabetical sorting', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('sort-prop-types'), }, diff --git a/lib/rules/state-in-constructor.js b/lib/rules/state-in-constructor.js index a7c543d308..1984acf2f3 100644 --- a/lib/rules/state-in-constructor.js +++ b/lib/rules/state-in-constructor.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'State initialization in an ES6 class component should be in a constructor', - category: 'Stylistic Issues', + category: 'suggestion', recommended: false, url: docsUrl('state-in-constructor'), }, diff --git a/lib/rules/static-property-placement.js b/lib/rules/static-property-placement.js index 3fa15d970c..89dc5af339 100644 --- a/lib/rules/static-property-placement.js +++ b/lib/rules/static-property-placement.js @@ -58,7 +58,7 @@ module.exports = { meta: { docs: { description: 'Defines where React component static properties should be positioned.', - category: 'Stylistic Issues', + category: 'layout', recommended: false, url: docsUrl('static-property-placement'), }, diff --git a/lib/rules/style-prop-object.js b/lib/rules/style-prop-object.js index 4d6684a6f1..d699be8e66 100644 --- a/lib/rules/style-prop-object.js +++ b/lib/rules/style-prop-object.js @@ -22,7 +22,7 @@ module.exports = { meta: { docs: { description: 'Enforce style prop value is an object', - category: 'Possible Errors', + category: 'problem', recommended: false, url: docsUrl('style-prop-object'), }, diff --git a/lib/rules/void-dom-elements-no-children.js b/lib/rules/void-dom-elements-no-children.js index 70f38b3f6d..20451d6a39 100644 --- a/lib/rules/void-dom-elements-no-children.js +++ b/lib/rules/void-dom-elements-no-children.js @@ -51,7 +51,7 @@ module.exports = { meta: { docs: { description: 'Prevent passing of children to void DOM elements (e.g. `
`).', - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl('void-dom-elements-no-children'), }, diff --git a/lib/util/makeNoMethodSetStateRule.js b/lib/util/makeNoMethodSetStateRule.js index 8f93762c60..a437fd7699 100644 --- a/lib/util/makeNoMethodSetStateRule.js +++ b/lib/util/makeNoMethodSetStateRule.js @@ -46,7 +46,7 @@ module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafe meta: { docs: { description: `Prevent usage of setState in ${methodName}`, - category: 'Best Practices', + category: 'suggestion', recommended: false, url: docsUrl(mapTitle(methodName)), }, diff --git a/markdown.config.js b/markdown.config.js index 2d23dd1931..48ab2c1373 100644 --- a/markdown.config.js +++ b/markdown.config.js @@ -4,18 +4,16 @@ const { rules } = require('./index'); -const ruleTableRows = Object.keys(rules) - .sort() - .map((id) => { - const { meta } = rules[id]; - const { fixable, docs } = meta; - return [ - docs.recommended ? '✔' : '', - fixable ? '🔧' : '', - `[react/${id}](docs/rules/${id}.md)`, - docs.description, - ].join(' | '); - }); +const buildRuleRow = (id) => { + const { meta } = rules[id]; + const { fixable, docs } = meta; + return [ + docs.recommended ? '✔' : '', + fixable ? '🔧' : '', + `[react/${id}](docs/rules/${id}.md)`, + docs.description, + ].join(' | '); +}; const buildRulesTable = (rows) => { const header = '✔ | 🔧 | Rule | Description'; @@ -26,13 +24,31 @@ const buildRulesTable = (rows) => { .join('\n'); }; -const BASIC_RULES = () => buildRulesTable(ruleTableRows.filter((rule) => !rule.includes('react/jsx-'))); -const JSX_RULES = () => buildRulesTable(ruleTableRows.filter((rule) => rule.includes('react/jsx-'))); +const buildTableOfCategory = (category) => buildRulesTable( + Object.keys(rules) + .sort() + .filter((rule) => rules[rule].meta.docs.category === category) + .map((r) => buildRuleRow(r)) +); + +for (const rule in rules) { + if ( + !['problem', 'suggestion', 'layout'].includes( + rules[rule].meta.docs.category + ) + ) { + console.error( + `Rule ${rule} has wrong category: ${rules[rule].meta.docs.category}` + ); + process.exit(1); + } +} module.exports = { transforms: { - BASIC_RULES, - JSX_RULES, + POSSIBLE_PROBLEMS_RULES: () => buildTableOfCategory('problem'), + SUGGESTIONS_RULES: () => buildTableOfCategory('suggestion'), + LAYOUT_RULES: () => buildTableOfCategory('layout'), }, callback: () => { console.log('The auto-generating of rules finished!');