JSPM

  • Created
  • Published
  • Downloads 23753055
  • Score
    100M100P100Q217115F
  • License MIT

React specific linting rules for ESLint

Package Exports

  • eslint-plugin-react
  • eslint-plugin-react/lib/rules/jsx-boolean-value
  • eslint-plugin-react/lib/rules/jsx-curly-spacing
  • eslint-plugin-react/lib/rules/jsx-indent-props
  • eslint-plugin-react/lib/rules/jsx-no-duplicate-props
  • eslint-plugin-react/lib/rules/jsx-no-literals
  • eslint-plugin-react/lib/rules/jsx-no-undef
  • eslint-plugin-react/lib/rules/jsx-sort-props
  • eslint-plugin-react/lib/rules/jsx-uses-react
  • eslint-plugin-react/lib/rules/jsx-uses-vars
  • eslint-plugin-react/lib/rules/no-danger
  • eslint-plugin-react/lib/rules/no-did-mount-set-state
  • eslint-plugin-react/lib/rules/no-did-update-set-state
  • eslint-plugin-react/lib/rules/no-set-state
  • eslint-plugin-react/lib/rules/no-unknown-property
  • eslint-plugin-react/lib/rules/prop-types
  • eslint-plugin-react/lib/rules/react-in-jsx-scope
  • eslint-plugin-react/lib/rules/self-closing-comp
  • eslint-plugin-react/lib/util/variable

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ESLint-plugin-React

Maintenance Status NPM version Build Status Dependency Status Coverage Status Code Climate

React specific linting rules for ESLint

Installation

Install ESLint either locally or globally.

$ npm install eslint

If you installed ESLint globally, you have to install React plugin globally too. Otherwise, install it locally.

$ npm install eslint-plugin-react

Configuration

Add plugins section and specify ESLint-plugin-React as a plugin.

{
  "plugins": [
    "react"
  ]
}

If it is not already the case you must also configure ESLint to support JSX.

{
  "ecmaFeatures": {
    "jsx": true
  }
}

Finally, enable all of the rules that you would like to use.

{
  "rules": {
    "react/display-name": 1,
    "react/jsx-boolean-value": 1,
    "react/jsx-closing-bracket-location": 1,
    "react/jsx-curly-spacing": 1,
    "react/jsx-indent-props": 1,
    "react/jsx-max-props-per-line": 1,
    "react/jsx-no-duplicate-props": 1,
    "react/jsx-no-undef": 1,
    "react/jsx-quotes": 1,
    "react/jsx-sort-prop-types": 1,
    "react/jsx-sort-props": 1,
    "react/jsx-uses-react": 1,
    "react/jsx-uses-vars": 1,
    "react/no-danger": 1,
    "react/no-did-mount-set-state": 1,
    "react/no-did-update-set-state": 1,
    "react/no-multi-comp": 1,
    "react/no-set-state": 1,
    "react/no-unknown-property": 1,
    "react/prop-types": 1,
    "react/react-in-jsx-scope": 1,
    "react/require-extension": 1,
    "react/self-closing-comp": 1,
    "react/sort-comp": 1,
    "react/wrap-multilines": 1
  }
}

List of supported rules

To Do

Any rule idea is welcome !

License

ESLint-plugin-React is licensed under the MIT License.