我有一个使用jest和react-testing-library进行测试的Nextjs应用程序,我使用npx .eslintrc --init命令将.eslintrc文件添加到我的项目中。每当我对项目进行lint时,我都会得到以下错误:
.eslintrc.js:
module.exports = {
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"next",
"next/core-web-vitals"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project":"./tsconfig.json",
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
}};
和错误:
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
Error: Failed to load config "next" to extend from.
Referenced from: D:\web\reactjs\react-testing\react-testing-app\.eslintrc.js发布于 2021-10-08 12:46:53
已解决,在安装此程序包后,代码将运行,不会出现错误:
npm i --save-dev eslint-config-nexthttps://stackoverflow.com/questions/69480558
复制相似问题