@@ -2,21 +2,20 @@ import { IOptions, IRuleMetadata, Replacement, RuleFailure } from 'tslint/lib';
2
2
import { AbstractRule } from 'tslint/lib/rules' ;
3
3
import { Decorator , isPropertyDeclaration , SourceFile } from 'typescript' ;
4
4
import { NgWalker } from './angular/ngWalker' ;
5
- import { decoratorKeys , Decorators , DECORATORS , getDecoratorName , isSameLine } from './util/utils' ;
5
+ import { Decorators , getDecoratorName , isSameLine } from './util/utils' ;
6
6
7
7
export class Rule extends AbstractRule {
8
8
static readonly metadata : IRuleMetadata = {
9
9
description : 'Ensures that decorators are on the same line as the property/method it decorates.' ,
10
10
descriptionDetails : 'See more at https://angular.io/guide/styleguide#style-05-12.' ,
11
11
hasFix : true ,
12
- optionExamples : [ true , [ true , Decorators . HostListener ] ] ,
12
+ optionExamples : [ true , [ true , Decorators . HostListener ] , [ true , Decorators . Input , 'MyCustomDecorator' ] ] ,
13
13
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
+ ] ,
20
19
type : 'array'
21
20
} ,
22
21
optionsDescription : 'A list of blacklisted decorators.' ,
@@ -33,14 +32,7 @@ export class Rule extends AbstractRule {
33
32
}
34
33
35
34
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 ( ) ) ) ;
44
36
}
45
37
}
46
38
0 commit comments