Technical Articles
A ESlint plugin to scan deprecated SAPUI5 API usage
Background:
I have been involved many customer conversion/upgrade projects. From time to time I got question like: “Will my existing custom SAP Fiori apps still work after this upgrade?” In such cases most concern is existing API got deprecated in higher version of SAPUI5. Usage of deprecated API takes custom SAP Fiori app to unexpected risks.
ESLint plugin: eslint-plugin-ui5depchk/no-deprecated-api
To save the testing effort, I made a ESLint plugin “eslint-plugin-ui5depchk”. It contains a rule “no-deprecated-api” to scan SAP Fiori app source code and check if any control/method is deprecated. This can be a supplement from design time, even before the migration.
As a ESLint plugin, it can be embedded into IDE as normal ESLint rule.
For controller.js:
For XML view:
I prefer to scan it as a command line tool as it generates a report so I could assign the issues to other developers.
This plugin is only designed for SAPUI5 code. Don’t forgot to configure .eslintignore to ignore 3rd party code.
How to install & use:
Similar to other ESLint plugins, I have published this plugin as NPM module in: https://www.npmjs.com/package/eslint-plugin-ui5depchk Just follow the README to get it work.
Conclusion:
This tool does not help much if you are developing a new SAP Fiori app from scratch.
But it may save a lot of your time in an upgrade project. Just put all your custom SAP Fiori code together and scan it with this tool in one go. And of course, fix the reported deprecated usages accordingly.
Call to action:
Thanks for reading. Appreciate if you could play around it with your previous SAPUI5 code and share the feedback in comment.
Also looking forward to your ideas to improve this plugin.
Enjoy!!
It's a very useful tool. We have noticed though that deprecated properties, aggregations are not scanned. For example, VBox blocked="false" or filterItems within FilterBar.
Hi Jeroen,
Thank you for the feedback.
For now, this deprecation check is based on UI5 API deprecation index page: https://sapui5.hana.ondemand.com/#/api/deprecated
I got kind of headache, some deprecated APIs show in API detail page but not in deprecated index page. I will try to make a more comprehensive check at least against major library like sap.m and sap.ui.
Kind regards,
Kenny
hi,
How to run this after configuration?