最佳答案
我在WebStorm 2022.2.1 Build#WS-222.3739.57上开始使用next.JS. 我创建了一个启用了TypeScript的新Next.JS项目,仅此而已。
错误显示如下:
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
我的node.JS版本是v16.15.1,eslint版本是8.23.0。
这就是我的DevDependencies的样子。
"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"
}
我的。eslintrc.json文件:
{
"extends": "next/core-web-vitals"
}