Could you help me, I've got this error when I try building a project?
Oops! Something went wrong! :(
ESLint: 8.0.0
TypeError: Failed to load plugin '@typescript-eslint' declared in 'src.eslintrc': Class extends value undefined is not a constructor or null Referenced from: src.eslintrc
package.json
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"browserslist": "^4.17.3",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.1",
"prettier": "^2.3.2",
}
.eslintrc
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier"
],
"plugins": ["@typescript-eslint"],
There is probably an ESM compatibility problem with one of the packages, so either you must make sure all your deps are ESM compatible or lock eslint to 7.32.0 & upgrade the plugins as (I'd also recommend to add typescript to your dev deps):
"devDependencies": {
...
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"eslint": "^7.32.0",
"typescript": "^4.4.3"
}
To achieve this you can run:
npm i --save-dev typescript @typescript-eslint/eslint-plugin@5.6.0 @typescript-eslint/parser@5.6.0 eslint@7.32.0
The --save-dev part is to install them as dev deps as they are not required aside from build && dev
I saw this error trying to use version 4.x.x of the @typescript-eslint packages:
"devDependencies": {
...
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
...
}
Fix was to update these to the version "^5.3.1"
I had this issue when my node version wasn't compatible with the react version I was using. Check the logs and update to a compatible version of nodejs
https://github.com/typescript-eslint/typescript-eslint/issues/3982
It seems to be a compatibility problem
I did this and it work just fine for me
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.1.0",
Update those three packages
Then run in the root of your project this command to update the packages
npm i
And it will work fine