eslint-plugin-ecmascript-compat

3.2.1 • Public • Published

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.

Package Sidebar

Install

npm i eslint-plugin-ecmascript-compat

Weekly Downloads

2,657

Version

3.2.1

License

MIT

Unpacked Size

65.2 kB

Total Files

33

Last publish

Collaborators

  • robatwilliams