fix noInputRenameRule#585
Merged
mgechev merged 2 commits intomgechev:masterfrom Apr 29, 2018
wKoza:gh580
Merged
Conversation
rafaelss95
reviewed
Apr 28, 2018
test/noInputRenameRule.spec.ts
Outdated
| source | ||
| }); | ||
| }); | ||
| it('should fail when a input property has the same name that the alias', () => { |
Collaborator
There was a problem hiding this comment.
nit: break line before it. Also, shouldn't it be ...an input...?
rafaelss95
reviewed
Apr 28, 2018
test/noInputRenameRule.spec.ts
Outdated
| }); | ||
|
|
||
| it("should fail when input property is renamed and it's different from directive's selector", () => { | ||
| it('should fail when a input property has the same name that the alias', () => { |
rafaelss95
reviewed
Apr 28, 2018
src/noInputRenameRule.ts
Outdated
| if ( | ||
| args.length === 0 || | ||
| (this.directiveSelector && | ||
| (input.expression as any).arguments.some(arg => this.directiveSelector.indexOf(arg.text) !== -1 && memberName !== arg.text)) |
Collaborator
There was a problem hiding this comment.
Instead of casting to any, what about (input.expression as ts.CallExpression)?
rafaelss95
reviewed
Apr 28, 2018
test/noInputRenameRule.spec.ts
Outdated
|
|
||
| const getMessage = (className: string, propertyName: string): string => { | ||
| return `In the class "${className}", the directive input property "${propertyName}" should not be renamed.`; | ||
| return ( |
Collaborator
There was a problem hiding this comment.
To be always sync with the rule's name and also metadata, I'd refactor it to:
const { FAILURE_STRING, metadata: { ruleName } } = Rule;
const getFailureMessage = (className: string, propertyName: string): string => {
sprintf(FAILURE_STRING, className, propertyName);
};
mgechev
approved these changes
Apr 29, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the hope that it clarifies things:
Fixes #580