如何禁用 Angular 样式指南的 tslint 规则:“选择器应以 <prefix> 为前缀”?

lea*_*iro 6 tslint angular codelyzer

ngb-pagination我对某些使用ng-bootstrap指令的组件进行了 Angular 测试。

现在,在我的测试中,我模拟这个组件如下:

// on next line I get: The selector should be prefixed by "<prefix>" (https://angular.io/guide/styleguide#style-02-07) (component-selector)
@Component({ template: ``, selector: 'ngb-pagination' })
class DummyNgPagination {
    // some data here, not relevant in to the question
}
Run Code Online (Sandbox Code Playgroud)

在放置@Component注释的行中,我收到指向Style 02-07 的tslint错误。

我尝试通过执行以下操作来禁用该规则,但结果是相同的。

// tslint:disable-next-line:directive-selector
@Component({ template: ``, selector: 'ngb-pagination' })
Run Code Online (Sandbox Code Playgroud)

如何禁用该特定行的该规则?

附:

lea*_*iro 6

该规则directive-selector适用于@Directive装饰器。

对于@Component你需要使用component-selector

例如:

// tslint:disable-next-line:component-selector
@Component({ template: ``, selector: 'ngb-pagination' })
Run Code Online (Sandbox Code Playgroud)