Typescript is launching --erasableSyntaxOnly flag in v5.8 that will throw an error if you use things like enum
or parameter properties in classes (see article for more details).
When I enable that flag, I get so many errors that I won't be able to fix it all at once.
So I wanted a ESLint rule that can warn me when using invalid syntax so I can do a incremental removal of this syntax before enabling the flag in tsconfig.
What is the ESLint rule for this? If it doesn't exist, is there a way to do it using no-restricted-syntax
?
Typescript is launching --erasableSyntaxOnly flag in v5.8 that will throw an error if you use things like enum
or parameter properties in classes (see article for more details).
When I enable that flag, I get so many errors that I won't be able to fix it all at once.
So I wanted a ESLint rule that can warn me when using invalid syntax so I can do a incremental removal of this syntax before enabling the flag in tsconfig.
What is the ESLint rule for this? If it doesn't exist, is there a way to do it using no-restricted-syntax
?
1 Answer
Reset to default 0Yes, there is a plugin for this now, eslint-plugin-erasable-syntax-only
. To use it, install it as a dev dependency:
npm i eslint-plugin-erasable-syntax-only -D
Then add its recommended configuration in your ESLint config file:
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, //