SAP / ui5-linter

A static code analysis tool for UI5
Apache License 2.0
52 stars 4 forks source link

Linter doesn't take ui5 version into account? #50

Closed rpbouman closed 8 months ago

rpbouman commented 8 months ago

Expected Behavior

I expected the linter would pick up the ui5 version from the bootstrap script in my index.html

Current Behavior

I changed the ui5 version from 1.108.27 to 1.120.11 by changing the url in my bootstrap script tag in index.html:

    <script
      id="sap-ui-bootstrap"
      src="https://sapui5.hana.ondemand.com/1.120.11/resources/sap-ui-core.js"
      ....  
    > 

I ran the linter but the error report was identical. However, when running the ui5 app with the 1.120 version, there were numerous deprecation messages in the console log. I would love to catch those with the linter without having to run the app (and access every feature to see if the runtime generates deprecation messages)

Steps to Reproduce the Issue

  1. create app run linter
  2. update ui5 uri in bootstrap script
  3. run linter again

Context

UI5 linter package and version: 0.1.3 Node.js Version: v20.11.1 npm 9.6.4 OS/Platform: Microsoft Windows 10 Enterprise

RandomByte commented 8 months ago

At this point the UI5 version relevant to UI5 linter can't be configured. We plan to add this at a later time though.

For now, all deprecations are detected based on the UI5 API information for version 1.120: https://ui5.sap.com/1.120/

There are many cases that UI5 linter can't detect yet (see also https://github.com/SAP/ui5-linter/issues/21). If you find that a deprecated API is not properly detected (and not already listed on our roadmap), we welcome you to create an issue on that 👍

rpbouman commented 8 months ago

Thanks @RandomByte! Please accept my apology for posting a duplicate issue, this was not my intention.

RandomByte commented 8 months ago

No worries Roland, and thanks for checking out UI5 linter! I'm just trying to clear new issues as good as possible. I hope I didn't suggest that your feedback is not welcome. On the contrary, we appreciate it and we will certainly take it into our discussions. It's helping us to shape the future of this tool. So please keep it coming 🙂

John-H-Smith commented 2 months ago

@RandomByte Just to add a note here: Linting only against version 1.120 is really bad. In practice, the latest UI5 version is mostly not used (in business context) as the onprem systems run older versions. I worked with many ui5 projects for customers, but only a few of them are running version 1.120. Thus, the linter is not useful for most business projects.

flovogt commented 2 months ago

We plan to offer an configuration option for the UI5 version, SAP internally tracked in backlog item CPOUI5FOUNDATION-856.

But please keep in mind: The main goal of the linter is to ensure your application runs with UI5 2.X. If your application is using best practices and no APIs deprecated until UI5 1.120, the app will run successfully with UI5 2.X.