Technology Blog Posts by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
FlorianVogt
Product and Topic Expert
Product and Topic Expert
2,018

UI5 linter is the tool of choice to check your UI5 project for using best practices and replacement of deprecated UI5 APIs. Last year, we focused on the detection capabilities of UI5 linter. In early 2025, we started on an actual migration functionality to be offered by UI5 linter, a.k.a "Autofix". Right from the beginning, our goal was to provide a similar developer experience as offered by the famous ESLint project. With UI5 linter v1.12.0, we are happy to announce the initial version of an autofix feature. You can directly use the "--fix" argument to let UI5 linter apply fixes to your code automatically.

FlorianVogt_0-1742302265718.png

Feature

In our initial autofix version, UI5 linter can replace the deprecated usage of UI5 globals with our recommended way of importing the respective module and using the local name in your code.

Let’s try it out! In our application we have used the deprecated global notation when creating an sap.ui.model.json.JSONModel instance:

 

sap.ui.define([
  "sap/ui/core/mvc/Controller"
], (Controller) => {
  "use strict";

  return Controller.extend("ui5.app.controller.Home", {
    onInit() {
      this.getView().setModel(new sap.ui.model.json.JSONModel({
        achievement: "UI5 linter Autofix has landed"
      }));
    }
  });
});

 

Now, let’s execute UI5 linter to see whether it detects the deprecated usage of the JSON model. Simply call "ui5lint" in a shell of your choice.

 

> ui5lint
UI5 linter report:

/ui5-app/webapp/controller/Home.controller.js
  8:41 error Access of global variable 'sap' (sap.ui.model.json.JSONModel)  no-globals

1 problems (1 errors, 0 warnings)
  Run 'ui5lint --fix' to resolve all auto-fixable problems

Note: Run 'ui5lint --details' to get more information on the findings

 

Got it! UI5 linter has found the issue. We could fix the issue on our own or we can let UI5 linter do the job for us by executing "ui5lint --fix".

 

> ui5lint --fix
UI5 linter report:


0 problems (0 errors, 0 warnings)

 

Yay! UI5 linter says it was able to fix my code. Let’s see whether UI5 linter is right:

 

sap.ui.define([
  "sap/ui/core/mvc/Controller",
  "sap/ui/model/json/JSONModel"
], (Controller, JSONModel) => {
  "use strict";

  return Controller.extend("ui5.app.controller.Home", {
    onInit() {
      this.getView().setModel(new JSONModel({
        achievement: "UI5 linter Autofix has landed"
      }));
    }
  });
});

 

There are plenty of other deprecation types waiting to be fixed automatically by UI5 linter, and our team puts a huge focus on giving you an update here soon. See our roadmap https://github.com/SAP/ui5-linter/issues/323 to get an overview of our planned upcoming features.

7 Comments
Marian_Zeis
Active Contributor

Great feature! The tool becomes better every release 🙂 

Happy to see the investments in there!

FabioPagoti
Active Contributor

Nice tool. Are here any plans to make this available by default when new projects are created in BAS?

MarkusBittner
Discoverer

Thank you for the updates 🙂

We integrade this tooling in our newer project pipelines. This makes it a lot easier to stay up to date and identify deprecated usage during developtment.

Looking forward where this project is going.

Joel_John
Participant

I tried this on my project and get an error:

Command Failed:
Unknown argument: fix

Is there something that I am missing?

FlorianVogt
Product and Topic Expert
Product and Topic Expert

Please ensure to install the latest UI5 linter release by executing "npm install -g @ui5/linter" in your shell

FlorianVogt
Product and Topic Expert
Product and Topic Expert
@FabioPagoti wrote:

Nice tool. Are here any plans to make this available by default when new projects are created in BAS?

Thanks a lot for raising this topic here. We discussed this topic with the team taking care of SAP Business Application Studio. Currently UI5 linter is already available as a tile in the application info screen called "Run UI5 Linter". So after clicking on this tile, you might execute "ui5lint --fix" in the terminal to also perform actual changes in the code.

zfiori
Participant
0 Kudos

Hi Community,

"Last year, we focused on the detection capabilities of UI5 linter. In early 2025, we started on an actual migration functionality to be offered by UI5 linter, a.k.a "Autofix". Right from the beginning, our goal was to provide a similar developer experience as offered by the famous ESLint project. With UI5 linter v1.12.0, we are happy to announce the initial version of an autofix feature. You can directly use the "--fix" argument to let UI5 linter apply fixes to your code automatically."

 

Thanks for your kindly sharing, it really help us a lot.

 

🙂

Regards,

ZFiori.