3.2.1 • Published 1 month ago

eslint-plugin-ecmascript-compat v3.2.1

Weekly downloads
54
License
MIT
Repository
github
Last release
1 month ago

npm version npm downloads

eslint-plugin-ecmascript-compat

ESLint plugin for checking JavaScript code compatibility with target browsers and Node.js versions

npm install --save-dev eslint-plugin-ecmascript-compat
// .eslintrc.json
{
  "extends": ["plugin:ecmascript-compat/recommended"]
}

// Alternatively
{
  "plugins": ["ecmascript-compat"],
  "rules": {
    "ecmascript-compat/compat": [
      "error",
      {
        // Optionally, specify provided polyfills
        "polyfills": [
          "Array.prototype.includes"
        ],
        // Optionally, provide a browserslist to use instead of the project one
        "overrideBrowserslist": "IE >= 11",
        // Optionally, specify browserslist options - see https://github.com/browserslist/browserslist#js-api
        "browserslistOptions": { "env": "legacy" }
      }
    ]
  }
}
// .browserslistrc
Chrome >= 64
Firefox >= 58

The optional polyfills option is used to specify polyfills that your application loads. These features are therefore considered supported in all browsers. Features that are polyfillable and can be specified here can be found in the rule schema.

For example usage, see sibling directory: eslint-plugin-ecmascript-compat-example

➡ For more information, see the main readme.