Reputation: 2691
I was getting started with Next.js on WebStorm 2022.2.1 Build #WS-222.3739.57. I created a new Next.js project with TypeScript enabled, and that's all.
The error is shown below:
TypeError: this.libOptions.parse is not a function
TypeError: this.libOptions.parse is not a function
at ESLint8Plugin.<anonymous> (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:139:64)
at step (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:44:23)
at Object.next (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:25:53)
at C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:19:71
at new Promise (<anonymous>)
at __awaiter (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:15:12)
at ESLint8Plugin.invokeESLint (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:133:16)
at ESLint8Plugin.<anonymous> (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:120:44)
at step (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:44:23)
at Object.next (C:\Program Files\JetBrains\WebStorm 2022.1.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:25:53)
Process finished with exit code -1
My Node.js version is v16.15.1, and the ESLint version is 8.23.0.
This is what my devDependencies look like;
"devDependencies": {
"@types/node": "18.7.13",
"@types/react": "18.0.17",
"@types/react-dom": "18.0.6",
"eslint": "8.23.0",
"eslint-config-next": "12.2.5",
"prisma": "^4.2.1",
"typescript": "4.8.2"
}
My .eslintrc.json file:
{
"extends": "next/core-web-vitals"
}
Upvotes: 254
Views: 130089
Reputation: 1492
My friends, if you are using Webstorm or any Jetbrains product, you can use this pattern in your eslint settings and it will be fixed for EVER.
Settings (or "Alt + Shift + S")
Search "eslint"
Choose "Automatic ESLint configuration"
Then replace the pattern below with the exist one:
"**/*.(js|ts|jsx|tsx|html|vue)"
Upvotes: 89
Reputation: 459
For me, the other solutions didn't work.
A simple WebStorm update to version 2022.2.3 solved it.
Upvotes: 33
Reputation: 728
Works for me:
{
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "^4.0.1"
},
"devDependencies": {
"eslint": "8.22.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.7.1"
}
}
Upvotes: 0
Reputation: 8176
If you are looking for a temporary fix, you can "pin" ESLint
version to 8.22.0 in your package.json
set it to:
"eslint": "8.22.0"
After that update your project to get back to 8.22 instead of 8.23, i.e.
npm install
Or in one command:
rm -rf node_modules; rm package-lock.json; npm install
Let's hope this issue will be resolved soon
Upvotes: 105
Reputation: 45
I faced the same issue.
This solves it.
npm install [email protected] --save-exact
Upvotes: 2
Reputation: 1616
I was having the same issue as well with ESLint and WebStorm.
Here is the solution:
yarn add [email protected] --save-exact
npm install [email protected] --save-exact
Upvotes: 31
Reputation: 93898
The issue is tracked at WEB-57089, and it is fixed in 2022.2.2 preview build.
The issue is caused by the changes introduced in ESLint 8.23 (offending upstream commit: View on GitHub). Downgrading ESLint to 8.22.x or earlier (with npm install [email protected] --save-exact
) should help.
Upvotes: 346