--- name: fix-deprecated-controls description: | Fix deprecated control/class/interface/type issues that UI5 linter reports but cannot auto-fix. Use this skill when linter outputs: - `no-deprecated-api` with messages about deprecated class, interface, type, property, or property of class - Messages like "Use of deprecated class '...'", "Use of deprecated interface '...'", "Use of deprecated property '...'" Trigger on: deprecated control usage in JS `new` expressions, deprecated properties in constructor settings, deprecated interfaces/types in metadata, deprecated controls/properties in XML views, sap.m.MessagePage modernization to IllustratedMessage. Use this skill whenever you see 'deprecated class', 'deprecated property', 'deprecated interface', or 'deprecated type' in linter output, even if the user doesn't explicitly mention deprecation. Provides replacement guidance for deprecated UI5 controls and their properties. --- # Fix Deprecated Controls, Classes, Interfaces, and Types This skill fixes deprecated control/class/interface/type issues that the UI5 linter detects but cannot auto-fix because they require understanding the specific replacement APIs. ## Linter Rules Handled | Rule ID | Message Pattern | This Skill's Action | |---------|-----------------|---------------------| | `no-deprecated-api` | Use of deprecated class '...' | Replace with new class | | `no-deprecated-api` | Use of deprecated interface '...' | Replace with new interface | | `no-deprecated-api` | Use of deprecated type '...' | Replace with new type | | `no-deprecated-api` | Use of deprecated property '...' | Remove or replace property | | `no-deprecated-api` | Use of deprecated property '...' of class '...' | Replace with new property/API | ## When to Use Apply this skill when you see linter output like: ``` MyController.js:15:5 error Use of deprecated class 'sap.ui.commons.Button' no-deprecated-api MyController.js:20:5 error Use of deprecated property 'blocked' of class 'sap.m.Button' no-deprecated-api MyView.view.xml:10:5 error Use of deprecated class 'sap.m.DateTimeInput' no-deprecated-api Component.js:25:5 error Use of deprecated interface 'sap.ui.core.IFormContent' no-deprecated-api ``` ## Getting Replacement Information Run the linter with `--details` flag to get links to API documentation with replacement guidance: ```bash npx @ui5/linter --details ``` Use the **UI5 MCP Server's `get_api_reference` tool** to check deprecation status and find replacements. The UI5 MCP Server is not part of this plugin: if its tools are not available, ask the user to add it as a custom server in Settings with the command `npx -y @ui5/mcp-server@latest`. Queries: - Query: `sap.ui.commons.Button` or `sap.m.Button#blocked` ## Fix Strategy ### 1. Deprecated Class in `new` Expression **Problem**: Using a deprecated control class. ```javascript // Before - triggers no-deprecated-api sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/ui/commons/Button" // Deprecated library! ], function(Controller, Button) { "use strict"; return Controller.extend("my.app.controller.Main", { onInit: function() { var oButton = new Button({ text: "Click me" }); } }); }); ``` **Fix Strategy**: Replace with the modern equivalent class. ```javascript // After - use sap.m.Button instead sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/m/Button" ], function(Controller, Button) { "use strict"; return Controller.extend("my.app.controller.Main", { onInit: function() { var oButton = new Button({ text: "Click me" }); } }); }); ``` **Common Deprecated Class Replacements:** | Deprecated Class | Replacement | |------------------|-------------| | `sap.ui.commons.*` | `sap.m.*` equivalents | | `sap.ui.ux3.*` | `sap.m.*` or `sap.f.*` | | `sap.ui.commons.TextField` | `sap.m.Input` | | `sap.ui.commons.Button` | `sap.m.Button` | | `sap.ui.commons.Label` | `sap.m.Label` | | `sap.ui.commons.CheckBox` | `sap.m.CheckBox` | | `sap.ui.commons.DropdownBox` | `sap.m.Select` or `sap.m.ComboBox` | | `sap.ui.model.odata.ODataModel` | `sap.ui.model.odata.v2.ODataModel` | | `sap.m.MessagePage` | `sap.m.IllustratedMessage` (see section 8) | | `sap.viz.ui5.controls.VizFrame` (old) | Check `sap.viz` documentation | **sap.m Deprecated Controls:** | Deprecated Class | Replacement | Notes | |---|---|---| | `sap.m.UploadCollection` | `sap.m.upload.UploadSet` or `sap.m.plugins.UploadSetwithTable` | UploadSetwithTable for table-based layouts | | `sap.m.TablePersoDialog` | `sap.m.p13n.*` | **Do not auto-modernize** — report for manual modernization | | `sap.m.TablePersoController` | `sap.m.p13n.*` | **Do not auto-modernize** — report for manual modernization | | `sap.m.TablePersoProvider` | `sap.m.p13n.*` | **Do not auto-modernize** — report for manual modernization | | `sap.m.P13nDialog` | `sap.m.p13n.Popup` | **Do not auto-modernize** — report for manual modernization | | `sap.m.P13nColumnsPanel` | `sap.m.p13n.SelectionPanel` | **Do not auto-modernize** — report for manual modernization | | `sap.m.P13nSortPanel` | `sap.m.p13n.SortPanel` | **Do not auto-modernize** — report for manual modernization | | `sap.m.P13nGroupPanel` | `sap.m.p13n.GroupPanel` | **Do not auto-modernize** — report for manual modernization | | `sap.m.P13nFilterPanel` | `sap.m.p13n.FilterPanel` | **Do not auto-modernize** — report for manual modernization | | `sap.m.DateTimeInput` | `sap.m.DatePicker` + `sap.m.TimePicker` | Split into separate controls | | `sap.m.MultiEditField` | — | No direct replacement, custom implementation required | | `sap.m.RouteMatchedHandler` | `sap.m.routing.RouteMatchedHandler` | Use the routing module | **sap.f Deprecated Controls:** | Deprecated Class | Replacement | Notes | |---|---|---| | `sap.f.Avatar` | `sap.m.Avatar` | Moved to sap.m | | `sap.f.IllustratedMessage` | `sap.m.IllustratedMessage` | Moved to sap.m | | `sap.f.Illustration` | `sap.m.Illustration` | Moved to sap.m | **sap.ui.table Deprecated Controls:** | Deprecated Class | Replacement | Notes | |---|---|---| | `sap.ui.table.ColumnMenu` | `sap.m.table.columnmenu.Menu` | New column menu framework | | `sap.ui.table.AnalyticalColumnMenu` | `sap.m.table.columnmenu.Menu` | New column menu framework | | `sap.ui.table.TablePersoController` | `sap.m.p13n.*` | **Do not auto-modernize** — report for manual modernization | **sap.ui.unified Deprecated Controls:** | Deprecated Class | Replacement | Notes | |---|---|---| | `sap.ui.unified.Shell` | — | No replacement — redesign using `sap.f.ShellBar` or `sap.tnt.ToolPage` | | `sap.ui.unified.ShellOverlay` | — | No replacement | | `sap.ui.unified.ShellLayout` | — | No replacement | | `sap.ui.unified.SplitContainer` | `sap.m.SplitContainer` or `sap.f.FlexibleColumnLayout` | Use responsive layout | | `sap.ui.unified.ContentSwitcher` | — | No replacement — use `NavContainer` or custom logic | **sap.ui.layout Deprecated Controls:** | Deprecated Class | Replacement | Notes | |---|---|---| | `sap.ui.layout.form.GridLayout` | `sap.ui.layout.form.ColumnLayout` or `sap.ui.layout.form.ResponsiveGridLayout` | GridLayout was removed | **sap.ui.comp Deprecated Controls:** | Deprecated Class | Replacement | Notes | |---|---|---| | `sap.ui.comp.variants.VariantManagement` | `sap.m.VariantManagement` | See section 9 for property mapping | **sap.ui.mdc Deprecated/Changed APIs:** | Deprecated | Replacement | Notes | |---|---|---| | `sap.ui.mdc.enum.*` enums | `sap.ui.mdc.enums.*` | Namespace renamed (enum → enums) | | `sap.ui.mdc.FilterBar` old API | `sap.ui.mdc.FilterBar` refactored | Check API for changed properties | | `sap.ui.mdc.Link` FLP integration | Decoupled from FLP | Check new API for direct usage | ### 2. Deprecated Property in Constructor **Problem**: Using a deprecated property when creating a control. ```javascript // Before - 'blocked' property is deprecated sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/m/Button" ], function(Controller, Button) { "use strict"; return Controller.extend("my.app.controller.Main", { onInit: function() { var oButton = new Button({ text: "Submit", blocked: true // Deprecated! }); } }); }); ``` **Fix Strategy**: Use the replacement property or API. ```javascript // After - use 'enabled' instead sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/m/Button" ], function(Controller, Button) { "use strict"; return Controller.extend("my.app.controller.Main", { onInit: function() { var oButton = new Button({ text: "Submit", enabled: false // Use enabled: false instead of blocked: true }); } }); }); ``` **Common Deprecated Property Replacements:** | Control | Deprecated Property | Replacement | |---------|---------------------|-------------| | `sap.m.Button` | `blocked` | `enabled` (inverted logic) | | `sap.m.Button` | `tap` (event) | `press` | | `sap.ui.table.Table` | `visibleRowCountMode` | `rowMode` aggregation | | `sap.ui.table.Table` | `visibleRowCount` | `rowMode` aggregation | | `sap.ui.table.Table` | `fixedRowCount` | `rowMode` aggregation | | `sap.ui.comp.smarttable.SmartTable` | `useExportToExcel` | `enableExport` | | `sap.ui.layout.form.SimpleForm` | `minWidth` | Remove (only for ResponsiveLayout) | ### 3. Deprecated Interface in Metadata **Problem**: Using a deprecated interface in control/component metadata. ```javascript // Before - deprecated interface sap.ui.define([ "sap/ui/core/Control" ], function(Control) { "use strict"; return Control.extend("my.app.control.MyControl", { metadata: { interfaces: ["sap.ui.core.IFormContent"] // Check if deprecated } }); }); ``` **Fix Strategy**: Replace with the current interface or remove if no longer needed. ```javascript // After - use current interface sap.ui.define([ "sap/ui/core/Control" ], function(Control) { "use strict"; return Control.extend("my.app.control.MyControl", { metadata: { interfaces: ["sap.ui.core.ISemanticFormContent"] // Updated interface } }); }); ``` ### 4. Deprecated Type in Metadata **Problem**: Using a deprecated type in property definition. ```javascript // Before - deprecated type metadata: { properties: { size: { type: "sap.ui.core.CSSSize" } // May be deprecated } } ``` **Fix Strategy**: Check the API reference and use the current type. ### 5. Deprecated Controls in XML Views **Problem**: Using deprecated controls in XML views. ```xml ``` **Fix Strategy**: Replace with the modern equivalent controls. ```xml ``` ### 6. Deprecated Properties in XML Views **Problem**: Using deprecated properties on controls in XML. ```xml