Skip to content

Processors: location information for single line inline templates is incorrect #2356

Closed
@reduckted

Description

@reduckted

Description and reproduction of the issue

When an inline template is a single line, any errors/warnings appear at the wrong location.

https://stackblitz.com/edit/angular-eslint-repros-lwcrh6lk?file=src%2Fmain.ts

The component's metadata is:

@Component({
  selector: 'app-root',
  template: `<h1>Hello from {{ name == 'a' }}!</h1>`,
                  ~~~~~~~~~~~
})

The location for eqeqeq starts at column 19, but that covers ello from { rather than name == 'a'.

If you change the template to start with a line break, then the location is correctly reported.

@Component({
  selector: 'app-test',
  template: `
  <h1>Hello from {{ name == 'a' }}!</h1>`,
                    ~~~~~~~~~~~
  styleUrl: './test.component.css',
})

Versions

package version
@angular-eslint/eslint-plugin-template 19.0.0
@angular-eslint/template-parser 19.0.0
@typescript-eslint/parser 19.0.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 version output per the instructions given here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-plugin-templateAngular Template 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