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

[no-input-rename] False positive when directive apply on specific selector #978

Closed
2 tasks done
noemi-salaun opened this issue Apr 8, 2022 · 2 comments · Fixed by #1207
Closed
2 tasks done

[no-input-rename] False positive when directive apply on specific selector #978

noemi-salaun opened this issue Apr 8, 2022 · 2 comments · Fixed by #1207
Labels
bug Something isn't working package: eslint-plugin Angular-specific TypeScript rules PRs Welcome If a high-quality PR is created for this it will be accepted

Comments

@noemi-salaun
Copy link

eslint reports an error when I rename an @Input to match the directive name but the directive is applied only on specific element like img[myDirective]

{
  "rules": {
    "@angular-eslint/no-input-rename": [true]
  }
}
@Directive({
  selector: 'img[appPicture]',
})
export class ImgPictureDirective {
  @Input('appPicture') picture: Picture; // <-- ESLint: Input bindings should not be aliased

  @HostBinding() get src(): string {
    return this.picture.src;
  }
}

The error disapears if I change my directive selector to only [appPicture]

Versions

package version
@angular-eslint/eslint-plugin 13.2.0
@typescript-eslint/parser 13.2.0
ESLint 8.7.0
Angular CLI: 13.2.6
Node: 16.14.2
Package Manager: npm 8.5.0
OS: linux x64

Angular: 13.2.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.6
@angular-devkit/build-angular   13.2.6
@angular-devkit/core            13.2.6
@angular-devkit/schematics      13.2.6
@angular/cdk                    13.2.6
@angular/cli                    13.2.6
@angular/flex-layout            13.0.0-beta.38
@angular/material               13.2.6
@schematics/angular             13.2.6
ng-packagr                      13.3.0
rxjs                            7.4.0
typescript                      4.5.5
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.
@noemi-salaun noemi-salaun added package: eslint-plugin Angular-specific TypeScript rules triage This issue needs to be looked at and categorized by a maintainer labels Apr 8, 2022
@JamesHenry JamesHenry added bug Something isn't working PRs Welcome If a high-quality PR is created for this it will be accepted and removed triage This issue needs to be looked at and categorized by a maintainer labels Nov 17, 2022
@JamesHenry
Copy link
Member

Thanks @noemi-salaun, it makes sense, and happy to accept a PR to address this

@abaran30
Copy link
Contributor

@noemi-salaun @JamesHenry #1207 makes an attempt to address this, and is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package: eslint-plugin Angular-specific TypeScript rules PRs Welcome If a high-quality PR is created for this it will be accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants