eslint-plugin-react
React specific linting rules for ESLint
Last updated 4 months ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-react 
SYNC missed versions from official npm registry.

ESLint-plugin-React

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

React specific linting rules for ESLint

Installation

Install ESLint either locally or globally.

$ npm install eslint --save-dev

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

$ npm install eslint-plugin-react --save-dev

Configuration

Use our preset to get reasonable defaults:

  "extends": [
    "eslint:recommended",
    "plugin:react/recommended"
  ]

You should also specify settings that will be shared across all the plugin rules.

{
  "settings": {
    "react": {
      "createClass": "createReactClass", // Regex for Component Factory to use,
                                         // default to "createReactClass"
      "pragma": "React",  // Pragma to use, default to "React"
      "version": "15.0", // React version, default to the latest React stable release
      "flowVersion": "0.53" // Flow version
    },
    "propWrapperFunctions": [ "forbidExtraProps" ] // The names of any functions used to wrap the
                                                   // propTypes object, e.g. `forbidExtraProps`.
                                                   // If this isn't set, any propTypes wrapped in
                                                   // a function will be skipped.
  }
}

If you do not use a preset you will need to specify individual rules and add extra configuration.

Add "react" to the plugins section.

{
  "plugins": [
    "react"
  ]
}

Enable JSX support.

With ESLint 2+

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

Enable the rules that you would like to use.

  "rules": {
    "react/jsx-uses-react": "error",
    "react/jsx-uses-vars": "error",
  }

List of supported rules

JSX-specific rules

Other useful plugins

Shareable configurations

Recommended

This plugin exports a recommended configuration that enforces React good practices.

To enable this configuration use the extends property in your .eslintrc config file:

{
  "extends": ["eslint:recommended", "plugin:react/recommended"]
}

See ESLint documentation for more information about extending configuration files.

The rules enabled in this configuration are:

All

This plugin also exports an all configuration that includes every available rule. This pairs well with the eslint:all rule.

{
  "plugins": [
    "react"
  ],
  "extends": ["eslint:all", "plugin:react/all"]
}

Note: These configurations will import eslint-plugin-react and enable JSX in parser options.

License

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

Current Tags

  • 7.11.1                                ...           latest (4 months ago)
  • 7.8.0-rc.0                                ...           next (7 months ago)

128 Versions

  • 7.11.1                                ...           4 months ago
  • 7.11.0                                ...           4 months ago
  • 7.10.0                                ...           6 months ago
  • 7.9.1                                ...           6 months ago
  • 7.9.0 [deprecated]           ...           6 months ago
  • 7.8.2                                ...           7 months ago
  • 7.8.1                                ...           7 months ago
  • 7.8.0                                ...           7 months ago
  • 7.8.0-rc.0                                ...           7 months ago
  • 7.7.0                                ...           10 months ago
  • 7.6.1                                ...           a year ago
  • 7.6.0                                ...           a year ago
  • 7.5.1                                ...           a year ago
  • 7.5.0                                ...           a year ago
  • 7.4.0                                ...           a year ago
  • 7.4.0-rc.1                                ...           a year ago
  • 7.4.0-rc.0                                ...           a year ago
  • 7.3.0                                ...           a year ago
  • 7.2.1                                ...           a year ago
  • 7.2.0                                ...           a year ago
  • 7.1.0                                ...           2 years ago
  • 7.0.1                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 7.0.0-rc.1                                ...           2 years ago
  • 7.0.0-rc.0                                ...           2 years ago
  • 6.10.3                                ...           2 years ago
  • 6.10.2                                ...           2 years ago
  • 6.10.1                                ...           2 years ago
  • 6.10.0                                ...           2 years ago
  • 6.9.0                                ...           2 years ago
  • 6.8.0                                ...           2 years ago
  • 6.7.1                                ...           2 years ago
  • 6.7.0                                ...           2 years ago
  • 6.6.0                                ...           2 years ago
  • 6.5.0                                ...           2 years ago
  • 6.4.1                                ...           2 years ago
  • 6.4.0                                ...           2 years ago
  • 6.3.0                                ...           2 years ago
  • 6.2.2                                ...           2 years ago
  • 6.2.1                                ...           2 years ago
  • 6.2.0                                ...           2 years ago
  • 6.1.2                                ...           2 years ago
  • 6.1.1                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 6.0.0-rc.1                                ...           2 years ago
  • 6.0.0-rc.0                                ...           2 years ago
  • 6.0.0-alpha.2                                ...           2 years ago
  • 6.0.0-alpha.1                                ...           2 years ago
  • 5.2.2                                ...           2 years ago
  • 5.2.1                                ...           3 years ago
  • 5.2.0                                ...           3 years ago
  • 5.1.1                                ...           3 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.1                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.3.0                                ...           3 years ago
  • 4.2.3                                ...           3 years ago
  • 4.2.2                                ...           3 years ago
  • 4.2.1                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 4.0.0-rc.1                                ...           3 years ago
  • 4.0.0-rc.0                                ...           3 years ago
  • 3.16.1                                ...           3 years ago
  • 3.16.0                                ...           3 years ago
  • 3.15.0                                ...           3 years ago
  • 3.14.0                                ...           3 years ago
  • 3.13.1                                ...           3 years ago
  • 3.13.0                                ...           3 years ago
  • 3.12.0                                ...           3 years ago
  • 3.11.3                                ...           3 years ago
  • 3.11.2                                ...           3 years ago
  • 3.11.1                                ...           3 years ago
  • 3.11.0                                ...           3 years ago
  • 3.10.0                                ...           3 years ago
  • 3.9.0                                ...           3 years ago
  • 3.8.0                                ...           3 years ago
  • 3.7.1                                ...           3 years ago
  • 3.7.0                                ...           3 years ago
  • 3.6.3                                ...           3 years ago
  • 3.6.2                                ...           3 years ago
  • 3.6.1                                ...           3 years ago
  • 3.6.0                                ...           3 years ago
  • 3.5.1                                ...           3 years ago
  • 3.5.0                                ...           3 years ago
  • 3.4.2                                ...           3 years ago
  • 3.4.1                                ...           3 years ago
  • 3.4.0                                ...           3 years ago
  • 3.3.2                                ...           3 years ago
  • 3.3.1                                ...           3 years ago
  • 3.3.0                                ...           3 years ago
  • 3.2.3                                ...           3 years ago
  • 3.2.2                                ...           3 years ago
  • 3.2.1                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.7.1                                ...           3 years ago
  • 2.7.0                                ...           3 years ago
  • 2.6.4                                ...           3 years ago
  • 2.6.3                                ...           3 years ago
  • 2.6.2                                ...           3 years ago
  • 2.6.1                                ...           3 years ago
  • 2.6.0                                ...           3 years ago
  • 2.5.2                                ...           4 years ago
  • 2.5.1                                ...           4 years ago
  • 2.5.0                                ...           4 years ago
  • 2.4.0                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.6.1                                ...           4 years ago
  • 1.6.0                                ...           4 years ago
  • 1.5.0                                ...           4 years ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.2                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 127
This Week 127
This Month 67,727
Last Day 1,255
Last Week 31,379
Last Month 128,505
Dependencies (5)
Dev Dependencies (5)
Dependents (5803)

Copyright 2014 - 2016 © taobao.org |