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

UI5 Linter fails to determine context of a call expression in common scenarios #246

Closed
flovogt opened this issue Aug 7, 2024 · 2 comments · Fixed by #255
Closed

UI5 Linter fails to determine context of a call expression in common scenarios #246

flovogt opened this issue Aug 7, 2024 · 2 comments · Fixed by #255
Assignees
Labels
bug Something isn't working

Comments

@flovogt
Copy link
Member

flovogt commented Aug 7, 2024

When checking a call expression for deprecated methods, the linter tries to understand the context of the call to later be able to include the context into its report. In certain common cases it fails to do so and throws an error like
Unhandled CallExpression expression syntax: ${callee.type}

Most prominent example (occurs quite often in modern ES2022 or TypeScript code when the constructor of a class calls super(...)):

constructor() {
    super(id, settings);
}

results in Unhandled CallExpression expression syntax: SuperKeyword (found multiple times in sap.fe, e.g. in @sapui5/sap.fe.templates/src/sap/fe/templates/ListReport/controls/MultipleModeControl.ts#76

Less prominent: when the call occurs on the result of another call:

return newIsA.bind(controllerInstance)(className) || this.isA(className);

results in Unhandled CallExpression expression syntax: CallExpression (found in @sapui5/sap.fe.core/src/sap/fe/core/ExtensionAPI.ts#297).

Context

  • UI5 linter version: 0.2.2
  • Node.js Version: v20.11.1
  • npm Version: 10.2.4
  • OS/Platform: macOS 14.4.1
@flovogt flovogt added the bug Something isn't working label Aug 7, 2024
@flovogt
Copy link
Member Author

flovogt commented Aug 7, 2024

Initially tracked SAP-internally via issue id 107

@matz3 matz3 self-assigned this Aug 8, 2024
matz3 added a commit that referenced this issue Aug 9, 2024
A CallExpression on a CallExpression wasn't handled yet and caused a
fatal error.

This commit also adds a test case for another issue that was already
fixed via #73 (SuperKeyword).

Fixes: #246
@matz3
Copy link
Member

matz3 commented Aug 9, 2024

The first issue regarding SuperKeyword has already been fixed in v0.2.3 via #73.

The second issue will be fixed via #255 (incl. a dedicated test case for the first issue).

matz3 added a commit that referenced this issue Aug 12, 2024
A CallExpression on a CallExpression wasn't handled yet and caused a
fatal error.

This commit also adds a test case for another issue that was already
fixed via #73 (SuperKeyword).

Fixes: #246
@matz3 matz3 closed this as completed in 3a7716d Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants