Skip to content

samsch/eslint-plugin-inferno

 
 

Repository files navigation

ESLint-plugin-Inferno

Note: This is a fork of the great eslint-plugin-inferno.

Inferno specific linting rules for ESLint Rules are mostly same, but propType related rules have been removed.

Installation

Install ESLint either locally or globally.

$ npm install eslint --save-dev

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

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

Configuration

Use our preset to get reasonable defaults:

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

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

{
  "settings": {
    "inferno": {
      "createClass": "createClass", // Regex for Component Factory to use, // default to "createClass"
      "pragma": "Inferno",  // Inferno to use, default to "Inferno"
    },
    "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 "inferno" to the plugins section.

{
  "plugins": [
    "inferno"
  ]
}

Enable JSX support.

With ESLint 2+

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

Enable the rules that you would like to use.

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

List of rules NOT part of inferno

These rules have been removed, because they are invalid in Inferno

List of supported rules

JSX-specific rules

Other useful plugins

Shareable configurations

Recommended

This plugin exports a recommended configuration that enforce Inferno good practices.

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

{
  "extends": ["eslint:recommended", "plugin:inferno/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": [
    "inferno"
  ],
  "extends": ["eslint:all", "plugin:inferno/all"]
}

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

License

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

About

Inferno specific linting rules for ESLint

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%