Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rule): add special case to no-input-rename rule #561

Merged
merged 1 commit into from
Apr 18, 2018
Merged

feat(rule): add special case to no-input-rename rule #561

merged 1 commit into from
Apr 18, 2018

Conversation

rafaelss95
Copy link
Collaborator

This:

You should use an alias when the directive name is also an input property, and the directive name doesn't describe the property.

@Component...
...
@Input('myInput') myInput: any;

Fixes #374.

import { NgWalker } from './angular/ngWalker';

export class Rule extends Lint.Rules.AbstractRule {
public static metadata: Lint.IRuleMetadata = {
ruleName: 'no-input-rename',
type: 'maintainability',
description: 'Disallows renaming directive inputs by providing a string to the decorator.',
description: 'Disallows renaming inputs by providing a string to the decorator.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not in favor of removing directive. The sentence is ambiguous. We can change it by:

Disallows renaming directive or component inputs by providing a string to the decorator.

however, a component is a directive.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafaelss95 , have you seen this comment ?

describe(componentDecorator, () => {
it('should fail when a input property is renamed', () => {
const source = `
@${componentDecorator}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this syntax difficult to read again. Can you change this ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafaelss95 I see your point moving the names to constants. I agree with @wKoza that it'll be easier to read if we have the names inline. It's also unlikely we go back and rename the classes and/or decorators.

@rafaelss95
Copy link
Collaborator Author

I've addressed your comments, @mgechev @wKoza.

@wKoza
Copy link
Collaborator

wKoza commented Apr 17, 2018

Have you seen my comment #561 (comment) ? Other than that, it's great !

@rafaelss95
Copy link
Collaborator Author

I've fixed it. @wKoza

@wKoza wKoza merged commit f3a53bd into mgechev:master Apr 18, 2018
@rafaelss95 rafaelss95 deleted the refactor-no-input-rename branch April 19, 2018 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants