angular - 如何禁用 Angular 7 typescript 中的 eslint 错误

标签 angular typescript angular7 eslint lint

我正在使用 VS code 进行 Angular 7 工作。我有 es-lint 规则。我想在某些情况下禁用 es-lint 错误。是否有任何插件可以解决此问题。

[tslint] object access via string literals is disallowed [no-string-literal]

      this.validate(res['results']);

最佳答案

如果您想在文件或特定行中禁用 ESLint 规则,您可以添加注释。

单行:

const message = 'foo';
console.log(message); // eslint-disable-line no-console

// eslint-disable-next-line no-console
console.log(message);

整个(其余)文件:

/* eslint-disable no-console */
const message = 'foo';
console.log(message);

关于angular - 如何禁用 Angular 7 typescript 中的 eslint 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57553609/

相关文章:

node.js - 如何使用 Apple Pay 和 Google Pay 集成配置 Stripe

Angular Material 样式未正确应用

angular - @materia-ui/ngx-monaco-editor - 无法使用编辑器获取自定义 json 模式

Angular 4 - 登录成功后将数据存储在localStorage中

typescript - 找不到 NgbModalBackdrop 的组件工厂。您是否将其添加到@NgModule.entryComponents?即使我将 EnteryComponent 添加到我的模块中

html - 更改事件选项卡上的背景颜色

css - 如何在导航到特定组件或刷新它时向正文添加类?

javascript - 无法读取未定义的属性 @ViewChild 不工作 Angular 5

javascript - 测试 typescript 装饰器

angular - 在 Typescript (Angular2 ionic2) 中访问 SASS 值($colors from variables.scss)