252

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"
}

7 Answers 7

345

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.

4
  • 1
    The preview build in the link for Apple silicon is not working as of now. Fix: add -cdn to URL: download-cdn.jetbrains.com/webstorm/… Commented Sep 8, 2022 at 7:01
  • 1
    This does not just occur in ESLint versions 8.23, I am seeing this while on ESlint 8.19
    – Michahell
    Commented Sep 15, 2022 at 9:58
  • 11
    2022.2.2 has been released as stable now. Commented Sep 21, 2022 at 14:27
  • Who can save the guy that the subscription can only upgrade to 2022.1.x, and has to work on the project use ESLint v8.34
    – Wayne Mao
    Commented Sep 26, 2023 at 8:08
106

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.

  • remove node_modules folder
  • clean package-lock.json (by removing it too)
  • run 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

1
  • Or a slightly shorter one-liner: rm -fr node_modules package-lock.json; npm install Commented Sep 14, 2022 at 16:02
85

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.

  1. Settings (or "Alt + Shift + S")

  2. Search "eslint"

  3. Choose "Automatic ESLint configuration"

  4. Then replace the pattern below with the exist one:

    "**/*.(js|ts|jsx|tsx|html|vue)"
    
4
  • 2
    That fixed my Webstorm (2022.2.1) issue with my NextJS 13 project thank you.
    – Harry
    Commented May 12, 2023 at 17:47
  • 1
    This fixed my issue, are there any downsides to this approach?
    – Dejan
    Commented Dec 19, 2023 at 17:42
  • 1
    @Dejan, As far as I checked and using it for a few years, no. Commented Dec 20, 2023 at 10:31
  • 1
    You are the MVP, my bro Commented Mar 14 at 13:40
33

For me, the other solutions didn't work.

A simple WebStorm update to version 2022.2.3 solved it.

4
  • 1
    For me both changing the ESLint version and updating WebStorm worked in two distinct cases this month. So seems like we can choose either solution Commented Oct 31, 2022 at 11:31
  • Worked like a charm with no other change than the ide update. I use PHPStorm btw.
    – Mark E
    Commented Nov 3, 2022 at 4:53
  • I was already at eslint 8.27.0 and had the issue. Upgrading WebStorm helped.
    – noox
    Commented Nov 12, 2022 at 12:29
  • It's incredible but it's true, just the same problem, and updating to the last one (2022.2.4 in my case) the issue was solved. Commented Feb 9, 2023 at 16:34
31

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
2

I faced the same issue.

This solves it.

npm install [email protected] --save-exact
1
  • 3
    Please don't repeat existing answers.
    – isherwood
    Commented Dec 9, 2022 at 19:57
0

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"
    }
} 

Not the answer you're looking for? Browse other questions tagged or ask your own question.