I wanted to use Array.prototype.at()
from es2022 but typescript told me I should set the lib property of the tsconfig to es2022 if I wanted to use it. I did and it works and it compiles.
However, now eslint is giving me an error at the top of every TS files.
Parsing error: Invalid value for lib provided: es2022eslint
I found surprisingly very little information about that error on the net. I saw similar questions asked there and there but that didn't helped me.
Here is my tsconfig:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"strictNullChecks": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2020",
"module": "es2020",
"lib": ["es2022", "dom"],
"paths": {
"@app/*": ["src/app/*"],
"@env/*": ["src/environments/*"]
}
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
Here is the relevant part of my .eslintrc.json:
"parserOptions": {
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"createDefaultProgram": true,
"ecmaVersion": "latest"
},
I tried to set ecmaVersion
to 2021, 2022 and latest but that error keeps poping.
Is there a way to tell eslint to ignore that error ? or disable that check ? The project compiles fine.
Check your @typescript-eslint/eslint-plugin version. If your typescript version is newer than @typescript-eslint/eslint-plugin shows that error.