eslint-plugin-es-x

raw JSON →
9.6.0 verified Sat Apr 25 auth: no javascript

ESLint plugin that disallows individual ECMAScript syntactic features from ES3 to upcoming proposals. Version 9.6.0 requires ESLint >=9.29.0 and Node.js ^20.19.0 || >=22.12.0. Actively maintained by eslint-community as a fork of the deprecated eslint-plugin-es. Provides 128+ granular rules to restrict specific syntax (e.g., BigInt, optional chaining, top-level await) with readable error messages. Ships TypeScript type declarations, flat config support, and predefined configs like 'no-new-in-es2023'. Unlike setting ecmaVersion in Espree, this plugin allows selective feature bans and gives clear feedback for restricted syntax.

error Cannot find module 'eslint-plugin-es-x'
cause Package not installed or wrong import path.
fix
Run: npm install eslint-plugin-es-x --save-dev
error Error [ERR_REQUIRE_ESM]: require() of ES Module
cause Using CommonJS require() with ESM-only package.
fix
Change to import statement: import plugin from 'eslint-plugin-es-x'
error ESLint couldn't find the plugin 'es-x'
cause Flat config not configured correctly.
fix
Add to plugins object: import plugin from 'eslint-plugin-es-x'; export default [{ plugins: { 'es-x': plugin } }]
error Definition for rule 'es-x/no-bigint' was not found
cause Typo in rule name or missing plugin registration.
fix
Ensure rule name is 'es-x/no-bigint' (not 'no-bigint') and plugin is registered.
breaking v9.0.0 drops support for ESLint <9.29.0 and Node.js <20.19.0.
fix Upgrade ESLint to >=9.29.0 and Node.js to ^20.19.0 || >=22.12.0.
breaking v9.0.0 changes 'no-new-in-es2020' and 'restrict-to-es3' through 'restrict-to-es2019' configs – rules may be added or removed.
fix Review updated configs and adjust rule overrides.
deprecated Legacy .eslintrc configs are deprecated; use flat config (eslint.config.js) for ESLint >=9.
fix Migrate to flat config format.
gotcha Plugin rules are prefixed with 'es-x/', not 'esx/' or 'es2015/'.
fix Use rule names like 'es-x/no-arrow-functions'.
gotcha Config names are under 'configs' export, not directly on plugin – e.g., plugin.configs['no-new-in-es2023'].
fix Access configs via plugin.configs object.
npm install eslint-plugin-es-x
yarn add eslint-plugin-es-x
pnpm add eslint-plugin-es-x

Sets up eslint-plugin-es-x with flat config in an ESM project, forbidding BigInt and optional chaining.

import plugin from 'eslint-plugin-es-x';

export default [
  {
    plugins: {
      'es-x': plugin
    },
    rules: {
      'es-x/no-bigint': 'error',
      'es-x/no-optional-chaining': 'error'
    }
  }
];