next.js - 错误:无法加载配置“下一个”以从
问题描述
我有一个使用 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
解决方案
已解决,安装此包后,代码运行无错误:
npm i --save-dev eslint-config-next
推荐阅读
- objective-c - 将 QR 导出到矢量 NSImage 和 CGPDFContextCreate - macOS ObjC
- email - PID 相关的全局配置值?
- rust - `TcpStream::connect` 冻结 `tokio` 一秒钟
- tensorflow - 模型中无法识别 Input_shape
- python-3.x - 将大型 sas 文件读入块
- rest - 如何从露天获得 Json 响应
- c++ - C ++ - 将小数点后面的数字作为int
- azure-devops - 如何在ARM模板azure中使用if else
- amazon-web-services - 如何将 ip 范围添加到 aws?
- javascript - JS中的对象数组分组问题