@@ -2,21 +2,20 @@ import { IOptions, IRuleMetadata, Replacement, RuleFailure } from 'tslint/lib';
22import { AbstractRule } from 'tslint/lib/rules' ;
33import { Decorator , isPropertyDeclaration , SourceFile } from 'typescript' ;
44import { NgWalker } from './angular/ngWalker' ;
5- import { decoratorKeys , Decorators , DECORATORS , getDecoratorName , isSameLine } from './util/utils' ;
5+ import { Decorators , getDecoratorName , isSameLine } from './util/utils' ;
66
77export class Rule extends AbstractRule {
88 static readonly metadata : IRuleMetadata = {
99 description : 'Ensures that decorators are on the same line as the property/method it decorates.' ,
1010 descriptionDetails : 'See more at https://angular.io/guide/styleguide#style-05-12.' ,
1111 hasFix : true ,
12- optionExamples : [ true , [ true , Decorators . HostListener ] ] ,
12+ optionExamples : [ true , [ true , Decorators . HostListener ] , [ true , Decorators . Input , 'MyCustomDecorator' ] ] ,
1313 options : {
14- items : {
15- enum : decoratorKeys ,
16- type : 'string'
17- } ,
18- maxLength : DECORATORS . size ,
19- minLength : 0 ,
14+ items : [
15+ {
16+ type : 'string'
17+ }
18+ ] ,
2019 type : 'array'
2120 } ,
2221 optionsDescription : 'A list of blacklisted decorators.' ,
@@ -33,14 +32,7 @@ export class Rule extends AbstractRule {
3332 }
3433
3534 isEnabled ( ) : boolean {
36- const {
37- metadata : {
38- options : { maxLength, minLength }
39- }
40- } = Rule ;
41- const { length } = this . ruleArguments ;
42-
43- return super . isEnabled ( ) && length >= minLength && length <= maxLength ;
35+ return super . isEnabled ( ) && this . ruleArguments . every ( ruleArgument => ! ! ( typeof ruleArgument === 'string' && ruleArgument . trim ( ) ) ) ;
4436 }
4537}
4638
0 commit comments