# fix-js-globals

> Claude/Codex skill by [@ui5](https://omgskills.com/library/ui5/index.md) · 41 stars · Updated 2026-10-20

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.

Tags: claude, development, openui5, plugin, sapui5, ui5

## Install

```sh
git clone https://github.com/UI5/plugins-coding-agents /tmp/plugins-coding-agents && ln -s /tmp/plugins-coding-agents/plugins/ui5-modernization/skills/fix-js-globals ~/.claude/skills/fix-js-globals
```

## From README

Fix JavaScript Global Access (no-globals) Fixes no-globals errors in JavaScript files that the UI5 linter detects but cannot auto-fix. Run npx @ui5/linter --details to get replacement suggestions and documentation links. Key Rules — Read Before Applying Any Fix jQuery/$ globals — preserve jQuery API calls: When fixing jQuery/$ globals, ONLY add the sap/ui/thirdparty/jquery dependency and replace $ with jQuery. Do NOT replace standard jQuery API calls (jQuery.each, jQuery.extend, jQuery.proxy, jQuery.isEmptyObject, etc.) with native JavaScript equivalents. These are standard jQuery methods, not deprecated SAP APIs. Case 9/10 — fix ALL globals in a single pass: When converting a file from jQuery.sap.declare/require to sap.ui.define (Case 9 or 10), you MUST also fix ALL other global-access patterns inside the file body in the same pass. There is no second pass — everything must be handled at once. Read the "Apply ALL Applicable Cases in a Single Pass" section below.

## Links

- HTML page: https://omgskills.com/library/ui5/plugins-coding-agents/plugins/ui5-modernization/skills/fix-js-globals/
- GitHub: https://github.com/UI5/plugins-coding-agents
- Author: [@ui5](https://omgskills.com/library/ui5/index.md)

## More from this repo

- [fix-bootstrap-params](https://omgskills.com/library/ui5/plugins-coding-agents/plugins/ui5-modernization/skills/fix-bootstrap-params/index.md) — Used to fix HTML bootstrap parameter issues that UI5 linter reports but cannot auto-fix.
   - [@ui5](https://omgskills.com/library/ui5/index.md) · 41 stars
- [fix-component-async](https://omgskills.com/library/ui5/plugins-coding-agents/plugins/ui5-modernization/skills/fix-component-async/index.md) — Used to fix Component.js async configuration issues that UI5 linter reports but cannot auto-fix.
   - [@ui5](https://omgskills.com/library/ui5/index.md) · 41 stars
- [fix-control-renderer](https://omgskills.com/library/ui5/plugins-coding-agents/plugins/ui5-modernization/skills/fix-control-renderer/index.md) — Used to fix Control renderer issues that UI5 linter reports but cannot auto-fix.
   - [@ui5](https://omgskills.com/library/ui5/index.md) · 41 stars
