Skip to content

Latest commit

 

History

History
55 lines (44 loc) · 1.86 KB

File metadata and controls

55 lines (44 loc) · 1.86 KB

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.