Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[use-component-selector] can't use variablesΒ #2582

@ice-blaze

Description

@ice-blaze

Description and reproduction of the issue

Put the selector into a variable

export const selector = `my-app-selector`;

@Component({
	selector,

Activate rule '@angular-eslint/use-component-selector': 'error',
Then execute the linting ng lint.
You get an error.

https://stackblitz.com/edit/angular-eslint-repros-qzp4ffpv?file=eslint.config.js

Versions

package version
@angular-eslint/eslint-plugin ^19.0.0
@typescript-eslint/parser ^19.0.0
ESLint ^9.0.0
node 22.15.0
Angular CLI: 19.2.15
Node: 22.15.0
Package Manager: npm 10.9.2
OS: darwin arm64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.15
@angular-devkit/build-angular   19.2.15
@angular-devkit/core            19.2.15
@angular-devkit/schematics      19.2.15
@angular/cdk                    19.2.19
@angular/cli                    19.2.15
@angular/material               19.2.19
@schematics/angular             19.2.15
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.1
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginAngular-specific TypeScript rulestriageThis issue needs to be looked at and categorized by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions