A static code analysis tool for UI5
UI5 linter is a static code analysis tool for UI5 projects. It checks JavaScript, XML, JSON, and other files in your project and reports findings.
Currently, it identifies deprecated API usage, global variables, and more to prepare your project for UI5 2.x.
Note
This project is still in development. While the current version already provides good value, it is not yet covering all aspects and not all best practices for UI5 2.x. Stay tuned for updates!
Install the CLI using the npm package manager:
# Global
npm install --global @ui5/linter
# In your project
npm install --save-dev @ui5/linter
Run the ui5lint
command in your project root folder
ui5lint
UI5 linter report:
/application/webapp/controller/App.controller.js
10:4 error Call to deprecated function 'attachTap' of class 'Button'
/application/webapp/manifest.json
81:17 error Use of deprecated model type 'sap.ui5/models/odata/type="sap.ui.model.odata.ODataModel"'
/application/webapp/test/unit/unitTests.qunit.js
6:1 error Call to deprecated function 'attachInit' of class 'Core'
6:1 error Call to deprecated function 'getCore' (sap.ui.getCore)
6:1 error Access of global variable 'sap' (sap.ui.getCore)
/application/webapp/view/Main.view.xml
16:39 error Import of deprecated module 'sap/m/MessagePage'
22:5 error Use of deprecated property 'blocked' of class 'Button'
7 problems (7 errors, 0 warnings)
Note: Use "ui5lint --details" to show more information about the findings
Specify which files to lint by providing a list of file paths.
Example:
ui5lint --file-paths webapp/controller/App.controller.js webapp/view/App.view.xml
Show more information about the findings and how to fix them.
Example:
ui5lint --details
Choose the output format. Currently, stylish
(default) and json
are supported.
Example:
ui5lint --format json
Note: This section is intended to support UI5 Linter developers and is not meant for end users of the linter!
The UI5 Linter requires metadata to accurately identify certain issues within the codebase. While the absence of this metadata does not hinder the linter's basic functionality, it may result in incomplete findings.
The extracted and generated metadata is stored within the repository under the /resources
folder. This metadata plays a crucial role in enhancing the accuracy of the linter's analysis.
Regular updates to the metadata are necessary to ensure that the data is compatible with the corresponding UI5 type definitions.
npm run update-pseudo-modules-info -- $DOMAIN_NAME/com/sap/ui5/dist/sapui5-sdk-dist/1.120.13/sapui5-sdk-dist-1.120.13-api-jsons.zip 1.120.13
npm run update-semantic-model-info -- $DOMAIN_NAME/com/sap/ui5/dist/sapui5-sdk-dist/1.120.13/sapui5-sdk-dist-1.120.13-api-jsons.zip 1.120.13
This project is open to feature requests/suggestions, bug reports etc. via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
You can also chat with us in the #tooling
channel of the OpenUI5 Community Slack. For public Q&A, use the ui5-tooling
tag on Stack Overflow.
If you find any bug that may be a security problem, please follow our instructions at in our security policy on how to report it. Please do not create GitHub issues for security-related doubts or problems.
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.
Copyright 2024 SAP SE or an SAP affiliate company and contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.