SAP / ui5-linter

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

UI5 Linter does not know / accept sap.ui.predefine or sap.ui.require.preload in bundles #248

Open flovogt opened 3 months ago

flovogt commented 3 months ago

In a bundle file (no matter whether it's a Component-preload.js or a library-preload.js file) calls to the bundle-only APIs sap.ui.predefine or sap.ui.require.preload are reported as use of a disallowed global.

Example: https://github.com/SAP/openui5/blob/master/src/sap.ui.core/test/sap/ui/core/qunit/testdata/libraries/scenario1/lib1/library-preload.js#L2

While this might be limited to framework code, it might be fixable in a robust way. UI5 tooling adds comments to bundles that would allow to identify them

//@ui5-bundle sap/f/library-preload.js
/*!
 * OpenUI5
 * (c) Copyright 2009-2024 SAP SE ...

@codeworrior added those comments to the manually created preloads in sap.ui.core, just in case we want to use them as markers.

As the two APIs in question are not documented as public APIs (only restricted, AFAIK), they either might have to be added to the overlay or have to be listed in the linter's source (similar to the other allowed globals).

Note: This issue is assumed to be specific to framework code only. It's not likely that application code or reuse libs create (non-empty) bundles as part of the sources.

Context

flovogt commented 3 months ago

Was initially SAP-internally tracked with issue id 106.