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

[Feature Request] Enforce single line @Input decorator #549

Closed
haubbixa opened this issue Mar 26, 2018 · 4 comments · Fixed by #586
Closed

[Feature Request] Enforce single line @Input decorator #549

haubbixa opened this issue Mar 26, 2018 · 4 comments · Fixed by #586

Comments

@haubbixa
Copy link

I'd like to have a rule to enforce the recommendation of 'Consider placing @input() or @output() on the same line as the property it decorates.' described in Style 05-12. As far as I can tell use-input-property-decorator only enforces the usage of @input not the styling

@mgechev
Copy link
Owner

mgechev commented Mar 27, 2018

Yes, correct. This is a good suggestion. Will add it to the roadmap.

@rafaelss95
Copy link
Collaborator

rafaelss95 commented Apr 16, 2018

What should happen for the following case?

@Input()
get text(): string {
  return 'hey';
}
set text(value: string) {
  this._text = value;
}
private _text: string;

@mgechev
Copy link
Owner

mgechev commented Apr 16, 2018

@rafaelss95 it's a good corner case that you caught! My suggestion would be to ignore the rule in case the input is applied to a setter.

@rafaelss95
Copy link
Collaborator

rafaelss95 commented Apr 26, 2018

@mgechev I'd like to implement this (actually I've already started). I think we can use more generic approach, to enforce single line for Output, ContentChild, ViewChild... and so on. What do you think? If so, about the name.. prefer-decorator-inline, prefer-decorator-single-line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants