fix-js-globals
Fix JavaScript no-globals errors that UI5 linter reports but cannot auto-fix. Use this skill when linter outputs:
- no-globals rule with message "Access of global variable '...' (...)" in JS files
Cases handled (linter CANNOT auto-fix):
- Assignments to global namespaces: sap.myNamespace = {...}
- Global namespace assignment/read inside sap.ui.define
- Delete expressions: delete sap.something
- sap.ui.core.Core direct access (class vs singleton)
- jQuery/$ globals: add sap/ui/thirdparty/jquery — do NOT replace jQuery API calls
- jQuery.sap.* utilities: replace with dedicated modules
- Conditional/probing access: if (sap.ui.something)
- Custom namespace definitions that aren't UI5 modules
- sap.ui.controller() factory → Controller.extend (NOT Fiori Elements extensions)
- jQuery.sap.declare/require: legacy modules without sap.ui.define
Trigger when: "fix no-globals", "global variable error", "sap.ui.getCore", "jQuery.sap"
Converts global namespace access to proper sap.ui.define module imports.
Pinned to revision 4e8964e24a5a, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/fix-js-globals/SKILL.md
- skills/fix-js-globals/LICENSE
- skills/fix-js-globals/references/core-api-replacements.md
- skills/fix-js-globals/references/example-fix-session.md
Every link opens the file at its source, pinned to the revision this page describes.