Skip to content

peakchen90/eslint-plugin-react-directives

Repository files navigation

eslint-plugin-react-directives

Build Status node npm peer dependency version npm GitHub

some rules for babel-plugin-react-directives.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-react-directives:

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

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-react-directives globally.

Usage

There are two ways to configure it via .eslintrc:

{
  "plugins": [
    "react-directives"
  ],
  "rules": {
    "no-undef": "off",
    "react-directives/no-undef": "error"
  }
}

or use the recommended rules:

{
  "extends": [
    "plugin:react-directives/recommended"
  ],
  "rules": {
    "no-undef": "off"
  }
}

Settings

If you have configured some options in babel-plugin-react-directives, add settings section to .eslintrc file.

{
  "settings": {
    "react-directives": {
      "prefix": "x"
    }
  }
}

List of supported rules

Shareable configurations

Recommended

This plugin exports a recommended configuration.

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

{
  "extends": [
    "plugin:react-directives/recommended"
  ]
}

The rules enabled in this configuration are: