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)
如何禁用该特定行的该规则?
附:
该规则directive-selector适用于@Directive装饰器。
对于@Component你需要使用component-selector
例如:
// tslint:disable-next-line:component-selector
@Component({ template: ``, selector: 'ngb-pagination' })
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8548 次 |
| 最近记录: |