【问题标题】:ESLint: ignore warning rulesESLint:忽略警告规则
【发布时间】:2021-01-15 06:54:47
【问题描述】:

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

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

这些是相应的警告:

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

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

【问题讨论】:

    标签: angular eslint tslint


    【解决方案1】:

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

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

    对于您的其他警告,eslint 规则是 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

    【讨论】:

    • 谢谢@JFPicard 我添加了规则,但警告仍然没有消失。请参阅带有警告的更新问题。这些警告有不同的规则吗?
    猜你喜欢
    • 1970-01-01
    • 2018-01-08
    • 1970-01-01
    • 2018-05-27
    • 2017-10-13
    • 2020-05-10
    • 1970-01-01
    • 2020-01-16
    • 2017-05-10
    相关资源
    最近更新 更多