如何强制编译并忽略 @typescript-eslint 错误?

Tha*_*yen 15 typescript reactjs eslint typescript-eslint

我目前正在开发一个 React 项目,该项目是通过 Create React App 发起的。目前,为了编译,我使用npm run start运行的默认命令react-scripts start

我有很多@typescript-eslint规则迫使我在交付和部署之前必须拥有干净的代码。但是,在开发过程中,我可能有一些未使用的变量,并且仍然想编译以查看其他内容是否有效。

是否有命令强制编译,同时忽略部分或全部@typescript-eslint规则?

And*_*rew 22

这是可以覆盖的 CRA 配置。在.env文件中,您可以添加这些变量

TSC_COMPILE_ON_ERROR=true
ESLINT_NO_DEV_ERRORS=true
Run Code Online (Sandbox Code Playgroud)

这是完整列表https://create-react-app.dev/docs/advanced-configuration/