From 23251846af643b43abe1ffffdd104b0a96dc376d Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Fri, 21 Oct 2022 10:05:33 -0400 Subject: [PATCH] docs: update eslint-doc-generator to 0.14 --- README.md | 49 +++++++++---------- docs/rules/boolean-prop-naming.md | 2 +- docs/rules/button-has-type.md | 2 +- docs/rules/default-props-match-prop-types.md | 2 +- docs/rules/destructuring-assignment.md | 2 +- docs/rules/display-name.md | 4 +- docs/rules/forbid-component-props.md | 2 +- docs/rules/forbid-dom-props.md | 2 +- docs/rules/forbid-elements.md | 2 +- docs/rules/forbid-foreign-prop-types.md | 2 +- docs/rules/forbid-prop-types.md | 2 +- docs/rules/function-component-definition.md | 2 +- docs/rules/hook-use-state.md | 2 +- docs/rules/iframe-missing-sandbox.md | 2 +- docs/rules/jsx-boolean-value.md | 2 +- docs/rules/jsx-child-element-spacing.md | 2 +- docs/rules/jsx-closing-bracket-location.md | 2 +- docs/rules/jsx-closing-tag-location.md | 2 +- docs/rules/jsx-curly-brace-presence.md | 2 +- docs/rules/jsx-curly-newline.md | 2 +- docs/rules/jsx-curly-spacing.md | 2 +- docs/rules/jsx-equals-spacing.md | 2 +- docs/rules/jsx-filename-extension.md | 2 +- docs/rules/jsx-first-prop-new-line.md | 2 +- docs/rules/jsx-fragments.md | 2 +- docs/rules/jsx-handler-names.md | 2 +- docs/rules/jsx-indent-props.md | 2 +- docs/rules/jsx-indent.md | 2 +- docs/rules/jsx-key.md | 4 +- docs/rules/jsx-max-depth.md | 2 +- docs/rules/jsx-max-props-per-line.md | 2 +- docs/rules/jsx-newline.md | 2 +- docs/rules/jsx-no-bind.md | 2 +- docs/rules/jsx-no-comment-textnodes.md | 4 +- .../jsx-no-constructed-context-values.md | 2 +- docs/rules/jsx-no-duplicate-props.md | 4 +- docs/rules/jsx-no-leaked-render.md | 2 +- docs/rules/jsx-no-literals.md | 2 +- docs/rules/jsx-no-script-url.md | 2 +- docs/rules/jsx-no-target-blank.md | 4 +- docs/rules/jsx-no-undef.md | 4 +- docs/rules/jsx-no-useless-fragment.md | 2 +- docs/rules/jsx-one-expression-per-line.md | 2 +- docs/rules/jsx-pascal-case.md | 2 +- docs/rules/jsx-props-no-multi-spaces.md | 2 +- docs/rules/jsx-props-no-spreading.md | 2 +- docs/rules/jsx-sort-default-props.md | 4 +- docs/rules/jsx-sort-props.md | 2 +- docs/rules/jsx-space-before-closing.md | 4 +- docs/rules/jsx-tag-spacing.md | 2 +- docs/rules/jsx-uses-react.md | 4 +- docs/rules/jsx-uses-vars.md | 4 +- docs/rules/jsx-wrap-multilines.md | 2 +- docs/rules/no-access-state-in-setstate.md | 2 +- docs/rules/no-adjacent-inline-elements.md | 2 +- docs/rules/no-array-index-key.md | 2 +- docs/rules/no-arrow-function-lifecycle.md | 2 +- docs/rules/no-children-prop.md | 4 +- docs/rules/no-danger-with-children.md | 4 +- docs/rules/no-danger.md | 2 +- docs/rules/no-deprecated.md | 4 +- docs/rules/no-did-mount-set-state.md | 2 +- docs/rules/no-did-update-set-state.md | 2 +- docs/rules/no-direct-mutation-state.md | 4 +- docs/rules/no-find-dom-node.md | 4 +- docs/rules/no-invalid-html-attribute.md | 2 +- docs/rules/no-is-mounted.md | 4 +- docs/rules/no-multi-comp.md | 2 +- docs/rules/no-namespace.md | 2 +- docs/rules/no-object-type-as-default-prop.md | 2 +- .../no-redundant-should-component-update.md | 2 +- docs/rules/no-render-return-value.md | 4 +- docs/rules/no-set-state.md | 2 +- docs/rules/no-string-refs.md | 4 +- docs/rules/no-this-in-sfc.md | 2 +- docs/rules/no-typos.md | 2 +- docs/rules/no-unescaped-entities.md | 4 +- docs/rules/no-unknown-property.md | 4 +- docs/rules/no-unsafe.md | 4 +- docs/rules/no-unstable-nested-components.md | 7 ++- .../no-unused-class-component-methods.md | 2 +- docs/rules/no-unused-prop-types.md | 2 +- docs/rules/no-unused-state.md | 2 +- docs/rules/no-will-update-set-state.md | 2 +- docs/rules/prefer-es6-class.md | 2 +- docs/rules/prefer-exact-props.md | 2 +- docs/rules/prefer-read-only-props.md | 2 +- docs/rules/prefer-stateless-function.md | 2 +- docs/rules/prop-types.md | 4 +- docs/rules/react-in-jsx-scope.md | 4 +- docs/rules/require-default-props.md | 2 +- docs/rules/require-optimization.md | 2 +- docs/rules/require-render-return.md | 4 +- docs/rules/self-closing-comp.md | 2 +- docs/rules/sort-comp.md | 2 +- docs/rules/sort-default-props.md | 2 +- docs/rules/sort-prop-types.md | 2 +- docs/rules/state-in-constructor.md | 2 +- docs/rules/static-property-placement.md | 2 +- docs/rules/style-prop-object.md | 2 +- docs/rules/void-dom-elements-no-children.md | 2 +- lib/rules/no-unstable-nested-components.js | 6 +++ package.json | 6 +-- 103 files changed, 162 insertions(+), 152 deletions(-) diff --git a/README.md b/README.md index 85776d198b..cc3d8f3d3e 100644 --- a/README.md +++ b/README.md @@ -279,10 +279,9 @@ module.exports = [ ## List of supported rules - + -💼 [Configurations](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs) enabled in.\ -✅ Enabled in the `recommended` [configuration](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs).\ +💼 Enabled in the `recommended` [configuration](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs).\ 🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\ 💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).\ ❌ Deprecated. @@ -293,7 +292,7 @@ module.exports = [ | [button-has-type](docs/rules/button-has-type.md) | Disallow usage of `button` elements without an explicit `type` attribute | | | | | | [default-props-match-prop-types](docs/rules/default-props-match-prop-types.md) | Enforce all defaultProps have a corresponding non-required PropType | | | | | | [destructuring-assignment](docs/rules/destructuring-assignment.md) | Enforce consistent usage of destructuring assignment of props, state, and context | | 🔧 | | | -| [display-name](docs/rules/display-name.md) | Disallow missing displayName in a React component definition | ✅ | | | | +| [display-name](docs/rules/display-name.md) | Disallow missing displayName in a React component definition | 💼 | | | | | [forbid-component-props](docs/rules/forbid-component-props.md) | Disallow certain props on components | | | | | | [forbid-dom-props](docs/rules/forbid-dom-props.md) | Disallow certain props on DOM Nodes | | | | | | [forbid-elements](docs/rules/forbid-elements.md) | Disallow certain elements | | | | | @@ -316,19 +315,19 @@ module.exports = [ | [jsx-handler-names](docs/rules/jsx-handler-names.md) | Enforce event handler naming conventions in JSX | | | | | | [jsx-indent](docs/rules/jsx-indent.md) | Enforce JSX indentation | | 🔧 | | | | [jsx-indent-props](docs/rules/jsx-indent-props.md) | Enforce props indentation in JSX | | 🔧 | | | -| [jsx-key](docs/rules/jsx-key.md) | Disallow missing `key` props in iterators/collection literals | ✅ | | | | +| [jsx-key](docs/rules/jsx-key.md) | Disallow missing `key` props in iterators/collection literals | 💼 | | | | | [jsx-max-depth](docs/rules/jsx-max-depth.md) | Enforce JSX maximum depth | | | | | | [jsx-max-props-per-line](docs/rules/jsx-max-props-per-line.md) | Enforce maximum of props on a single line in JSX | | 🔧 | | | | [jsx-newline](docs/rules/jsx-newline.md) | Require or prevent a new line after jsx elements and expressions. | | 🔧 | | | | [jsx-no-bind](docs/rules/jsx-no-bind.md) | Disallow `.bind()` or arrow functions in JSX props | | | | | -| [jsx-no-comment-textnodes](docs/rules/jsx-no-comment-textnodes.md) | Disallow comments from being inserted as text nodes | ✅ | | | | +| [jsx-no-comment-textnodes](docs/rules/jsx-no-comment-textnodes.md) | Disallow comments from being inserted as text nodes | 💼 | | | | | [jsx-no-constructed-context-values](docs/rules/jsx-no-constructed-context-values.md) | Disallows JSX context provider values from taking values that will cause needless rerenders | | | | | -| [jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md) | Disallow duplicate properties in JSX | ✅ | | | | +| [jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md) | Disallow duplicate properties in JSX | 💼 | | | | | [jsx-no-leaked-render](docs/rules/jsx-no-leaked-render.md) | Disallow problematic leaked values from being rendered | | 🔧 | | | | [jsx-no-literals](docs/rules/jsx-no-literals.md) | Disallow usage of string literals in JSX | | | | | | [jsx-no-script-url](docs/rules/jsx-no-script-url.md) | Disallow usage of `javascript:` URLs | | | | | -| [jsx-no-target-blank](docs/rules/jsx-no-target-blank.md) | Disallow `target="_blank"` attribute without `rel="noreferrer"` | ✅ | 🔧 | | | -| [jsx-no-undef](docs/rules/jsx-no-undef.md) | Disallow undeclared variables in JSX | ✅ | | | | +| [jsx-no-target-blank](docs/rules/jsx-no-target-blank.md) | Disallow `target="_blank"` attribute without `rel="noreferrer"` | 💼 | 🔧 | | | +| [jsx-no-undef](docs/rules/jsx-no-undef.md) | Disallow undeclared variables in JSX | 💼 | | | | | [jsx-no-useless-fragment](docs/rules/jsx-no-useless-fragment.md) | Disallow unnecessary fragments | | 🔧 | | | | [jsx-one-expression-per-line](docs/rules/jsx-one-expression-per-line.md) | Require one JSX element per line | | 🔧 | | | | [jsx-pascal-case](docs/rules/jsx-pascal-case.md) | Enforce PascalCase for user-defined JSX components | | | | | @@ -338,34 +337,34 @@ module.exports = [ | [jsx-sort-props](docs/rules/jsx-sort-props.md) | Enforce props alphabetical sorting | | 🔧 | | | | [jsx-space-before-closing](docs/rules/jsx-space-before-closing.md) | Enforce spacing before closing bracket in JSX | | 🔧 | | ❌ | | [jsx-tag-spacing](docs/rules/jsx-tag-spacing.md) | Enforce whitespace in and around the JSX opening and closing brackets | | 🔧 | | | -| [jsx-uses-react](docs/rules/jsx-uses-react.md) | Disallow React to be incorrectly marked as unused | ✅ | | | | -| [jsx-uses-vars](docs/rules/jsx-uses-vars.md) | Disallow variables used in JSX to be incorrectly marked as unused | ✅ | | | | +| [jsx-uses-react](docs/rules/jsx-uses-react.md) | Disallow React to be incorrectly marked as unused | 💼 | | | | +| [jsx-uses-vars](docs/rules/jsx-uses-vars.md) | Disallow variables used in JSX to be incorrectly marked as unused | 💼 | | | | | [jsx-wrap-multilines](docs/rules/jsx-wrap-multilines.md) | Disallow missing parentheses around multiline JSX | | 🔧 | | | | [no-access-state-in-setstate](docs/rules/no-access-state-in-setstate.md) | Disallow when this.state is accessed within setState | | | | | | [no-adjacent-inline-elements](docs/rules/no-adjacent-inline-elements.md) | Disallow adjacent inline elements not separated by whitespace. | | | | | | [no-array-index-key](docs/rules/no-array-index-key.md) | Disallow usage of Array index in keys | | | | | | [no-arrow-function-lifecycle](docs/rules/no-arrow-function-lifecycle.md) | Lifecycle methods should be methods on the prototype, not class fields | | 🔧 | | | -| [no-children-prop](docs/rules/no-children-prop.md) | Disallow passing of children as props | ✅ | | | | +| [no-children-prop](docs/rules/no-children-prop.md) | Disallow passing of children as props | 💼 | | | | | [no-danger](docs/rules/no-danger.md) | Disallow usage of dangerous JSX properties | | | | | -| [no-danger-with-children](docs/rules/no-danger-with-children.md) | Disallow when a DOM element is using both children and dangerouslySetInnerHTML | ✅ | | | | -| [no-deprecated](docs/rules/no-deprecated.md) | Disallow usage of deprecated methods | ✅ | | | | +| [no-danger-with-children](docs/rules/no-danger-with-children.md) | Disallow when a DOM element is using both children and dangerouslySetInnerHTML | 💼 | | | | +| [no-deprecated](docs/rules/no-deprecated.md) | Disallow usage of deprecated methods | 💼 | | | | | [no-did-mount-set-state](docs/rules/no-did-mount-set-state.md) | Disallow usage of setState in componentDidMount | | | | | | [no-did-update-set-state](docs/rules/no-did-update-set-state.md) | Disallow usage of setState in componentDidUpdate | | | | | -| [no-direct-mutation-state](docs/rules/no-direct-mutation-state.md) | Disallow direct mutation of this.state | ✅ | | | | -| [no-find-dom-node](docs/rules/no-find-dom-node.md) | Disallow usage of findDOMNode | ✅ | | | | +| [no-direct-mutation-state](docs/rules/no-direct-mutation-state.md) | Disallow direct mutation of this.state | 💼 | | | | +| [no-find-dom-node](docs/rules/no-find-dom-node.md) | Disallow usage of findDOMNode | 💼 | | | | | [no-invalid-html-attribute](docs/rules/no-invalid-html-attribute.md) | Disallow usage of invalid attributes | | 🔧 | | | -| [no-is-mounted](docs/rules/no-is-mounted.md) | Disallow usage of isMounted | ✅ | | | | +| [no-is-mounted](docs/rules/no-is-mounted.md) | Disallow usage of isMounted | 💼 | | | | | [no-multi-comp](docs/rules/no-multi-comp.md) | Disallow multiple component definition per file | | | | | | [no-namespace](docs/rules/no-namespace.md) | Enforce that namespaces are not used in React elements | | | | | | [no-object-type-as-default-prop](docs/rules/no-object-type-as-default-prop.md) | Disallow usage of referential-type variables as default param in functional component | | | | | | [no-redundant-should-component-update](docs/rules/no-redundant-should-component-update.md) | Disallow usage of shouldComponentUpdate when extending React.PureComponent | | | | | -| [no-render-return-value](docs/rules/no-render-return-value.md) | Disallow usage of the return value of ReactDOM.render | ✅ | | | | +| [no-render-return-value](docs/rules/no-render-return-value.md) | Disallow usage of the return value of ReactDOM.render | 💼 | | | | | [no-set-state](docs/rules/no-set-state.md) | Disallow usage of setState | | | | | -| [no-string-refs](docs/rules/no-string-refs.md) | Disallow using string references | ✅ | | | | +| [no-string-refs](docs/rules/no-string-refs.md) | Disallow using string references | 💼 | | | | | [no-this-in-sfc](docs/rules/no-this-in-sfc.md) | Disallow `this` from being used in stateless functional components | | | | | | [no-typos](docs/rules/no-typos.md) | Disallow common typos | | | | | -| [no-unescaped-entities](docs/rules/no-unescaped-entities.md) | Disallow unescaped HTML entities from appearing in markup | ✅ | | | | -| [no-unknown-property](docs/rules/no-unknown-property.md) | Disallow usage of unknown DOM property | ✅ | 🔧 | | | +| [no-unescaped-entities](docs/rules/no-unescaped-entities.md) | Disallow unescaped HTML entities from appearing in markup | 💼 | | | | +| [no-unknown-property](docs/rules/no-unknown-property.md) | Disallow usage of unknown DOM property | 💼 | 🔧 | | | | [no-unsafe](docs/rules/no-unsafe.md) | Disallow usage of unsafe lifecycle methods | | | | | | [no-unstable-nested-components](docs/rules/no-unstable-nested-components.md) | Disallow creating unstable components inside components | | | | | | [no-unused-class-component-methods](docs/rules/no-unused-class-component-methods.md) | Disallow declaring unused methods of component class | | | | | @@ -376,11 +375,11 @@ module.exports = [ | [prefer-exact-props](docs/rules/prefer-exact-props.md) | Prefer exact proptype definitions | | | | | | [prefer-read-only-props](docs/rules/prefer-read-only-props.md) | Enforce that props are read-only | | 🔧 | | | | [prefer-stateless-function](docs/rules/prefer-stateless-function.md) | Enforce stateless components to be written as a pure function | | | | | -| [prop-types](docs/rules/prop-types.md) | Disallow missing props validation in a React component definition | ✅ | | | | -| [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md) | Disallow missing React when using JSX | ✅ | | | | +| [prop-types](docs/rules/prop-types.md) | Disallow missing props validation in a React component definition | 💼 | | | | +| [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md) | Disallow missing React when using JSX | 💼 | | | | | [require-default-props](docs/rules/require-default-props.md) | Enforce a defaultProps definition for every prop that is not a required prop | | | | | | [require-optimization](docs/rules/require-optimization.md) | Enforce React components to have a shouldComponentUpdate method | | | | | -| [require-render-return](docs/rules/require-render-return.md) | Enforce ES5 or ES6 class for returning value in render function | ✅ | | | | +| [require-render-return](docs/rules/require-render-return.md) | Enforce ES5 or ES6 class for returning value in render function | 💼 | | | | | [self-closing-comp](docs/rules/self-closing-comp.md) | Disallow extra closing tags for components without children | | 🔧 | | | | [sort-comp](docs/rules/sort-comp.md) | Enforce component methods order | | | | | | [sort-default-props](docs/rules/sort-default-props.md) | Enforce defaultProps declarations alphabetical sorting | | | | | @@ -390,7 +389,7 @@ module.exports = [ | [style-prop-object](docs/rules/style-prop-object.md) | Enforce style prop value is an object | | | | | | [void-dom-elements-no-children](docs/rules/void-dom-elements-no-children.md) | Disallow void DOM elements (e.g. ``, `
`) from receiving children | | | | | - + ## Other useful plugins diff --git a/docs/rules/boolean-prop-naming.md b/docs/rules/boolean-prop-naming.md index 3da8977248..1a88c70b2f 100644 --- a/docs/rules/boolean-prop-naming.md +++ b/docs/rules/boolean-prop-naming.md @@ -1,6 +1,6 @@ # Enforces consistent naming for boolean props (`react/boolean-prop-naming`) - + Allows you to enforce a consistent naming pattern for props which expect a boolean value. diff --git a/docs/rules/button-has-type.md b/docs/rules/button-has-type.md index d91297aab0..8bd8b6a85b 100644 --- a/docs/rules/button-has-type.md +++ b/docs/rules/button-has-type.md @@ -1,6 +1,6 @@ # Disallow usage of `button` elements without an explicit `type` attribute (`react/button-has-type`) - + The default value of `type` attribute for `button` HTML element is `"submit"` which is often not the desired behavior and may lead to unexpected page reloads. This rules enforces an explicit `type` attribute for all the `button` elements and checks that its value is valid per spec (i.e., is one of `"button"`, `"submit"`, and `"reset"`). diff --git a/docs/rules/default-props-match-prop-types.md b/docs/rules/default-props-match-prop-types.md index 998f245c00..f5641c44aa 100644 --- a/docs/rules/default-props-match-prop-types.md +++ b/docs/rules/default-props-match-prop-types.md @@ -1,6 +1,6 @@ # Enforce all defaultProps have a corresponding non-required PropType (`react/default-props-match-prop-types`) - + This rule aims to ensure that any prop in `defaultProps` has a non-required type definition. diff --git a/docs/rules/destructuring-assignment.md b/docs/rules/destructuring-assignment.md index 487f227964..0f8ed6ee4c 100644 --- a/docs/rules/destructuring-assignment.md +++ b/docs/rules/destructuring-assignment.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Rule can be set to either of `always` or `never`; diff --git a/docs/rules/display-name.md b/docs/rules/display-name.md index 731b5390fa..6d0b57a092 100644 --- a/docs/rules/display-name.md +++ b/docs/rules/display-name.md @@ -1,8 +1,8 @@ # Disallow missing displayName in a React component definition (`react/display-name`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + DisplayName allows you to name your component. This name is used by React in debugging messages. diff --git a/docs/rules/forbid-component-props.md b/docs/rules/forbid-component-props.md index d35b5bd8de..a22fb36624 100644 --- a/docs/rules/forbid-component-props.md +++ b/docs/rules/forbid-component-props.md @@ -1,6 +1,6 @@ # Disallow certain props on components (`react/forbid-component-props`) - + By default this rule prevents passing of [props that add lots of complexity](https://medium.com/brigade-engineering/don-t-pass-css-classes-between-components-e9f7ab192785) (`className`, `style`) to Components. This rule only applies to Components (e.g. ``) and not DOM nodes (e.g. `
`). The list of forbidden props can be customized with the `forbid` option. diff --git a/docs/rules/forbid-dom-props.md b/docs/rules/forbid-dom-props.md index de2bb9cd5c..0b6a323c4f 100644 --- a/docs/rules/forbid-dom-props.md +++ b/docs/rules/forbid-dom-props.md @@ -1,6 +1,6 @@ # Disallow certain props on DOM Nodes (`react/forbid-dom-props`) - + This rule prevents passing of props to elements. This rule only applies to DOM Nodes (e.g. `
`) and not Components (e.g. ``). The list of forbidden props can be customized with the `forbid` option. diff --git a/docs/rules/forbid-elements.md b/docs/rules/forbid-elements.md index 4b8ad7e544..8612a26232 100644 --- a/docs/rules/forbid-elements.md +++ b/docs/rules/forbid-elements.md @@ -1,6 +1,6 @@ # Disallow certain elements (`react/forbid-elements`) - + You may want to forbid usage of certain elements in favor of others, (e.g. forbid all `
` and use `` instead). This rule allows you to configure a list of forbidden elements and to specify their desired replacements. diff --git a/docs/rules/forbid-foreign-prop-types.md b/docs/rules/forbid-foreign-prop-types.md index a2c5bd170e..3038951327 100644 --- a/docs/rules/forbid-foreign-prop-types.md +++ b/docs/rules/forbid-foreign-prop-types.md @@ -1,6 +1,6 @@ # Disallow using another component's propTypes (`react/forbid-foreign-prop-types`) - + This rule forbids using another component's prop types unless they are explicitly imported/exported. This allows people who want to use [babel-plugin-transform-react-remove-prop-types](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types) to remove propTypes from their components in production builds, to do so safely. diff --git a/docs/rules/forbid-prop-types.md b/docs/rules/forbid-prop-types.md index 846febb294..65169f2075 100644 --- a/docs/rules/forbid-prop-types.md +++ b/docs/rules/forbid-prop-types.md @@ -1,6 +1,6 @@ # Disallow certain propTypes (`react/forbid-prop-types`) - + By default this rule prevents vague prop types with more specific alternatives available (`any`, `array`, `object`), but any prop type can be disabled if desired. The defaults are chosen because they have obvious replacements. `any` should be replaced with, well, anything. `array` and `object` can be replaced with `arrayOf` and `shape`, respectively. diff --git a/docs/rules/function-component-definition.md b/docs/rules/function-component-definition.md index 708ec1830f..18811d37ad 100644 --- a/docs/rules/function-component-definition.md +++ b/docs/rules/function-component-definition.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + This option enforces a specific function type for function components. diff --git a/docs/rules/hook-use-state.md b/docs/rules/hook-use-state.md index 99fc0c8b77..838d86b607 100644 --- a/docs/rules/hook-use-state.md +++ b/docs/rules/hook-use-state.md @@ -2,7 +2,7 @@ 💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions). - + 💡 This rule provides editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions). diff --git a/docs/rules/iframe-missing-sandbox.md b/docs/rules/iframe-missing-sandbox.md index 3784e54f92..85e3931faa 100644 --- a/docs/rules/iframe-missing-sandbox.md +++ b/docs/rules/iframe-missing-sandbox.md @@ -1,6 +1,6 @@ # Enforce sandbox attribute on iframe elements (`react/iframe-missing-sandbox`) - + The sandbox attribute enables an extra set of restrictions for the content in the iframe. Using sandbox attribute is considered a good security practice. diff --git a/docs/rules/jsx-boolean-value.md b/docs/rules/jsx-boolean-value.md index fd697a3b29..d96285b9cf 100644 --- a/docs/rules/jsx-boolean-value.md +++ b/docs/rules/jsx-boolean-value.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + [When using a boolean attribute in JSX](https://facebook.github.io/react/docs/jsx-in-depth.html#boolean-attributes), you can set the attribute value to `true` or omit the value. diff --git a/docs/rules/jsx-child-element-spacing.md b/docs/rules/jsx-child-element-spacing.md index 1a0789103e..767dcee36c 100644 --- a/docs/rules/jsx-child-element-spacing.md +++ b/docs/rules/jsx-child-element-spacing.md @@ -1,6 +1,6 @@ # Enforce or disallow spaces inside of curly braces in JSX attributes and expressions (`react/jsx-child-element-spacing`) - + ## Rule Details diff --git a/docs/rules/jsx-closing-bracket-location.md b/docs/rules/jsx-closing-bracket-location.md index 2f2d545132..4099d0d81c 100644 --- a/docs/rules/jsx-closing-bracket-location.md +++ b/docs/rules/jsx-closing-bracket-location.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Enforce the closing bracket location for JSX multiline elements. diff --git a/docs/rules/jsx-closing-tag-location.md b/docs/rules/jsx-closing-tag-location.md index d1a0ccf7e3..c740fc27bc 100644 --- a/docs/rules/jsx-closing-tag-location.md +++ b/docs/rules/jsx-closing-tag-location.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Enforce the closing tag location for multiline JSX elements. diff --git a/docs/rules/jsx-curly-brace-presence.md b/docs/rules/jsx-curly-brace-presence.md index ed220d815a..ddd296926a 100644 --- a/docs/rules/jsx-curly-brace-presence.md +++ b/docs/rules/jsx-curly-brace-presence.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + This rule allows you to enforce curly braces or disallow unnecessary curly braces in JSX props and/or children. diff --git a/docs/rules/jsx-curly-newline.md b/docs/rules/jsx-curly-newline.md index 883e24c325..e6841692a5 100644 --- a/docs/rules/jsx-curly-newline.md +++ b/docs/rules/jsx-curly-newline.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Many style guides require or disallow newlines inside of jsx curly expressions. diff --git a/docs/rules/jsx-curly-spacing.md b/docs/rules/jsx-curly-spacing.md index bf5cab69ac..993133be01 100644 --- a/docs/rules/jsx-curly-spacing.md +++ b/docs/rules/jsx-curly-spacing.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces. diff --git a/docs/rules/jsx-equals-spacing.md b/docs/rules/jsx-equals-spacing.md index 6f8a19fff9..9bc57c3600 100644 --- a/docs/rules/jsx-equals-spacing.md +++ b/docs/rules/jsx-equals-spacing.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Some style guides require or disallow spaces around equal signs. diff --git a/docs/rules/jsx-filename-extension.md b/docs/rules/jsx-filename-extension.md index d9d3313652..162b3dc2b8 100644 --- a/docs/rules/jsx-filename-extension.md +++ b/docs/rules/jsx-filename-extension.md @@ -1,6 +1,6 @@ # Disallow file extensions that may contain JSX (`react/jsx-filename-extension`) - + ## Rule Details diff --git a/docs/rules/jsx-first-prop-new-line.md b/docs/rules/jsx-first-prop-new-line.md index 64fed1868b..0ec839dbdc 100644 --- a/docs/rules/jsx-first-prop-new-line.md +++ b/docs/rules/jsx-first-prop-new-line.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Ensure correct position of the first property. diff --git a/docs/rules/jsx-fragments.md b/docs/rules/jsx-fragments.md index 212dfaca8e..7ad03a66f4 100644 --- a/docs/rules/jsx-fragments.md +++ b/docs/rules/jsx-fragments.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + In JSX, a React [fragment] is created either with `...`, or, using the shorthand syntax, `<>...`. diff --git a/docs/rules/jsx-handler-names.md b/docs/rules/jsx-handler-names.md index 7c1a475e22..ced349f374 100644 --- a/docs/rules/jsx-handler-names.md +++ b/docs/rules/jsx-handler-names.md @@ -1,6 +1,6 @@ # Enforce event handler naming conventions in JSX (`react/jsx-handler-names`) - + Ensures that any component or prop methods used to handle events are correctly prefixed. diff --git a/docs/rules/jsx-indent-props.md b/docs/rules/jsx-indent-props.md index 632b45960d..ad34fc8c68 100644 --- a/docs/rules/jsx-indent-props.md +++ b/docs/rules/jsx-indent-props.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + This option validates a specific indentation style for props. diff --git a/docs/rules/jsx-indent.md b/docs/rules/jsx-indent.md index b9b56c3402..bc40e89306 100644 --- a/docs/rules/jsx-indent.md +++ b/docs/rules/jsx-indent.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + This option validates a specific indentation style for JSX. diff --git a/docs/rules/jsx-key.md b/docs/rules/jsx-key.md index 56119be36a..1076d4c145 100644 --- a/docs/rules/jsx-key.md +++ b/docs/rules/jsx-key.md @@ -1,8 +1,8 @@ # Disallow missing `key` props in iterators/collection literals (`react/jsx-key`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Warn if an element that likely requires a `key` prop--namely, one present in an array literal or an arrow function expression. diff --git a/docs/rules/jsx-max-depth.md b/docs/rules/jsx-max-depth.md index 4349209c25..74e6119c0c 100644 --- a/docs/rules/jsx-max-depth.md +++ b/docs/rules/jsx-max-depth.md @@ -1,6 +1,6 @@ # Enforce JSX maximum depth (`react/jsx-max-depth`) - + This option validates a specific depth for JSX. diff --git a/docs/rules/jsx-max-props-per-line.md b/docs/rules/jsx-max-props-per-line.md index d6ac9ba7bc..9def1b243a 100644 --- a/docs/rules/jsx-max-props-per-line.md +++ b/docs/rules/jsx-max-props-per-line.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Limiting the maximum of props on a single line can improve readability. diff --git a/docs/rules/jsx-newline.md b/docs/rules/jsx-newline.md index a4571f0c67..5f2f2ef833 100644 --- a/docs/rules/jsx-newline.md +++ b/docs/rules/jsx-newline.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + ## Rule Details diff --git a/docs/rules/jsx-no-bind.md b/docs/rules/jsx-no-bind.md index 7362e039cd..4124dd3ab4 100644 --- a/docs/rules/jsx-no-bind.md +++ b/docs/rules/jsx-no-bind.md @@ -1,6 +1,6 @@ # Disallow `.bind()` or arrow functions in JSX props (`react/jsx-no-bind`) - + A `bind` call or [arrow function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) in a JSX prop will create a brand new function on every single render. This is bad for performance, as it may cause unnecessary re-renders if a brand new function is passed as a prop to a component that uses reference equality check on the prop to determine if it should update. diff --git a/docs/rules/jsx-no-comment-textnodes.md b/docs/rules/jsx-no-comment-textnodes.md index 6fba84b64e..7f094db08d 100644 --- a/docs/rules/jsx-no-comment-textnodes.md +++ b/docs/rules/jsx-no-comment-textnodes.md @@ -1,8 +1,8 @@ # Disallow comments from being inserted as text nodes (`react/jsx-no-comment-textnodes`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + This rule prevents comment strings (e.g. beginning with `//` or `/*`) from being accidentally injected as a text node in JSX statements. diff --git a/docs/rules/jsx-no-constructed-context-values.md b/docs/rules/jsx-no-constructed-context-values.md index fdf4b7daa0..aba9ac6254 100644 --- a/docs/rules/jsx-no-constructed-context-values.md +++ b/docs/rules/jsx-no-constructed-context-values.md @@ -1,6 +1,6 @@ # Disallows JSX context provider values from taking values that will cause needless rerenders (`react/jsx-no-constructed-context-values`) - + This rule prevents non-stable values (i.e. object identities) from being used as a value for `Context.Provider`. diff --git a/docs/rules/jsx-no-duplicate-props.md b/docs/rules/jsx-no-duplicate-props.md index effd04e241..68a2851cef 100644 --- a/docs/rules/jsx-no-duplicate-props.md +++ b/docs/rules/jsx-no-duplicate-props.md @@ -1,8 +1,8 @@ # Disallow duplicate properties in JSX (`react/jsx-no-duplicate-props`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Creating JSX elements with duplicate props can cause unexpected behavior in your application. diff --git a/docs/rules/jsx-no-leaked-render.md b/docs/rules/jsx-no-leaked-render.md index 1aef71ecc8..258ea1f2c0 100644 --- a/docs/rules/jsx-no-leaked-render.md +++ b/docs/rules/jsx-no-leaked-render.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Using the `&&` operator to render some element conditionally in JSX can cause unexpected values being rendered, or even crashing the rendering. diff --git a/docs/rules/jsx-no-literals.md b/docs/rules/jsx-no-literals.md index 7e07e49c64..1a69313951 100644 --- a/docs/rules/jsx-no-literals.md +++ b/docs/rules/jsx-no-literals.md @@ -1,6 +1,6 @@ # Disallow usage of string literals in JSX (`react/jsx-no-literals`) - + There are a few scenarios where you want to avoid string literals in JSX. You may want to enforce consistency, reduce syntax highlighting issues, or ensure that strings are part of a translation system. diff --git a/docs/rules/jsx-no-script-url.md b/docs/rules/jsx-no-script-url.md index afa79721eb..8d4f7c8cd4 100644 --- a/docs/rules/jsx-no-script-url.md +++ b/docs/rules/jsx-no-script-url.md @@ -1,6 +1,6 @@ # Disallow usage of `javascript:` URLs (`react/jsx-no-script-url`) - + **In React 16.9** any URLs starting with `javascript:` [scheme](https://wiki.whatwg.org/wiki/URL_schemes#javascript:_URLs) log a warning. React considers the pattern as a dangerous attack surface, see [details](https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#deprecating-javascript-urls). diff --git a/docs/rules/jsx-no-target-blank.md b/docs/rules/jsx-no-target-blank.md index a294dc06bf..22fcc0cbc7 100644 --- a/docs/rules/jsx-no-target-blank.md +++ b/docs/rules/jsx-no-target-blank.md @@ -1,10 +1,10 @@ # Disallow `target="_blank"` attribute without `rel="noreferrer"` (`react/jsx-no-target-blank`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + When creating a JSX element that has an `a` tag, it is often desired to have the link open in a new tab using the `target='_blank'` attribute. Using this attribute unaccompanied by `rel='noreferrer'`, however, is a severe security vulnerability (see [noreferrer docs](https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer) and [noopener docs](https://html.spec.whatwg.org/multipage/links.html#link-type-noopener) for more details) This rules requires that you accompany `target='_blank'` attributes with `rel='noreferrer'`. diff --git a/docs/rules/jsx-no-undef.md b/docs/rules/jsx-no-undef.md index c90c030e20..2a5101813b 100644 --- a/docs/rules/jsx-no-undef.md +++ b/docs/rules/jsx-no-undef.md @@ -1,8 +1,8 @@ # Disallow undeclared variables in JSX (`react/jsx-no-undef`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + This rule helps locate potential ReferenceErrors resulting from misspellings or missing components. diff --git a/docs/rules/jsx-no-useless-fragment.md b/docs/rules/jsx-no-useless-fragment.md index 2f2a01960e..4420d8cc1b 100644 --- a/docs/rules/jsx-no-useless-fragment.md +++ b/docs/rules/jsx-no-useless-fragment.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a [keyed fragment](https://reactjs.org/docs/fragments.html#keyed-fragments). diff --git a/docs/rules/jsx-one-expression-per-line.md b/docs/rules/jsx-one-expression-per-line.md index 7ba4a65976..9c5fe0eac6 100644 --- a/docs/rules/jsx-one-expression-per-line.md +++ b/docs/rules/jsx-one-expression-per-line.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + This option limits every line in JSX to one expression each. diff --git a/docs/rules/jsx-pascal-case.md b/docs/rules/jsx-pascal-case.md index b434633e91..77ffbab5a7 100644 --- a/docs/rules/jsx-pascal-case.md +++ b/docs/rules/jsx-pascal-case.md @@ -1,6 +1,6 @@ # Enforce PascalCase for user-defined JSX components (`react/jsx-pascal-case`) - + Enforces coding style that user-defined JSX components are defined and referenced in PascalCase. diff --git a/docs/rules/jsx-props-no-multi-spaces.md b/docs/rules/jsx-props-no-multi-spaces.md index 81717974b8..118f9dd81d 100644 --- a/docs/rules/jsx-props-no-multi-spaces.md +++ b/docs/rules/jsx-props-no-multi-spaces.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Enforces that there is exactly one space between all attributes and after tag name and the first attribute in the same line. diff --git a/docs/rules/jsx-props-no-spreading.md b/docs/rules/jsx-props-no-spreading.md index 3eeaf452ea..ebe4eb0b13 100644 --- a/docs/rules/jsx-props-no-spreading.md +++ b/docs/rules/jsx-props-no-spreading.md @@ -1,6 +1,6 @@ # Disallow JSX prop spreading (`react/jsx-props-no-spreading`) - + Enforces that there is no spreading for any JSX attribute. This enhances readability of code by being more explicit about what props are received by the component. It is also good for maintainability by avoiding passing unintentional extra props and allowing react to emit warnings when invalid HTML props are passed to HTML elements. diff --git a/docs/rules/jsx-sort-default-props.md b/docs/rules/jsx-sort-default-props.md index 41b6b6ef1d..cdeef9196a 100644 --- a/docs/rules/jsx-sort-default-props.md +++ b/docs/rules/jsx-sort-default-props.md @@ -1,8 +1,8 @@ # Enforce defaultProps declarations alphabetical sorting (`react/jsx-sort-default-props`) -❌ This rule is deprecated. It was replaced by [sort-default-props](sort-default-props.md). +❌ This rule is deprecated. It was replaced by [`sort-default-props`](sort-default-props.md). - + Some developers prefer to sort `defaultProps` declarations alphabetically to be able to find necessary declarations easier at a later time. Others feel that it adds complexity and becomes a burden to maintain. diff --git a/docs/rules/jsx-sort-props.md b/docs/rules/jsx-sort-props.md index b222e6b0c7..b51209f32e 100644 --- a/docs/rules/jsx-sort-props.md +++ b/docs/rules/jsx-sort-props.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Some developers prefer to sort props names alphabetically to be able to find necessary props easier at the later time. Others feel that it adds complexity and becomes burden to maintain. diff --git a/docs/rules/jsx-space-before-closing.md b/docs/rules/jsx-space-before-closing.md index e13f3f82d8..da48d3b2b1 100644 --- a/docs/rules/jsx-space-before-closing.md +++ b/docs/rules/jsx-space-before-closing.md @@ -1,10 +1,10 @@ # Enforce spacing before closing bracket in JSX (`react/jsx-space-before-closing`) -❌ This rule is deprecated. It was replaced by [jsx-tag-spacing](jsx-tag-spacing.md). +❌ This rule is deprecated. It was replaced by [`jsx-tag-spacing`](jsx-tag-spacing.md). 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Please use the `"beforeSelfClosing"` option of the [jsx-tag-spacing](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md) rule instead. diff --git a/docs/rules/jsx-tag-spacing.md b/docs/rules/jsx-tag-spacing.md index 109941b3db..8c82661d03 100644 --- a/docs/rules/jsx-tag-spacing.md +++ b/docs/rules/jsx-tag-spacing.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Enforce or forbid spaces after the opening bracket, before the closing bracket, before the closing bracket of self-closing elements, and between the angle bracket and slash of JSX closing or self-closing elements. diff --git a/docs/rules/jsx-uses-react.md b/docs/rules/jsx-uses-react.md index 6a95a60e12..3bbde16f21 100644 --- a/docs/rules/jsx-uses-react.md +++ b/docs/rules/jsx-uses-react.md @@ -1,8 +1,8 @@ # Disallow React to be incorrectly marked as unused (`react/jsx-uses-react`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). This rule is _disabled_ in the `jsx-runtime` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + JSX expands to a call to `React.createElement`, a file which includes `React` but only uses JSX should consider the `React` variable as used. diff --git a/docs/rules/jsx-uses-vars.md b/docs/rules/jsx-uses-vars.md index 8f4f43d3d2..bffc54d6ce 100644 --- a/docs/rules/jsx-uses-vars.md +++ b/docs/rules/jsx-uses-vars.md @@ -1,8 +1,8 @@ # Disallow variables used in JSX to be incorrectly marked as unused (`react/jsx-uses-vars`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Since 0.17.0 the `eslint` `no-unused-vars` rule does not detect variables used in JSX ([see details](https://eslint.org/blog/2015/03/eslint-0.17.0-released#changes-to-jsxreact-handling)). This rule will find variables used in JSX and mark them as used. diff --git a/docs/rules/jsx-wrap-multilines.md b/docs/rules/jsx-wrap-multilines.md index 7746943a28..d8a01e32fb 100644 --- a/docs/rules/jsx-wrap-multilines.md +++ b/docs/rules/jsx-wrap-multilines.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Wrapping multiline JSX in parentheses can improve readability and/or convenience. diff --git a/docs/rules/no-access-state-in-setstate.md b/docs/rules/no-access-state-in-setstate.md index 5d771479cd..51830d4486 100644 --- a/docs/rules/no-access-state-in-setstate.md +++ b/docs/rules/no-access-state-in-setstate.md @@ -1,6 +1,6 @@ # Disallow when this.state is accessed within setState (`react/no-access-state-in-setstate`) - + Usage of `this.state` inside `setState` calls might result in errors when two state calls are called in batch and thus referencing old state and not the current state. diff --git a/docs/rules/no-adjacent-inline-elements.md b/docs/rules/no-adjacent-inline-elements.md index 3b6ba21a99..1d7bdb38f6 100644 --- a/docs/rules/no-adjacent-inline-elements.md +++ b/docs/rules/no-adjacent-inline-elements.md @@ -1,6 +1,6 @@ # Disallow adjacent inline elements not separated by whitespace (`react/no-adjacent-inline-elements`) - + Adjacent inline elements not separated by whitespace will bump up against each other when viewed in an unstyled manner, which usually isn't desirable. diff --git a/docs/rules/no-array-index-key.md b/docs/rules/no-array-index-key.md index b89c2de18a..f9481156a2 100644 --- a/docs/rules/no-array-index-key.md +++ b/docs/rules/no-array-index-key.md @@ -1,6 +1,6 @@ # Disallow usage of Array index in keys (`react/no-array-index-key`) - + Warn if an element uses an Array index in its `key`. diff --git a/docs/rules/no-arrow-function-lifecycle.md b/docs/rules/no-arrow-function-lifecycle.md index d47b742022..16b8aaae8f 100644 --- a/docs/rules/no-arrow-function-lifecycle.md +++ b/docs/rules/no-arrow-function-lifecycle.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + It is not necessary to use arrow function for lifecycle methods. This makes things harder to test, conceptually less performant (although in practice, performance will not be affected, since most engines will optimize efficiently), and can break hot reloading patterns. diff --git a/docs/rules/no-children-prop.md b/docs/rules/no-children-prop.md index 7d9128a948..954a898b4c 100644 --- a/docs/rules/no-children-prop.md +++ b/docs/rules/no-children-prop.md @@ -1,8 +1,8 @@ # Disallow passing of children as props (`react/no-children-prop`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Children should always be actual children, not passed in as a prop. diff --git a/docs/rules/no-danger-with-children.md b/docs/rules/no-danger-with-children.md index b388a27478..651866160d 100644 --- a/docs/rules/no-danger-with-children.md +++ b/docs/rules/no-danger-with-children.md @@ -1,8 +1,8 @@ # Disallow when a DOM element is using both children and dangerouslySetInnerHTML (`react/no-danger-with-children`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + This rule helps prevent problems caused by using children and the dangerouslySetInnerHTML prop at the same time. React will throw a warning if this rule is ignored. diff --git a/docs/rules/no-danger.md b/docs/rules/no-danger.md index 601c4aa852..417989e0b2 100644 --- a/docs/rules/no-danger.md +++ b/docs/rules/no-danger.md @@ -1,6 +1,6 @@ # Disallow usage of dangerous JSX properties (`react/no-danger`) - + Dangerous properties in React are those whose behavior is known to be a common source of application vulnerabilities. The properties names clearly indicate they are dangerous and should be avoided unless great care is taken. diff --git a/docs/rules/no-deprecated.md b/docs/rules/no-deprecated.md index 2b0ea86777..27244d9b30 100644 --- a/docs/rules/no-deprecated.md +++ b/docs/rules/no-deprecated.md @@ -1,8 +1,8 @@ # Disallow usage of deprecated methods (`react/no-deprecated`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Several methods are deprecated between React versions. This rule will warn you if you try to use a deprecated method. Use the [shared settings](/README.md#configuration) to specify the React version. diff --git a/docs/rules/no-did-mount-set-state.md b/docs/rules/no-did-mount-set-state.md index dfd5e54a31..6594ac4768 100644 --- a/docs/rules/no-did-mount-set-state.md +++ b/docs/rules/no-did-mount-set-state.md @@ -1,6 +1,6 @@ # Disallow usage of setState in componentDidMount (`react/no-did-mount-set-state`) - + Updating the state after a component mount will trigger a second `render()` call and can lead to property/layout thrashing. diff --git a/docs/rules/no-did-update-set-state.md b/docs/rules/no-did-update-set-state.md index 9ebf48d7d5..bea51e2fb5 100644 --- a/docs/rules/no-did-update-set-state.md +++ b/docs/rules/no-did-update-set-state.md @@ -1,6 +1,6 @@ # Disallow usage of setState in componentDidUpdate (`react/no-did-update-set-state`) - + Updating the state after a component update will trigger a second `render()` call and can lead to property/layout thrashing. diff --git a/docs/rules/no-direct-mutation-state.md b/docs/rules/no-direct-mutation-state.md index 42d0dd8588..7d242de03c 100644 --- a/docs/rules/no-direct-mutation-state.md +++ b/docs/rules/no-direct-mutation-state.md @@ -1,8 +1,8 @@ # Disallow direct mutation of this.state (`react/no-direct-mutation-state`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + NEVER mutate `this.state` directly, as calling `setState()` afterwards may replace the mutation you made. Treat `this.state` as if it were immutable. diff --git a/docs/rules/no-find-dom-node.md b/docs/rules/no-find-dom-node.md index d4b713842f..4bb47fc8fa 100644 --- a/docs/rules/no-find-dom-node.md +++ b/docs/rules/no-find-dom-node.md @@ -1,8 +1,8 @@ # Disallow usage of findDOMNode (`react/no-find-dom-node`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Facebook will eventually deprecate `findDOMNode` as it blocks certain improvements in React in the future. diff --git a/docs/rules/no-invalid-html-attribute.md b/docs/rules/no-invalid-html-attribute.md index dff5bde3bd..12614ff900 100644 --- a/docs/rules/no-invalid-html-attribute.md +++ b/docs/rules/no-invalid-html-attribute.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Some HTML elements have a specific set of valid values for some attributes. For instance the elements: `a`, `area`, `link`, or `form` all have an attribute called `rel`. diff --git a/docs/rules/no-is-mounted.md b/docs/rules/no-is-mounted.md index 4b81846af2..a045244a52 100644 --- a/docs/rules/no-is-mounted.md +++ b/docs/rules/no-is-mounted.md @@ -1,8 +1,8 @@ # Disallow usage of isMounted (`react/no-is-mounted`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + [`isMounted` is an anti-pattern][anti-pattern], is not available when using ES6 classes, and it is on its way to being officially deprecated. diff --git a/docs/rules/no-multi-comp.md b/docs/rules/no-multi-comp.md index 8734ad8646..00067c89d6 100644 --- a/docs/rules/no-multi-comp.md +++ b/docs/rules/no-multi-comp.md @@ -1,6 +1,6 @@ # Disallow multiple component definition per file (`react/no-multi-comp`) - + Declaring only one component per file improves readability and reusability of components. diff --git a/docs/rules/no-namespace.md b/docs/rules/no-namespace.md index 3d56104158..feda1d84d3 100644 --- a/docs/rules/no-namespace.md +++ b/docs/rules/no-namespace.md @@ -1,6 +1,6 @@ # Enforce that namespaces are not used in React elements (`react/no-namespace`) - + Enforces the absence of a namespace in React elements, such as with `svg:circle`, as they are not supported in React. diff --git a/docs/rules/no-object-type-as-default-prop.md b/docs/rules/no-object-type-as-default-prop.md index d7c98dacff..adbea796e5 100644 --- a/docs/rules/no-object-type-as-default-prop.md +++ b/docs/rules/no-object-type-as-default-prop.md @@ -1,6 +1,6 @@ # Disallow usage of referential-type variables as default param in functional component (`react/no-object-type-as-default-prop`) - + Warns if in a functional component, an object type value (such as array/object literal/function/etc) is used as default prop, to prevent potential unnecessary rerenders, and performance regressions. diff --git a/docs/rules/no-redundant-should-component-update.md b/docs/rules/no-redundant-should-component-update.md index 933d36a4e4..653d7a687a 100644 --- a/docs/rules/no-redundant-should-component-update.md +++ b/docs/rules/no-redundant-should-component-update.md @@ -1,6 +1,6 @@ # Disallow usage of shouldComponentUpdate when extending React.PureComponent (`react/no-redundant-should-component-update`) - + Warns if you have `shouldComponentUpdate` defined when defining a component that extends React.PureComponent. While having `shouldComponentUpdate` will still work, it becomes pointless to extend PureComponent. diff --git a/docs/rules/no-render-return-value.md b/docs/rules/no-render-return-value.md index 029efcbe71..0a83801201 100644 --- a/docs/rules/no-render-return-value.md +++ b/docs/rules/no-render-return-value.md @@ -1,8 +1,8 @@ # Disallow usage of the return value of ReactDOM.render (`react/no-render-return-value`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + > `ReactDOM.render()` currently returns a reference to the root `ReactComponent` instance. However, using this return value is legacy and should be avoided because future versions of React may render components asynchronously in some cases. If you need a reference to the root `ReactComponent` instance, the preferred solution is to attach a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) to the root element. diff --git a/docs/rules/no-set-state.md b/docs/rules/no-set-state.md index 6dc5cb890a..9ca63ebf0b 100644 --- a/docs/rules/no-set-state.md +++ b/docs/rules/no-set-state.md @@ -1,6 +1,6 @@ # Disallow usage of setState (`react/no-set-state`) - + When using an architecture that separates your application state from your UI components (e.g. Flux), it may be desirable to forbid the use of local component state. This rule is especially helpful in read-only applications (that don't use forms), since local component state should rarely be necessary in such cases. diff --git a/docs/rules/no-string-refs.md b/docs/rules/no-string-refs.md index 8a5c2b0e88..f9615ae35f 100644 --- a/docs/rules/no-string-refs.md +++ b/docs/rules/no-string-refs.md @@ -1,8 +1,8 @@ # Disallow using string references (`react/no-string-refs`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Currently, two ways are supported by React to refer to components. The first way, providing a string identifier, is now considered legacy in the official documentation. The documentation now prefers a second method -- referring to components by setting a property on the `this` object in the reference callback. diff --git a/docs/rules/no-this-in-sfc.md b/docs/rules/no-this-in-sfc.md index 1fc7d84034..e40342d3ca 100644 --- a/docs/rules/no-this-in-sfc.md +++ b/docs/rules/no-this-in-sfc.md @@ -1,6 +1,6 @@ # Disallow `this` from being used in stateless functional components (`react/no-this-in-sfc`) - + In React, there are two styles of component. One is a class component: `class Foo extends React.Component {...}`, which accesses its props, context, and state as properties of `this`: `this.props.foo`, etc. The other are stateless functional components (SFCs): `function Foo(props, context) {...}`. As you can see, there's no `state` (hence the name - hooks do not change this), and the props and context are provided as its two functional arguments. In an SFC, state is usually best implements with a [React hook](https://reactjs.org/docs/hooks-overview.html) such as `React.useState()`. diff --git a/docs/rules/no-typos.md b/docs/rules/no-typos.md index b1fa9fb337..c8b68d2eb1 100644 --- a/docs/rules/no-typos.md +++ b/docs/rules/no-typos.md @@ -1,6 +1,6 @@ # Disallow common typos (`react/no-typos`) - + Ensure no casing typos were made declaring static class properties and lifecycle methods. Checks that declared `propTypes`, `contextTypes` and `childContextTypes` is supported by [react-props](https://github.com/facebook/prop-types) diff --git a/docs/rules/no-unescaped-entities.md b/docs/rules/no-unescaped-entities.md index 12238eecc7..d105c9d5b7 100644 --- a/docs/rules/no-unescaped-entities.md +++ b/docs/rules/no-unescaped-entities.md @@ -1,8 +1,8 @@ # Disallow unescaped HTML entities from appearing in markup (`react/no-unescaped-entities`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + This rule prevents characters that you may have meant as JSX escape characters from being accidentally injected as a text node in JSX statements. diff --git a/docs/rules/no-unknown-property.md b/docs/rules/no-unknown-property.md index 7cf679b0a7..9a0b196d35 100644 --- a/docs/rules/no-unknown-property.md +++ b/docs/rules/no-unknown-property.md @@ -1,10 +1,10 @@ # Disallow usage of unknown DOM property (`react/no-unknown-property`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + In JSX most DOM properties and attributes should be camelCased to be consistent with standard JavaScript style. This can be a possible source of error if you are used to writing plain HTML. Only `data-*` and `aria-*` attributes are usings hyphens and lowercase letters in JSX. diff --git a/docs/rules/no-unsafe.md b/docs/rules/no-unsafe.md index dbb8c3cee0..0c99399338 100644 --- a/docs/rules/no-unsafe.md +++ b/docs/rules/no-unsafe.md @@ -1,6 +1,8 @@ # Disallow usage of unsafe lifecycle methods (`react/no-unsafe`) - +💼 This rule is _disabled_ in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). + + Certain legacy lifecycle methods are [unsafe for use in async React applications][async_rendering] and cause warnings in [_strict mode_][strict_mode]. These also happen to be the lifecycles that cause the most [confusion within the React community][component_lifecycle_changes]. diff --git a/docs/rules/no-unstable-nested-components.md b/docs/rules/no-unstable-nested-components.md index c0ab4f9ece..8117636805 100644 --- a/docs/rules/no-unstable-nested-components.md +++ b/docs/rules/no-unstable-nested-components.md @@ -1,6 +1,6 @@ # Disallow creating unstable components inside components (`react/no-unstable-nested-components`) - + Creating components inside components (nested components) will cause React to throw away the state of those nested components on each re-render of their parent. @@ -122,7 +122,10 @@ function Component() { ... "react/no-unstable-nested-components": [ "off" | "warn" | "error", - { "allowAsProps": true | false } + { + "allowAsProps": true | false, + "customValidators": [] /* optional array of validators used for propTypes validation */ + } ] ... ``` diff --git a/docs/rules/no-unused-class-component-methods.md b/docs/rules/no-unused-class-component-methods.md index d3dc36c856..2c503eda8f 100644 --- a/docs/rules/no-unused-class-component-methods.md +++ b/docs/rules/no-unused-class-component-methods.md @@ -1,6 +1,6 @@ # Disallow declaring unused methods of component class (`react/no-unused-class-component-methods`) - + Warns you if you have defined a method or property but it is never being used anywhere. diff --git a/docs/rules/no-unused-prop-types.md b/docs/rules/no-unused-prop-types.md index c7c4c011c4..66d23b8cdb 100644 --- a/docs/rules/no-unused-prop-types.md +++ b/docs/rules/no-unused-prop-types.md @@ -1,6 +1,6 @@ # Disallow definitions of unused propTypes (`react/no-unused-prop-types`) - + Warns if a prop with a defined type isn't being used. diff --git a/docs/rules/no-unused-state.md b/docs/rules/no-unused-state.md index e6ac5bb48f..7a2f3b44c5 100644 --- a/docs/rules/no-unused-state.md +++ b/docs/rules/no-unused-state.md @@ -1,6 +1,6 @@ # Disallow definitions of unused state (`react/no-unused-state`) - + Warns you if you have defined a property on the state, but it is not being used anywhere. diff --git a/docs/rules/no-will-update-set-state.md b/docs/rules/no-will-update-set-state.md index 7b5f6311c2..70143cc33d 100644 --- a/docs/rules/no-will-update-set-state.md +++ b/docs/rules/no-will-update-set-state.md @@ -1,6 +1,6 @@ # Disallow usage of setState in componentWillUpdate (`react/no-will-update-set-state`) - + Updating the state during the componentWillUpdate step can lead to indeterminate component state and is not allowed. diff --git a/docs/rules/prefer-es6-class.md b/docs/rules/prefer-es6-class.md index b0b1281f6b..f4dfa859d8 100644 --- a/docs/rules/prefer-es6-class.md +++ b/docs/rules/prefer-es6-class.md @@ -1,6 +1,6 @@ # Enforce ES5 or ES6 class for React Components (`react/prefer-es6-class`) - + React offers you two ways to create traditional components: using the ES5 `create-react-class` module or the new ES6 class system. diff --git a/docs/rules/prefer-exact-props.md b/docs/rules/prefer-exact-props.md index ca49e74c18..c9878f7b7a 100644 --- a/docs/rules/prefer-exact-props.md +++ b/docs/rules/prefer-exact-props.md @@ -1,6 +1,6 @@ # Prefer exact proptype definitions (`react/prefer-exact-props`) - + Recommends options to ensure only exact prop definitions are used when writing components. This recommends solutions for PropTypes or for Flow types. diff --git a/docs/rules/prefer-read-only-props.md b/docs/rules/prefer-read-only-props.md index c47b28d604..3e3d25f52a 100644 --- a/docs/rules/prefer-read-only-props.md +++ b/docs/rules/prefer-read-only-props.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Using Flow, one can define types for props. This rule enforces that prop types are read-only (covariant). diff --git a/docs/rules/prefer-stateless-function.md b/docs/rules/prefer-stateless-function.md index 10d605bb66..271300595d 100644 --- a/docs/rules/prefer-stateless-function.md +++ b/docs/rules/prefer-stateless-function.md @@ -1,6 +1,6 @@ # Enforce stateless components to be written as a pure function (`react/prefer-stateless-function`) - + Stateless functional components are simpler than class based components and will benefit from future React performance optimizations specific to these components. diff --git a/docs/rules/prop-types.md b/docs/rules/prop-types.md index ef3d1c03ff..12fc8a49f9 100644 --- a/docs/rules/prop-types.md +++ b/docs/rules/prop-types.md @@ -1,8 +1,8 @@ # Disallow missing props validation in a React component definition (`react/prop-types`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + Defining types for component props improves reusability of your components by validating received data. It can warn other developers if they make a mistake while reusing the component with improper data type. diff --git a/docs/rules/react-in-jsx-scope.md b/docs/rules/react-in-jsx-scope.md index 229b9346eb..952e50dc86 100644 --- a/docs/rules/react-in-jsx-scope.md +++ b/docs/rules/react-in-jsx-scope.md @@ -1,8 +1,8 @@ # Disallow missing React when using JSX (`react/react-in-jsx-scope`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). This rule is _disabled_ in the `jsx-runtime` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + When using JSX, `` expands to `React.createElement("a")`. Therefore the `React` variable must be in scope. diff --git a/docs/rules/require-default-props.md b/docs/rules/require-default-props.md index 553710e655..f083aaf7ff 100644 --- a/docs/rules/require-default-props.md +++ b/docs/rules/require-default-props.md @@ -1,6 +1,6 @@ # Enforce a defaultProps definition for every prop that is not a required prop (`react/require-default-props`) - + This rule aims to ensure that any non-required prop types of a component has a corresponding `defaultProps` value. diff --git a/docs/rules/require-optimization.md b/docs/rules/require-optimization.md index 9e7f7443d1..5587aa90f9 100644 --- a/docs/rules/require-optimization.md +++ b/docs/rules/require-optimization.md @@ -1,6 +1,6 @@ # Enforce React components to have a shouldComponentUpdate method (`react/require-optimization`) - + This rule prevents you from creating React components without declaring a `shouldComponentUpdate` method. diff --git a/docs/rules/require-render-return.md b/docs/rules/require-render-return.md index 6838564ba5..d6f00c1fa7 100644 --- a/docs/rules/require-render-return.md +++ b/docs/rules/require-render-return.md @@ -1,8 +1,8 @@ # Enforce ES5 or ES6 class for returning value in render function (`react/require-render-return`) -✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). +💼 This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). - + When writing the `render` method in a component it is easy to forget to return the JSX content. This rule will warn if the `return` statement is missing. diff --git a/docs/rules/self-closing-comp.md b/docs/rules/self-closing-comp.md index bbd4d5e806..cf47b5390e 100644 --- a/docs/rules/self-closing-comp.md +++ b/docs/rules/self-closing-comp.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Components without children can be self-closed to avoid unnecessary extra closing tag. diff --git a/docs/rules/sort-comp.md b/docs/rules/sort-comp.md index 0410011ce2..f8ec17b469 100644 --- a/docs/rules/sort-comp.md +++ b/docs/rules/sort-comp.md @@ -1,6 +1,6 @@ # Enforce component methods order (`react/sort-comp`) - + 🔧 This rule is automatically fixable using the [`sort-comp` transform](https://github.com/reactjs/react-codemod/blob/master/transforms/sort-comp.js) in [react-codemod](https://www.npmjs.com/package/react-codemod). diff --git a/docs/rules/sort-default-props.md b/docs/rules/sort-default-props.md index eab9c01161..64ff5e4ce3 100644 --- a/docs/rules/sort-default-props.md +++ b/docs/rules/sort-default-props.md @@ -1,6 +1,6 @@ # Enforce defaultProps declarations alphabetical sorting (`react/sort-default-props`) - + Some developers prefer to sort `defaultProps` declarations alphabetically to be able to find necessary declarations easier at a later time. Others feel that it adds complexity and becomes a burden to maintain. diff --git a/docs/rules/sort-prop-types.md b/docs/rules/sort-prop-types.md index fc5f2964ff..3f973fad50 100644 --- a/docs/rules/sort-prop-types.md +++ b/docs/rules/sort-prop-types.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). - + Some developers prefer to sort prop type declarations alphabetically to be able to find necessary declaration easier at the later time. Others feel that it adds complexity and becomes burden to maintain. diff --git a/docs/rules/state-in-constructor.md b/docs/rules/state-in-constructor.md index 1e40d542a9..a73643e9cd 100644 --- a/docs/rules/state-in-constructor.md +++ b/docs/rules/state-in-constructor.md @@ -1,6 +1,6 @@ # Enforce class component state initialization style (`react/state-in-constructor`) - + ## Rule Details diff --git a/docs/rules/static-property-placement.md b/docs/rules/static-property-placement.md index f67d0925d9..b3e5b6ee19 100644 --- a/docs/rules/static-property-placement.md +++ b/docs/rules/static-property-placement.md @@ -1,6 +1,6 @@ # Enforces where React component static properties should be positioned (`react/static-property-placement`) - + This rule allows you to enforce where `childContextTypes`, `contextTypes`, `contextType`, `defaultProps`, `displayName`, and `propTypes` are declared in an ES6 class. diff --git a/docs/rules/style-prop-object.md b/docs/rules/style-prop-object.md index 2bd4313e2d..4e184a7918 100644 --- a/docs/rules/style-prop-object.md +++ b/docs/rules/style-prop-object.md @@ -1,6 +1,6 @@ # Enforce style prop value is an object (`react/style-prop-object`) - + Require that the value of the prop `style` be an object or a variable that is an object. diff --git a/docs/rules/void-dom-elements-no-children.md b/docs/rules/void-dom-elements-no-children.md index a5b3ceb4ca..21844eee2e 100644 --- a/docs/rules/void-dom-elements-no-children.md +++ b/docs/rules/void-dom-elements-no-children.md @@ -1,6 +1,6 @@ # Disallow void DOM elements (e.g. ``, `
`) from receiving children (`react/void-dom-elements-no-children`) - + There are some HTML elements that are only self-closing (e.g. `img`, `br`, `hr`). These are collectively known as void DOM elements. If you try to give these children, React will give you a warning like: diff --git a/lib/rules/no-unstable-nested-components.js b/lib/rules/no-unstable-nested-components.js index adb97707b0..9b60e496bf 100644 --- a/lib/rules/no-unstable-nested-components.js +++ b/lib/rules/no-unstable-nested-components.js @@ -276,6 +276,12 @@ module.exports = { schema: [{ type: 'object', properties: { + customValidators: { + type: 'array', + items: { + type: 'string', + }, + }, allowAsProps: { type: 'boolean', }, diff --git a/package.json b/package.json index 1e70ae15ef..5fe2b76a64 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "prepack": "npmignore --auto --commentLines=autogenerated", "prelint": "npm run lint:docs", "lint:docs": "markdownlint \"**/*.md\"", - "postlint:docs": "npm run update:eslint-docs --check", + "postlint:docs": "npm run update:eslint-docs -- --check", "lint": "eslint .", "postlint": "npm run type-check", "pretest": "npm run lint", @@ -16,7 +16,7 @@ "posttest": "aud --production", "type-check": "tsc", "unit-test": "istanbul cover node_modules/mocha/bin/_mocha tests/lib/**/*.js tests/util/**/*.js tests/index.js", - "update:eslint-docs": "eslint-doc-generator --ignore-config all --url-configs \"https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs\"" + "update:eslint-docs": "eslint-doc-generator --ignore-config all --config-emoji recommended,💼 --url-configs \"https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs\"" }, "repository": { "type": "git", @@ -56,7 +56,7 @@ "babel-eslint": "^8 || ^9 || ^10.1.0", "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8", "eslint-config-airbnb-base": "^15.0.0", - "eslint-doc-generator": "^0.13.0", + "eslint-doc-generator": "^0.14.0", "eslint-plugin-eslint-plugin": "^2.3.0 || ^3.5.3 || ^4.0.1 || ^5.0.5", "eslint-plugin-import": "^2.26.0", "eslint-remote-tester": "^3.0.0",