create-react-app - 覆盖 CRA 基本 linting 规则
问题描述
我有一个使用 create-react-app 创建的应用程序。我需要从默认的 CRA Lint 规则中禁用一条规则:
"react-hooks/exhaustive-deps": 0
在检查了有关该主题的所有资源后,我仍然无法禁用该规则。我制作了一个 .env 文件,EXTEND_ESLINT=true
并在根目录的 .eslintrc 中包含以下内容
{
"eslintConfig": {
"extends": ["react-app"],
"overrides": [
{
"rules": {
"react-hooks/exhaustive-deps": 0
}
}
]
}
}
根据评论建议进行编辑:
此外,将内容移动.eslintrc
到package.json
也不起作用。
包.json
"eslintConfig": {
"extends": [
"react-app",
"shared-config"
],
"rules": {
"react-hooks/exhaustive-deps": 0
}
},
我错过了什么吗?可能的话请指教:)
解决方案
推荐阅读
- python - 改组数据框中的多列
- function - Sharepoint 如何更改新文档的功能
- javascript - Jest 模拟不适用于 react-native 输入
- javascript - Vue JS:同时获取输入数组的唯一ID和值
- uwp - 如何使用 UWP Backbround Task 从本地存储(比如 "C:\\" )读取文件?
- javascript - React 中通过 ID 访问 DOM 元素
- flutter - Flutter 实现重复 Elastic 动画
- python - 如何从列表中创建嵌套列表,其中值是列表项的计数 Python
- polymer - 我应该使用属性或属性来传递数据吗?
- javascript - 如何使用 java 脚本仅从具有带扩展名的文件名的路径中修剪文件名?