eslint-plugin-react

  • Version 7.37.5
  • Published
  • 938 kB
  • 18 dependencies
  • MIT license

Install

npm i eslint-plugin-react
yarn add eslint-plugin-react
pnpm add eslint-plugin-react

Overview

React specific linting rules for ESLint

Index

Variables

variable allRules

const allRules: {
'boolean-prop-naming': any;
'button-has-type': any;
'checked-requires-onchange-or-readonly': any;
'default-props-match-prop-types': any;
'destructuring-assignment': any;
'display-name': any;
'forbid-component-props': any;
'forbid-dom-props': any;
'forbid-elements': any;
'forbid-foreign-prop-types': any;
'forbid-prop-types': any;
'forward-ref-uses-ref': any;
'function-component-definition': any;
'hook-use-state': any;
'iframe-missing-sandbox': any;
'jsx-boolean-value': any;
'jsx-child-element-spacing': any;
'jsx-closing-bracket-location': any;
'jsx-closing-tag-location': any;
'jsx-curly-spacing': any;
'jsx-curly-newline': any;
'jsx-equals-spacing': any;
'jsx-filename-extension': any;
'jsx-first-prop-new-line': any;
'jsx-handler-names': any;
'jsx-indent': any;
'jsx-indent-props': any;
'jsx-key': any;
'jsx-max-depth': any;
'jsx-max-props-per-line': any;
'jsx-newline': any;
'jsx-no-bind': any;
'jsx-no-comment-textnodes': any;
'jsx-no-constructed-context-values': any;
'jsx-no-duplicate-props': any;
'jsx-no-leaked-render': any;
'jsx-no-literals': any;
'jsx-no-script-url': any;
'jsx-no-target-blank': any;
'jsx-no-useless-fragment': any;
'jsx-one-expression-per-line': any;
'jsx-no-undef': any;
'jsx-curly-brace-presence': any;
'jsx-pascal-case': any;
'jsx-fragments': any;
'jsx-props-no-multi-spaces': any;
'jsx-props-no-spreading': any;
'jsx-props-no-spread-multi': any;
'jsx-sort-default-props': any;
'jsx-sort-props': any;
'jsx-space-before-closing': any;
'jsx-tag-spacing': any;
'jsx-uses-react': any;
'jsx-uses-vars': any;
'jsx-wrap-multilines': any;
'no-invalid-html-attribute': any;
'no-access-state-in-setstate': any;
'no-adjacent-inline-elements': any;
'no-array-index-key': any;
'no-arrow-function-lifecycle': any;
'no-children-prop': any;
'no-danger': any;
'no-danger-with-children': any;
'no-deprecated': any;
'no-did-mount-set-state': any;
'no-did-update-set-state': any;
'no-direct-mutation-state': any;
'no-find-dom-node': any;
'no-is-mounted': any;
'no-multi-comp': any;
'no-namespace': any;
'no-set-state': any;
'no-string-refs': any;
'no-redundant-should-component-update': any;
'no-render-return-value': any;
'no-this-in-sfc': any;
'no-typos': any;
'no-unescaped-entities': any;
'no-unknown-property': any;
'no-unsafe': any;
'no-unstable-nested-components': any;
'no-unused-class-component-methods': any;
'no-unused-prop-types': any;
'no-unused-state': any;
'no-object-type-as-default-prop': any;
'no-will-update-set-state': any;
'prefer-es6-class': any;
'prefer-exact-props': any;
'prefer-read-only-props': any;
'prefer-stateless-function': any;
'prop-types': any;
'react-in-jsx-scope': any;
'require-default-props': any;
'require-optimization': any;
'require-render-return': any;
'self-closing-comp': any;
'sort-comp': any;
'sort-default-props': any;
'sort-prop-types': any;
'state-in-constructor': any;
'static-property-placement': any;
'style-prop-object': any;
'void-dom-elements-no-children': any;
};

    variable configs

    const configs: {
    recommended: {
    plugins: ['react'];
    parserOptions: { ecmaFeatures: { jsx: boolean } };
    rules: {
    'react/display-name': 2;
    'react/jsx-key': 2;
    'react/jsx-no-comment-textnodes': 2;
    'react/jsx-no-duplicate-props': 2;
    'react/jsx-no-target-blank': 2;
    'react/jsx-no-undef': 2;
    'react/jsx-uses-react': 2;
    'react/jsx-uses-vars': 2;
    'react/no-children-prop': 2;
    'react/no-danger-with-children': 2;
    'react/no-deprecated': 2;
    'react/no-direct-mutation-state': 2;
    'react/no-find-dom-node': 2;
    'react/no-is-mounted': 2;
    'react/no-render-return-value': 2;
    'react/no-string-refs': 2;
    'react/no-unescaped-entities': 2;
    'react/no-unknown-property': 2;
    'react/no-unsafe': 0;
    'react/prop-types': 2;
    'react/react-in-jsx-scope': 2;
    'react/require-render-return': 2;
    };
    };
    all: {
    plugins: ['react'];
    parserOptions: { ecmaFeatures: { jsx: boolean } };
    rules: Record<
    | 'boolean-prop-naming'
    | 'button-has-type'
    | 'checked-requires-onchange-or-readonly'
    | 'default-props-match-prop-types'
    | 'destructuring-assignment'
    | 'display-name'
    | 'forbid-component-props'
    | 'forbid-dom-props'
    | 'forbid-elements'
    | 'forbid-foreign-prop-types'
    | 'forbid-prop-types'
    | 'prop-types'
    | 'forward-ref-uses-ref'
    | 'function-component-definition'
    | 'hook-use-state'
    | 'iframe-missing-sandbox'
    | 'jsx-boolean-value'
    | 'jsx-child-element-spacing'
    | 'jsx-closing-bracket-location'
    | 'jsx-closing-tag-location'
    | 'jsx-curly-spacing'
    | 'jsx-curly-newline'
    | 'jsx-equals-spacing'
    | 'jsx-filename-extension'
    | 'jsx-first-prop-new-line'
    | 'jsx-handler-names'
    | 'jsx-indent'
    | 'jsx-indent-props'
    | 'jsx-key'
    | 'jsx-max-depth'
    | 'jsx-max-props-per-line'
    | 'jsx-newline'
    | 'jsx-no-bind'
    | 'jsx-no-comment-textnodes'
    | 'jsx-no-constructed-context-values'
    | 'jsx-no-duplicate-props'
    | 'jsx-no-leaked-render'
    | 'jsx-no-literals'
    | 'jsx-no-script-url'
    | 'jsx-no-target-blank'
    | 'jsx-no-useless-fragment'
    | 'jsx-one-expression-per-line'
    | 'jsx-no-undef'
    | 'jsx-curly-brace-presence'
    | 'jsx-pascal-case'
    | 'jsx-fragments'
    | 'jsx-props-no-multi-spaces'
    | 'jsx-props-no-spreading'
    | 'jsx-props-no-spread-multi'
    | 'sort-default-props'
    | 'jsx-sort-default-props'
    | 'jsx-sort-props'
    | 'jsx-tag-spacing'
    | 'jsx-space-before-closing'
    | 'jsx-uses-react'
    | 'jsx-uses-vars'
    | 'jsx-wrap-multilines'
    | 'no-invalid-html-attribute'
    | 'no-access-state-in-setstate'
    | 'no-adjacent-inline-elements'
    | 'no-array-index-key'
    | 'no-arrow-function-lifecycle'
    | 'no-children-prop'
    | 'no-danger'
    | 'no-danger-with-children'
    | 'no-deprecated'
    | 'no-direct-mutation-state'
    | 'no-find-dom-node'
    | 'no-is-mounted'
    | 'no-multi-comp'
    | 'no-namespace'
    | 'no-set-state'
    | 'no-string-refs'
    | 'no-redundant-should-component-update'
    | 'no-render-return-value'
    | 'no-this-in-sfc'
    | 'no-typos'
    | 'no-unescaped-entities'
    | 'no-unknown-property'
    | 'no-unsafe'
    | 'no-unstable-nested-components'
    | 'no-unused-class-component-methods'
    | 'no-unused-prop-types'
    | 'no-unused-state'
    | 'no-object-type-as-default-prop'
    | 'prefer-es6-class'
    | 'prefer-exact-props'
    | 'prefer-read-only-props'
    | 'prefer-stateless-function'
    | 'react-in-jsx-scope'
    | 'require-default-props'
    | 'require-optimization'
    | 'require-render-return'
    | 'self-closing-comp'
    | 'sort-comp'
    | 'sort-prop-types'
    | 'state-in-constructor'
    | 'static-property-placement'
    | 'style-prop-object'
    | 'void-dom-elements-no-children'
    | 'no-did-mount-set-state'
    | 'no-did-update-set-state'
    | 'no-will-update-set-state',
    2 | 'error'
    >;
    };
    'jsx-runtime': {
    plugins: ['react'];
    parserOptions: { ecmaFeatures: { jsx: boolean }; jsxPragma: any };
    rules: { 'react/react-in-jsx-scope': 0; 'react/jsx-uses-react': 0 };
    };
    flat: Record<string, ReactFlatConfig>;
    };

      variable deprecatedRules

      const deprecatedRules: Partial<{
      'boolean-prop-naming': any;
      'button-has-type': any;
      'checked-requires-onchange-or-readonly': any;
      'default-props-match-prop-types': any;
      'destructuring-assignment': any;
      'display-name': any;
      'forbid-component-props': any;
      'forbid-dom-props': any;
      'forbid-elements': any;
      'forbid-foreign-prop-types': any;
      'forbid-prop-types': any;
      'forward-ref-uses-ref': any;
      'function-component-definition': any;
      'hook-use-state': any;
      'iframe-missing-sandbox': any;
      'jsx-boolean-value': any;
      'jsx-child-element-spacing': any;
      'jsx-closing-bracket-location': any;
      'jsx-closing-tag-location': any;
      'jsx-curly-spacing': any;
      'jsx-curly-newline': any;
      'jsx-equals-spacing': any;
      'jsx-filename-extension': any;
      'jsx-first-prop-new-line': any;
      'jsx-handler-names': any;
      'jsx-indent': any;
      'jsx-indent-props': any;
      'jsx-key': any;
      'jsx-max-depth': any;
      'jsx-max-props-per-line': any;
      'jsx-newline': any;
      'jsx-no-bind': any;
      'jsx-no-comment-textnodes': any;
      'jsx-no-constructed-context-values': any;
      'jsx-no-duplicate-props': any;
      'jsx-no-leaked-render': any;
      'jsx-no-literals': any;
      'jsx-no-script-url': any;
      'jsx-no-target-blank': any;
      'jsx-no-useless-fragment': any;
      'jsx-one-expression-per-line': any;
      'jsx-no-undef': any;
      'jsx-curly-brace-presence': any;
      'jsx-pascal-case': any;
      'jsx-fragments': any;
      'jsx-props-no-multi-spaces': any;
      'jsx-props-no-spreading': any;
      'jsx-props-no-spread-multi': any;
      'jsx-sort-default-props': any;
      'jsx-sort-props': any;
      'jsx-space-before-closing': any;
      'jsx-tag-spacing': any;
      'jsx-uses-react': any;
      'jsx-uses-vars': any;
      'jsx-wrap-multilines': any;
      'no-invalid-html-attribute': any;
      'no-access-state-in-setstate': any;
      'no-adjacent-inline-elements': any;
      'no-array-index-key': any;
      'no-arrow-function-lifecycle': any;
      'no-children-prop': any;
      'no-danger': any;
      'no-danger-with-children': any;
      'no-deprecated': any;
      'no-did-mount-set-state': any;
      'no-did-update-set-state': any;
      'no-direct-mutation-state': any;
      'no-find-dom-node': any;
      'no-is-mounted': any;
      'no-multi-comp': any;
      'no-namespace': any;
      'no-set-state': any;
      'no-string-refs': any;
      'no-redundant-should-component-update': any;
      'no-render-return-value': any;
      'no-this-in-sfc': any;
      'no-typos': any;
      'no-unescaped-entities': any;
      'no-unknown-property': any;
      'no-unsafe': any;
      'no-unstable-nested-components': any;
      'no-unused-class-component-methods': any;
      'no-unused-prop-types': any;
      'no-unused-state': any;
      'no-object-type-as-default-prop': any;
      'no-will-update-set-state': any;
      'prefer-es6-class': any;
      'prefer-exact-props': any;
      'prefer-read-only-props': any;
      'prefer-stateless-function': any;
      'prop-types': any;
      'react-in-jsx-scope': any;
      'require-default-props': any;
      'require-optimization': any;
      'require-render-return': any;
      'self-closing-comp': any;
      'sort-comp': any;
      'sort-default-props': any;
      'sort-prop-types': any;
      'state-in-constructor': any;
      'static-property-placement': any;
      'style-prop-object': any;
      'void-dom-elements-no-children': any;
      }>;
      • {Partial<typeof allRules>}

      variable plugin

      const plugin: {
      deprecatedRules: typeof deprecatedRules;
      rules: typeof allRules;
      configs: typeof configs & { flat: Record<string, ReactFlatConfig> };
      };
      • {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat: Record<string, ReactFlatConfig> }}}

      Type Aliases

      type ReactFlatConfig

      type ReactFlatConfig = {
      plugins: {
      react: typeof plugin;
      };
      rules: import('eslint').Linter.RulesRecord;
      languageOptions: {
      parserOptions: import('eslint').Linter.ParserOptions;
      };
      };

        Package Files (1)

        Dependencies (18)

        Dev Dependencies (31)

        Peer Dependencies (1)

        Badge

        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/eslint-plugin-react.

        • Markdown
          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/eslint-plugin-react)
        • HTML
          <a href="https://www.jsdocs.io/package/eslint-plugin-react"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>