ESLint:忽略警告规则

问题描述

打字稿文件充满了警告符号,我试图忽略.eslintrc.json文件中的以下规则:

  1. 我想允许任何类型
  2. 我想忽略在不返回任何内容的函数后面设置void。

这些是相应的警告:

  1. 应输入参数'myArgument'.eslint@typescript-eslint/explicit-module- 边界类型
  2. 在function.eslint@typescript-eslint/explicit-module-boundary-types上缺少返回类型

有没有办法忽略这些规则并使警告消失?

解决方法

对于any,您可以使用"no-explicit-any":false

对于void,您可以使用"no-void": false

对于其他警告,随行规则为explicit-module-boundary-types

您可能需要

 "@typescript-eslint/explicit-module-boundary-types": "off"

请参见

Stop typescript-eslint/explicit-module-boundary-types to be applied on vue component not using Typescript

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...