【问题标题】:How do I disable TSLint Rule: This rule requires the `strictNullChecks` compiler option to be turned on to function correctly如何禁用 TSLint 规则:此规则需要打开 `strictNullChecks` 编译器选项才能正常运行
【发布时间】:2022-11-03 06:28:55
【问题描述】:

我正在升级我们的应用程序,当我尝试构建我的 Angular 应用程序时出现以下错误: 此规则需要打开 strictNullChecks 编译器选项才能正常运行 @typescript-eslint/no-unnecessary-condition

问题是我希望将“strictNullChecks”设置为 false,这样我就不必在以后重构整个应用程序。有没有办法关闭这个规则?我似乎找不到任何关于此的文档。我收到同样的错误大约 2100 次。任何帮助将不胜感激。

我尝试将以下内容添加到我的 angularCompilerOptions 中,但这并没有解决我的问题: allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: true

【问题讨论】:

  • 如果你有一个.eslintrc 文件,你可以在那里禁用规则。

标签: angular eslint jhipster tslint


【解决方案1】:

我做了接下来的 3 个步骤来消除该错误

  1. 添加到.eslintrc.jsrules 部分

    “@typescript-eslint/strict-boolean-expressions”:“警告”

    1. 添加到tsconfig.jsonjsoncompilerOptions 部分

    “strictNullChecks”:真

    1. 重新加载了我的 IDE

    有关此任务的更多信息

【讨论】:

    猜你喜欢
    • 2019-05-12
    • 2019-11-30
    • 1970-01-01
    • 1970-01-01
    • 2018-04-12
    • 2016-05-17
    • 2020-07-24
    • 1970-01-01
    • 2019-09-18
    相关资源
    最近更新 更多