eslint-plugin-erasable-syntax-only

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

ESLint plugin to granularly enforce TypeScript's erasableSyntaxOnly flag. Current stable version 0.4.0. Requires Node.js >=20.18.0, ESLint >=9, @typescript-eslint/parser >=8, and TypeScript >=5. Differentiators: provides individual rules (enums, namespaces, parameter properties, import aliases) instead of a single blanket flag, enabling incremental adoption, editor suggestions, and type-aware enforcement. Recommended config includes all rules set to error. Active development with semver releases.

error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-plugin-erasable-syntax-only/dist/index.js from /path/to/.eslintrc.cjs not supported.
cause Package is ESM-only; CommonJS require is not allowed.
fix
Convert your ESLint config to ESM (flat config) and use import syntax, or ensure your bundler supports ESM.
error ESLint: Failed to load plugin 'erasable-syntax-only' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-erasable-syntax-only'
cause Plugin not installed, or ESLint version too old.
fix
Run 'npm install eslint-plugin-erasable-syntax-only --save-dev' and ensure ESLint >=9.
breaking Requires Node.js >=20.18.0; earlier versions will fail.
fix Update Node.js to version >=20.18.0.
breaking Requires ESLint >=9 (flat config only); not compatible with ESLint 8 or eslintrc.
fix Upgrade ESLint to v9 or later, and migrate to flat config.
deprecated v0.2.0 and earlier had minimal rule set; upgrade to latest for full feature set.
fix Update to >=0.3.0 to include import-aliases and parameter-properties rules.
npm install eslint-plugin-erasable-syntax-only
yarn add eslint-plugin-erasable-syntax-only
pnpm add eslint-plugin-erasable-syntax-only

Shows how to add the plugin's recommended config to a flat ESLint configuration using typescript-eslint.

import eslint from '@eslint/js';
import erasableSyntaxOnly from 'eslint-plugin-erasable-syntax-only';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  eslint.configs.recommended,
  tseslint.configs.recommended,
  erasableSyntaxOnly.configs.recommended, // 👈
);

// Then run ESLint on your TypeScript files