reactjs - 禁用 create-react-app 提供的 ESLint
问题描述
create-react-app
v3.0.0 已发布。它在内部支持 TypeScript linting。(太好了!)我想我了解 TSLint 开启的情况,并计划用 ESLint 替换它,但现在不是。
如何禁用该 linting 步骤react-scripts start
?
/* eslint-disable */
其他人不是我要找的人。
解决方案
从react-scripts
v4.0.2 开始,您现在可以使用环境变量选择退出 ESLint。您可以通过将其添加到.env
文件中或在 package.json 文件中为脚本添加前缀来完成此操作。
例如在.env
:
DISABLE_ESLINT_PLUGIN=true
或者在你的 package.json 中:
{
"scripts": {
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start",
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
"test": "DISABLE_ESLINT_PLUGIN=true react-scripts test"
}
}
推荐阅读
- html - 模型被训练来预测句子中的拼写是否正确
- html - 我只想使用模型表单更新 django 中的一个字段
- vue.js - 将 API 中的数据渲染到 Vue 模板中
- c# - 在 C# 数组中有空索引是不好的做法吗?
- mysql - 格式化整数以使用货币,然后按 DESC 排序
- microsoft-graph-api - Microsoft Graph API:向我的组织中的其他用户发送特定用户电子邮件活动
- python - 如何在减少字典列表的同时对字典的特定值求和?
- c++ - C++ 数组的左值和右值
- firebase - Flutter - 尝试在用户被重定向到主页后立即调用函数
- azure - 平台映像“MicrosoftWindowsServer:WindowsServer:2016-Datacenter:latest”不可用