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

Skip to content

receiver of Call expression is skipped during AST traversal #1885

Closed
@P4

Description

@P4

Due to how the fallback for visitorKeys is handled, ESLint never enters the receiver of a Call expression. This can lead to various weird issues, for example the template/no-call-expression will skip some invalid function calls in the templates:

<!-- with allowList: ['ok'] the call to notOk won't be reported -->
{{ notOk().ok() }}

<!-- nested calls should report multiple errors but produce only one -->
{{ foo().bar() }} {{ foo()() }}

The logic of getFallbackKeys appears to be buggy in some way - when viewing the nodes in AST explorer or just by printing to console.log, I can see that the receiver doesn't have its type set, for example.

Versions

package version
@angular-eslint/template-parser 18.0.1
ESLint 9.4.0
node 20.9.0
# Please run `npx ng version` in your project and paste the full output here:
     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 18.0.2
Node: 20.11.1
Package Manager: npm 10.2.4
OS: linux x64

Angular: 18.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1800.2
@angular-devkit/build-angular   18.0.2
@angular-devkit/core            18.0.2
@angular-devkit/schematics      18.0.2
@angular/cli                    18.0.2
@schematics/angular             18.0.1
ng-packagr                      18.0.0
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6    
  • 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: template-parserESLint custom parser which enables linting Angular TemplatestriageThis 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