Component.js のасинク設定に関する問題を修正するスキル UI5 リンター(コード解析ツール)が検出するものの、自動修正できない Component.js の非同期読み込み設定に関する問題を修正します。 **このスキルを使用する場合:** - 以下のルール違反がリンターに表示されている場合 - `async-component-flags` - IAsyncContentCreation インターフェースが不足している、マニフェスト宣言が不足している、不要な非同期フラグが存在する、async:false エラーなど - `no-removed-manifest-property` - インライン マニフェスト v2 に非同期フラグが含まれている場合 **対応ファイル:** Component.js ファイルで、非同期読み込み、IAsyncContentCreation、マニフェスト宣言に関するエラーが検出されている場合に自動で処理されます。 **実行内容:** - IAsyncContentCreation インターフェースを自動的に追加 - マニフェスト設定を適切に構成
Fix Component.js async configuration issues that UI5 linter reports but cannot auto-fix. Use this skill when linter outputs these rules: - `async-component-flags` - For missing IAsyncContentCreation interface, missing manifest declaration, redundant async flags, async:false errors - `no-removed-manifest-property` - For async flags in inline manifest v2 Trigger on Component.js files with errors about async loading, IAsyncContentCreation, manifest declaration. Automatically adds the IAsyncContentCreation interface and configures manifest properly.
このスキルは、UI5 リンターが検出しても自動修正できない Component.js の非同期設定の問題を修正します。自動修正が難しい理由は、コンポーネントのローディング動作への理解が必要なためです。
| ルール ID | メッセージパターン | このスキルの対処 |
|---|---|---|
async-component-flags |
Component is not configured for asynchronous loading | IAsyncContentCreation インターフェースを追加 |
async-component-flags |
Component does not specify that it uses the descriptor via the manifest.json file | manifest: "json" を追加 |
async-component-flags |
Component implements the sap.ui.core.IAsyncContentCreation interface. The redundant 'async' flag ... should be removed | manifest から async フラグを削除 |
async-component-flags |
The 'async' property at '...' must be removed | async: false を削除 |
no-removed-manifest-property |
Property '...' has been removed in Manifest Version 2 | async プロパティを削除 |
次のようなリンター出力が確認できる場合に、このスキルを適用してください:
Component.js:5:1 error Component is not configured for asynchronous loading. async-component-flags
Component.js:5:1 warning Component does not specify that it uses the descriptor via the manifest.json file async-component-flags
Component.js:10:5 warning Component implements the sap.ui.core.IAsyncContentCreation interface. The redundant 'async' flag at '/sap.ui5/rootView/async' should be removed async-component-flags
manifest.json:25:9 error The 'async' property at '/sap.ui5/rootView/async' must be removed async-component-flags
完全なモダナイゼーションワークフローにおける重要事項:
リンターが async-component-flags を検出していない場合でも、すべての Component.js に対して無条件にこのスキルを適用してください。
リンターが「インターフェースが存在しない」エラーを検出できるのは、manifest.json から冗長な async: true フラグが削除された後のみです。そのため、モダナイゼーションの初期フェーズではエラーが表示されないことがあります。IAsyncContentCreation は常に予防的に追加してください。
IAsyncContentCreation はマーカーインターフェースです。UI5 ランタイムは interfaces 配列内の文字列としてその名前を確認します。
モジュール依存関係としてインポートしてはなりません。sap.ui.define の依存関係配列に追加すると、sap/ui/core/IAsyncContentCreation はロード可能なモジュールではないため、ランタイムエラーが発生します。
// 誤り — インポートしないこと
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/core/IAsyncContentCreation" // ← 誤り: ランタイムエラーになる
], function(UIComponent, IAsyncContentCreation) {
...
});
// 正しい — interfaces 内で文字列として参照するのみ
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"] // ← 文字列参照のみ
}
});
});
既存の依存関係配列に "sap/ui/core/IAsyncContentCreation" が含まれている場合は、それと対応する関数パラメーターを削除してください。
interfaces の正しい配置場所interfaces は metadata オブジェクトのプロパティです。必ず metadata: { } の内側にネストする必要があります。
UIComponent.extend() の設定オブジェクトには 2 つの階層があります:
UIComponent.extend("name", {
metadata: { ← レベル 1: コンポーネント設定
manifest: "json", ← レベル 2: metadata プロパティ
interfaces: [...] ← レベル 2: interfaces はここに置く
},
init: function() {} ← レベル 1: コンポーネント設定
});
UI5 ランタイムが interfaces を読み取るのは metadata オブジェクト内のみです。
レベル 1(metadata の兄弟要素)に配置してしまうと、エラーなく無視されてしまい、コンポーネントが非同期として認識されません。
編集後に確認してください: interfaces は metadata: より 1 段深くインデントされていますか?
そうなっていない場合、配置場所が誤っています。
async-component-flags — IAsyncContentCreation インターフェースの追加IAsyncContentCreation インターフェースは、コンポーネントが非同期でコンテンツをロードすることを宣言するモダンな方法です。
正しい例 — interfaces を metadata 内にネスト:
// 修正前
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json"
}
});
});
// 修正後
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"]
}
});
});
誤った例 — interfaces のネストレベルが間違っている:
// 誤り — interfaces が metadata の兄弟要素になっている(レベル 2 ではなくレベル 1)
return UIComponent.extend("my.app.Component", {
interfaces: ["sap.ui.core.IAsyncContentCreation"], // ← 誤り: metadata の外にある
metadata: {
manifest: "json"
}
});
async-component-flags — manifest 宣言の追加コンポーネントが manifest の使用を宣言していない場合、metadata に manifest: "json" を追加します。
// 修正前
metadata: {
// manifest の宣言なし
}
// 修正後
metadata: {
manifest: "json"
}
async-component-flags — 冗長な async フラグの削除IAsyncContentCreation インターフェースが実装されている場合、manifest.json 内の async フラグは冗長になるため削除します。
manifest.json での対応:
// 修正前
{
"sap.ui5": {
"rootView": {
"viewName": "my.app.view.Main",
"type": "XML",
"async": true
},
"routing": {
"config": {
"async": true,
...
}
}
}
}
// 修正後
{
"sap.ui5": {
"rootView": {
"viewName": "my.app.view.Main",
"type": "XML"
},
"routing": {
"config": {
...
}
}
}
}
async-component-flags — async: false の削除async: false が明示的に設定されている場合、非同期ローディングを妨げるため削除する必要があります。
manifest が別ファイルの manifest.json ではなく Component.js にインラインで定義されている場合、同様の修正をインライン manifest オブジェクトに適用します。
なお、この場合も interfaces は metadata 内に配置します。インライン manifest プロパティと兄弟関係となり、両方とも metadata 配下にネストされます:
// 修正前
metadata: {
manifest: {
"sap.ui5": {
"rootView": {
"async": true,
...
}
}
}
}
// 修正後
metadata: {
manifest: {
"sap.ui5": {
"rootView": {
...
}
}
},
interfaces: ["sap.ui.core.IAsyncContentCreation"] // ← metadata の内側に配置
}
sap.ui.define または ES6 クラス)async-component-flags エラーへの対応:
IAsyncContentCreation インターフェースがすでに宣言されているか確認interfaces: ["sap.ui.core.IAsyncContentCreation"] を metadata: { } オブジェクト内のプロパティとして追加する(manifest の兄弟要素として配置し、metadata 自体の兄弟要素にしないこと)manifest: "json" が宣言されているか確認し、なければ追加interfaces は metadata: より 1 段深くインデントされているか確認し、同じレベルにある場合は誤りasync プロパティを削除node <skill-dir>/scripts/verify-component.js <project-root> — 終了コード 0 で終わること以下のリンター出力が得られた場合:
Component.js:5:1 error Component is not configured for asynchronous loading. async-component-flags
Component.js の変換:
// 修正前
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/model/json/JSONModel"
], function(UIComponent, JSONModel) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json"
},
init: function() {
UIComponent.prototype.init.apply(this, arguments);
// ...
}
});
});
// 修正後 — interfaces は metadata の内側に配置し、init や metadata の兄弟要素にしないこと
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/model/json/JSONModel"
], function(UIComponent, JSONModel) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"]
},
init: function() {
UIComponent.prototype.init.apply(this, arguments);
// ...
}
});
});
IAsyncContentCreation インターフェースは UI5 1.89 で導入されました。minUI5Version が互換性を満たしていることを確認してください。manifest: "json" も存在することを確認してください。async: true フラグは冗長になり、安全に削除できます。IAsyncContentCreation を使用できます。IAsyncContentCreation を実装している場合は変更不要です。IAsyncContentCreation と manifest v2 の関係: これらは独立した事項です。manifest の _version を "2.0.0" に更新しても、非同期コンテンツ作成は自動的に有効になりません。Component.js に IAsyncContentCreation を明示的に実装する必要があります。逆に、IAsyncContentCreation を追加しても manifest v2 は必須ではありません。IAsyncContentCreation を追加した場合、manifest.json の async フラグが冗長になります。_version の更新、async プロパティの削除、ルーティング設定のリネームには fix-manifest-json を使用してください。sap.ui.getCore())を使用している場合、fix-js-globals を使用して適切なモジュールインポートに変換してください。This skill fixes Component.js async configuration issues that the UI5 linter detects but cannot auto-fix because they may require understanding of the component's loading behavior.
| Rule ID | Message Pattern | This Skill's Action |
|---|---|---|
async-component-flags |
Component is not configured for asynchronous loading | Add IAsyncContentCreation interface |
async-component-flags |
Component does not specify that it uses the descriptor via the manifest.json file | Add manifest: "json" |
async-component-flags |
Component implements the sap.ui.core.IAsyncContentCreation interface. The redundant 'async' flag ... should be removed | Remove async flag from manifest |
async-component-flags |
The 'async' property at '...' must be removed | Remove async: false |
no-removed-manifest-property |
Property '...' has been removed in Manifest Version 2 | Remove async property |
Apply this skill when you see linter output like:
Component.js:5:1 error Component is not configured for asynchronous loading. async-component-flags
Component.js:5:1 warning Component does not specify that it uses the descriptor via the manifest.json file async-component-flags
Component.js:10:5 warning Component implements the sap.ui.core.IAsyncContentCreation interface. The redundant 'async' flag at '/sap.ui5/rootView/async' should be removed async-component-flags
manifest.json:25:9 error The 'async' property at '/sap.ui5/rootView/async' must be removed async-component-flags
Important during full modernization workflows: Also apply this skill unconditionally to every Component.js, even if the linter did not flag async-component-flags. The linter can only detect the missing interface AFTER redundant async: true flags are removed from manifest.json — so in early modernization phases the error won't appear yet. Always add IAsyncContentCreation proactively.
IAsyncContentCreation is a marker interface — the UI5 runtime checks for its name as a string in the interfaces array. It must NOT be imported as a module dependency. Adding it to the sap.ui.define dependency array causes a runtime error because sap/ui/core/IAsyncContentCreation is not a loadable module.
// WRONG — do NOT import it
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/core/IAsyncContentCreation" // ← WRONG: will fail at runtime
], function(UIComponent, IAsyncContentCreation) {
...
});
// CORRECT — only reference it as a string in interfaces
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"] // ← string reference only
}
});
});
If you see "sap/ui/core/IAsyncContentCreation" in an existing dependency array, remove it and its corresponding function parameter.
interfacesinterfaces is a property of the metadata object — it must be nested inside metadata: { }. The UIComponent.extend() config object has two levels:
UIComponent.extend("name", {
metadata: { ← level 1: component config
manifest: "json", ← level 2: metadata properties
interfaces: [...] ← level 2: THIS IS WHERE interfaces GOES
},
init: function() {} ← level 1: component config
});
The UI5 runtime only reads interfaces from the metadata object. Placing it at level 1 (as a sibling of metadata) silently fails — the component will not be recognized as async.
After writing your edit, verify: is interfaces indented one level deeper than metadata:? If not, you put it in the wrong place.
async-component-flags - Add IAsyncContentCreation InterfaceThe IAsyncContentCreation interface is the modern way to declare that a component loads content asynchronously.
Correct — interfaces nested inside metadata:
// Before
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json"
}
});
});
// After
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"]
}
});
});
WRONG — interfaces at the wrong nesting level:
// WRONG — interfaces as a sibling of metadata (level 1 instead of level 2)
return UIComponent.extend("my.app.Component", {
interfaces: ["sap.ui.core.IAsyncContentCreation"], // ← WRONG: outside metadata
metadata: {
manifest: "json"
}
});
async-component-flags - Add Manifest DeclarationIf the component doesn't declare it uses a manifest, add manifest: "json" to the metadata.
// Before
metadata: {
// no manifest declaration
}
// After
metadata: {
manifest: "json"
}
async-component-flags - Remove Redundant Async FlagsWhen IAsyncContentCreation interface is implemented, the async flags in manifest.json become redundant and should be removed.
In manifest.json:
// Before
{
"sap.ui5": {
"rootView": {
"viewName": "my.app.view.Main",
"type": "XML",
"async": true
},
"routing": {
"config": {
"async": true,
...
}
}
}
}
// After
{
"sap.ui5": {
"rootView": {
"viewName": "my.app.view.Main",
"type": "XML"
},
"routing": {
"config": {
...
}
}
}
}
async-component-flags - Remove async: falseIf async: false is explicitly set, this must be removed as it prevents asynchronous loading.
If the manifest is defined inline in Component.js (not in a separate manifest.json), apply the same fixes to the inline manifest object. Note that interfaces still goes inside metadata — it is a sibling of the inline manifest property, both nested under metadata:
// Before
metadata: {
manifest: {
"sap.ui5": {
"rootView": {
"async": true,
...
}
}
}
}
// After
metadata: {
manifest: {
"sap.ui5": {
"rootView": {
...
}
}
},
interfaces: ["sap.ui.core.IAsyncContentCreation"] // ← still INSIDE metadata
}
async-component-flags errors:
IAsyncContentCreation interface is already declaredinterfaces: ["sap.ui.core.IAsyncContentCreation"] as a property inside the metadata: { } object (sibling of manifest, NOT sibling of metadata itself)manifest: "json" is declared, add if missinginterfaces must be indented one level deeper than metadata: — if it's at the same level, it's wrongasync properties from rootView and routing/confignode <skill-dir>/scripts/verify-component.js <project-root> — must exit 0Given linter output:
Component.js:5:1 error Component is not configured for asynchronous loading. async-component-flags
Component.js transformation:
// Before
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/model/json/JSONModel"
], function(UIComponent, JSONModel) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json"
},
init: function() {
UIComponent.prototype.init.apply(this, arguments);
// ...
}
});
});
// After — interfaces goes INSIDE metadata, not next to init/metadata
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/model/json/JSONModel"
], function(UIComponent, JSONModel) {
"use strict";
return UIComponent.extend("my.app.Component", {
metadata: {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"]
},
init: function() {
UIComponent.prototype.init.apply(this, arguments);
// ...
}
});
});
IAsyncContentCreation interface was introduced in UI5 1.89 - ensure minUI5Version is compatiblemanifest: "json" is present for proper async loadingasync: true flags redundant - they can be safely removedIAsyncContentCreation vs manifest v2: These are independent concerns. Updating manifest _version to "2.0.0" does NOT automatically enable async content creation — IAsyncContentCreation must still be explicitly implemented in Component.js. Conversely, adding IAsyncContentCreation does not require manifest v2.IAsyncContentCreation, the manifest.json async flags become redundant — use fix-manifest-json to update _version, remove async properties, and rename routing configurationsap.ui.getCore()), use fix-js-globals to convert them to proper module imports原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。