Skip to content

Commit 533fd81

Browse files
author
PreskoIsTheGreatest
committed
update alignment and attribute rule
1 parent 636cde1 commit 533fd81

3 files changed

+9
-9
lines changed

src/inputPropertyDirectiveRule.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export class Rule extends Lint.Rules.AbstractRule {
1111
this.getOptions()));
1212
}
1313

14-
static FAILURE_STRING:string = 'In the class "%s", the directive input property "%s" should not be renamed.' +
14+
static FAILURE_STRING:string = 'In the class "%s", the directive ' +
15+
'input property "%s" should not be renamed.' +
1516
'Please, consider the following use "@Input() %s: string"';
1617
}
1718

1819

1920
export class InputMetadataWalker extends Ng2Walker {
2021

21-
visitNg2Input(property: ts.PropertyDeclaration, input: ts.Decorator, args: string[]){
22+
visitNg2Input(property:ts.PropertyDeclaration, input:ts.Decorator, args:string[]) {
2223
let className = (<any>property).parent.name.text;
2324
let memberName = (<any>property.name).text;
24-
let name = (<any>input.expression).expression.text;
25-
if (name === 'Input' && args.length!=0 && memberName != args[0]) {
25+
if (args.length != 0 && memberName != args[0]) {
2626
let failureConfig:string[] = [className, memberName, memberName];
2727
failureConfig.unshift(Rule.FAILURE_STRING);
2828
this.addFailure(

src/outputPropertyDirectiveRule.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export class Rule extends Lint.Rules.AbstractRule {
1111
this.getOptions()));
1212
}
1313

14-
static FAILURE_STRING:string = 'In the class "%s", the directive output property "%s" should not be renamed.' +
14+
static FAILURE_STRING:string = 'In the class "%s", the directive output ' +
15+
'property "%s" should not be renamed.' +
1516
'Please, consider the following use "@Output() %s = new EventEmitter();"';
1617
}
1718

1819

1920
export class OutputMetadataWalker extends Ng2Walker {
2021

21-
visitNg2Output(property: ts.PropertyDeclaration, output: ts.Decorator, args: string[]){
22+
visitNg2Output(property:ts.PropertyDeclaration, output:ts.Decorator, args:string[]) {
2223
let className = (<any>property).parent.name.text;
2324
let memberName = (<any>property.name).text;
24-
let name = (<any>output.expression).expression.text;
25-
if (name === 'Output' && args.length!=0 && memberName != args[0]) {
25+
if (args.length != 0 && memberName != args[0]) {
2626
let failureConfig:string[] = [className, memberName, memberName];
2727
failureConfig.unshift(Rule.FAILURE_STRING);
2828
this.addFailure(

test/attributeParameterDecoratorRule.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('attribute-parameter-decorator', () => {
66
let source = `
77
class ButtonComponent {
88
label: string;
9-
constructor(public @Attribute('label') label) {
9+
constructor(@Attribute('label') label) {
1010
this.label = label;
1111
}
1212
}`;

0 commit comments

Comments
 (0)