-
Notifications
You must be signed in to change notification settings - Fork 250
Closed
Labels
package: eslint-plugin-templateAngular Template rulesAngular Template rulestriageThis issue needs to be looked at and categorized by a maintainerThis issue needs to be looked at and categorized by a maintainer
Description
Description and reproduction of the issue
Consider this code:
import { Component } from '@angular/core';
import { describe, it } from 'node:test';
describe('test', () => {
['alpha', 'beta'].forEach((name) => {
it('is a dynamic test', () => {
@Component({
template: `<app-component class="${name}"></app-component>`,
})
class TestComponent {}
});
});
});The component's template is defined using a template literal with interpolations. The location of any errors are slightly off, which also causes the fixes to make the wrong changes.
For example, using the code above with the prefer-self-closing-tags rule, the fix changes the template to:
<app-component class="${name}"> />Reproduction is here:
https://stackblitz.com/edit/angular-eslint-repros-snkd99lv?file=src%2Fmain.test.ts
Simply open the terminal and run ng lint --fix.
Versions
| package | version |
|---|---|
@angular-eslint/eslint-plugin-template |
19.2.1 |
@angular-eslint/template-parser |
19.2.1 |
@typescript-eslint/parser |
8.16.0 |
ESLint |
9.15.0 |
node |
18.20.3 |
Angular CLI: 19.0.0
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64
Angular: 19.0.0
... animations, build, cli, common, compiler, compiler-cli, core
... forms, platform-browser, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1900.0
@angular-devkit/core 19.0.0
@angular-devkit/schematics 19.0.0
@schematics/angular 19.0.0
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
- 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 versionoutput per the instructions given here.
Metadata
Metadata
Assignees
Labels
package: eslint-plugin-templateAngular Template rulesAngular Template rulestriageThis issue needs to be looked at and categorized by a maintainerThis issue needs to be looked at and categorized by a maintainer