Guide

npm version Downloads/month Build Status Coverage Status Dependency Status

ESLint rules which disallow each ECMAScript syntax.

🏁 Goal

Espree, the default parser of ESLint, has supported ecmaVersion option. However, it doesn't support to enable each syntactic feature individually. This plugin lets us disable each syntactic feature individually. So we can enable arbitrary syntactic features with the combination of ecmaVersion and this plugin.

💿 Installation

Use npm or yarn.

npm install --save-dev eslint eslint-plugin-es

Requirements

  • Node.js 6.5.0 or newer.
  • ESLint 4.19.1 or newer.

📖 Usage

Configure your .eslintrc.* file.

For example, to enable only Rest/Spread Properties in ES2018, as similar to legacy experimentalObjectRestSpread option:

{
    "plugins": ["es"],
    "parserOptions": {
        "ecmaVersion": 2018
    },
    "rules": {
        "es/no-async-iteration": "error",
        "es/no-malformed-template-literals": "error",
        "es/no-regexp-lookbehind-assertions": "error",
        "es/no-regexp-named-capture-groups": "error",
        "es/no-regexp-s-flag": "error",
        "es/no-regexp-unicode-property-escapes": "error"
    }
}

Presets

This plugin provides the following configs.

Config ID Description
plugin:es/no-2018 enable all rules which disallow ES2018 syntax.
plugin:es/no-2017 enable all rules which disallow ES2017 syntax.
plugin:es/no-2016 enable all rules which disallow ES2016 syntax.
plugin:es/no-2015 enable all rules which disallow ES2015 syntax.
plugin:es/no-5 enable all rules which disallow ES5 syntax.

For example:

{
    "plugins": ["es"],
    "parserOptions": {
        "ecmaVersion": 2018
    },
    "extends": [
        "eslint:recommended",
        "plugin:es/no-2018"
    ],
    "rules": {
        "es/no-rest-spread-properties": "off"
    }
}
Last Updated: 11/19/2018, 9:40:06 AM