Fix Pseudo Modules and Implicit Globals
This skill fixes pseudo module access and implicit global issues that the UI5 linter detects but cannot auto-fix because they require understanding proper module import patterns.
Linter Rules Handled
When to Use
Apply this skill when you see linter output like:
Background: Pseudo Modules
In UI5, enums and DataTypes were historically accessed as if they were modules (e.g., sap/ui/core/BarColor). These are "pseudo modules" - they don't exist as real files but are resolved at runtime from the library module. In modern UI5, direct pseudo module imports are deprecated.
Fix Strategy
1. Enum Pseudo Module Access
Problem: Importing enums as direct modules.
Fix Strategy: Import from the library module and access the enum as a property.
Common Enum Pseudo Modules and Their Libraries:
2. DataType Pseudo Module Access
Problem: Importing DataTypes as direct modules.
Fix Strategy: Import from the library module.
Common DataType Pseudo Modules:
3. Implicit Globals via Library Access
Problem: Accessing modules via library exports that aren't actually exported.
Fix Strategy: Import the module directly.
Rule of Thumb:
- Enums and DataTypes: Access via library module (e.g.,
library.EnumName) - Classes/Controls: Import directly (e.g.,
sap/ui/unified/DateRange)
4. OData Expression Addons
Problem: Using OData built-in functions in expression bindings without importing.
Fix Strategy: Import ODataExpressionAddons module.
OData Functions Requiring Import:
Note: Importing sap/ui/model/odata/ODataExpressionAddons is the simplest solution as it registers all OData expression functions.
5. OData Functions in XML Views
Problem: Using OData functions in XML view bindings without import.
Fix Strategy: Add core:require for ODataExpressionAddons.
Implementation Steps
-
Identify the issue type from the linter message:
- "enum pseudo module" → Import from library
- "DataType pseudo module" → Import from library
- "not exported by library" → Import module directly
- "OData built-in global" → Import ODataExpressionAddons
-
Determine the correct library for enums/DataTypes:
- Check the module path prefix (e.g.,
sap/ui/core/→sap/ui/core/library)
- Check the module path prefix (e.g.,
-
Update imports:
- Add library import for enums/DataTypes
- Add direct module import for classes
- Add ODataExpressionAddons for OData functions
-
Update code references:
- Extract enum/DataType from library:
var EnumName = library.EnumName; - Use directly imported modules
- Extract enum/DataType from library:
-
For XML views: Add
core:requirewhen needed
Example Fix Session
Given linter output:
Before:
After:
Notes
- Library modules only export enums and DataTypes, not classes/controls
- Always import controls and classes directly by their full module path
- The
ODataExpressionAddonsimport is needed even though you don't use the variable directly - it registers the functions at load time - Pseudo module deprecation helps identify improper dependencies and improves load time optimization
Related Skills
- fix-js-globals: For other JavaScript global access patterns (
no-globalson JS files — e.g.,sap.ui.getCore(), jQuery,sap.ui.controller()), use fix-js-globals - fix-control-renderer: If pseudo module errors appear in renderer code alongside renderer-specific issues, use fix-control-renderer for the renderer modernization



