【发布时间】:2021-06-13 16:13:58
【问题描述】:
我目前正在将应用程序从 CRA 迁移到 Next.js。使用 CRA 时,Eslint 运行良好(eslint 开箱即用)。
我想在 Next.js 应用程序中使用相同的 CRA linting 规则,因此我安装了 eslint-config-react-app。我按照 NPM 页面上提供的说明进行操作:https://www.npmjs.com/package/eslint-config-react-app:
-
npm install --save-dev eslint-config-react-app @typescript-eslint/eslint-plugin@^4.0.0 @typescript-eslint/parser@^4.0.0 babel-eslint@^10.0.0 eslint @^7.5.0 eslint-plugin-flowtype@^5.2.0 eslint-plugin-import@^2.22.0 eslint-plugin-jsx-a11y@^6.3.1 eslint-plugin-react@^7.20.3 eslint-plugin -react-hooks@^4.0.8
-
创建具有以下内容的 .eslintrc.json 文件:
{ "extends": "react-app" }
但是,开发控制台和浏览器控制台中都没有显示 linting。
谢谢!
【问题讨论】:
标签: next.js create-react-app eslint