eslint-plugin-ecmascript-compat

v3.2.1
ESLint plugin for checking JavaScript code compatibility with target browsers and Node.js versions
browser compatibility compat support javascript ecmascript es lint eslint and 9 more...

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.

npm i eslint-plugin-ecmascript-compat

Metadata

  • MIT
  • >=16.0.0
  • Robat Williams
  • released 3/8/2024

Downloads

Maintainers