{"id":19741,"library":"eslint-plugin-escompat","title":"eslint-plugin-escompat","description":"ESLint plugin (v3.11.4) that reports errors for JavaScript/TypeScript syntax which, if left untranspiled, will not work in target browsers, as defined by a Browserslist config. Unlike eslint-plugin-compat (which checks for missing polyfills), this focuses on native syntax incompatibilities. It ships with recommended configs for browser code and separate TypeScript configs per ECMAScript target year. Integrates with both legacy .eslintrc and flat eslint.config.js formats. Actively maintained with multiple releases per year since initial release.","status":"active","version":"3.11.4","language":"javascript","source_language":"en","source_url":"https://github.com/keithamus/eslint-plugin-escompat","tags":["javascript"],"install":[{"cmd":"npm install eslint-plugin-escompat","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-escompat","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-escompat","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin requires ESLint >=5.14.1","package":"eslint","optional":false}],"imports":[{"note":"ESM import used in flat config; CommonJS require works with .eslintrc in ESLint <9.","wrong":"const escompat = require('eslint-plugin-escompat')","symbol":"default","correct":"import escompat from 'eslint-plugin-escompat'"},{"note":"Flat config is an object, not an array; extend in export default array.","wrong":"using escompat.configs['flat/recommended'] without spreading or in .eslintrc","symbol":"escompat.configs['flat/recommended']","correct":"import escompat from 'eslint-plugin-escompat'; export default [{ ... }, escompat.configs['flat/recommended']]"},{"note":"TypeScript flat configs are arrays; must spread them into config array.","wrong":"escompat.configs['flat/typescript-2020'] without spread operator","symbol":"escompat.configs['flat/typescript-2020']","correct":"import escompat from 'eslint-plugin-escompat'; export default [{ ... }, ...escompat.configs['flat/typescript-2020']]"}],"quickstart":{"code":"// eslint.config.js\nimport globals from 'globals';\nimport escompat from 'eslint-plugin-escompat';\n\nexport default [\n    {\n        plugins: { escompat },\n        languageOptions: { globals: globals.browser },\n        rules: {\n            'escompat/no-async-generator': 'error',\n            'escompat/no-numeric-separators': 'error',\n        }\n    }\n];","lang":"javascript","description":"Flat config example enabling two escompat rules with browser globals."},"warnings":[{"fix":"Update to v3.11.2 or later.","message":"v3.11.2 fixed a breaking change where Browserslist API broke `this` context in custom browserslist configs.","severity":"breaking","affected_versions":"3.11.0, 3.11.1"},{"fix":"Migrate to flat config (eslint.config.js) using eslint-plugin-escompat's flat configs.","message":".eslintrc (non-flat) config style is deprecated in ESLint 9; only flat config is recommended going forward.","severity":"deprecated","affected_versions":">=3.11.0"},{"fix":"Add a browserslist to your project (e.g., 'last 1 version') or define it in a config file.","message":"Rules are only effective if you have a browserslist configured in package.json or .browserslistrc. Without one, all rules are disabled.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use both eslint-plugin-escompat and eslint-plugin-compat for full coverage.","message":"The 'recommended' config only enables rules that cover syntax not yet widely supported; it may not catch all potential incompatibilities. Always pair with eslint-plugin-compat for polyfill checks.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev eslint-plugin-escompat' and ensure the plugin is listed as 'escompat' in plugins.","cause":"Missing eslint-plugin-escompat package or incorrect plugin name in config.","error":"Error: Failed to load plugin 'escompat' declared in '.eslintrc'"},{"fix":"Check that the plugin is correctly loaded and the rule name matches exactly (e.g., 'no-async-generator', not 'no-async-generator-something').","cause":"Rule is not recognized; either the plugin is not loaded, or the rule name is misspelled.","error":"Configuration for rule 'escompat/no-async-generator' is invalid"},{"fix":"Update to latest version: 'npm update eslint-plugin-escompat' and verify available rules in documentation.","cause":"The rule does not exist in the plugin version installed.","error":"Definition for rule 'escompat/no-*' was not found"},{"fix":"Ensure browserlist is defined properly in package.json or .browserslistrc (e.g., 'last 1 version').","cause":"Possibly related to a missing or malformed browserslist config causing rule parsing to fail.","error":"TypeError: Cannot read properties of undefined (reading 'includes')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}