Skip to content

no-input-rename fails if input alias is prefixed with directive selector #705

@marcincichocki

Description

@marcincichocki

Currently codelyzer doesn't allow to rename inputs of a directive other than its selector.

@Directive({
  selector: '[appHighlight]',
})
export class HighlightDirective {
  // works with codelyzer 4.4
  @Input('appHighlight') visible = true;

  // still an error
  @Input('appHighlightColor') color = 'yellow';
}
<h1 appHighlight appHighlightColor="red">Demo</h1>

In example above HighlightDirective#color have alias prefixed with directive's selector to prevent name collisions within the template(if component or other directive have same input prop).

If this means anything, @angular/material uses this convention(for example: https://github.com/angular/material2/blob/6.4.6/src/lib/sort/sort.ts#L76)

Thank you for this amazing project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions