🔧fix-bootstrap-params
- プラグイン
- ui5-modernization
- ソース
- GitHub で見る ↗
説明
UI5 linterが検出しても自動修正できない、HTMLのbootstrapパラメータに関する問題を修正します。 次のような場合に使用: linterが以下のルールを出力した場合: - `no-deprecated-api` - bootstrapパラメータの欠落または非推奨(async、compat-version、animation、binding-syntaxなど) - `no-deprecated-theme` - `data-sap-ui-theme` における非推奨のテーマ値 - `no-deprecated-library` - `data-sap-ui-libs` における非推奨のライブラリ 以下のエラーメッセージが含まれる場合にトリガー: 「Missing bootstrap parameter」「Abandoned bootstrap parameter」「Redundant bootstrap parameter」「deprecated value」「bootstrap」 UI5のbootstrap scriptタグを含むHTMLファイルに対して、安全な修正を自動的に適用します。
原文を表示
Fix HTML bootstrap parameter issues that UI5 linter reports but cannot auto-fix. Use this skill when linter outputs these rules: - `no-deprecated-api` - For missing/deprecated bootstrap parameters (async, compat-version, animation, binding-syntax, etc.) - `no-deprecated-theme` - For deprecated theme values in data-sap-ui-theme - `no-deprecated-library` - For deprecated libraries in data-sap-ui-libs Trigger on error messages containing: "Missing bootstrap parameter", "Abandoned bootstrap parameter", "Redundant bootstrap parameter", "deprecated value", "bootstrap" Automatically applies safe fixes to HTML files containing UI5 bootstrap script tags.
ユースケース
- ✓UI5 linterが非推奨のbootstrapパラメータを検出したとき
- ✓HTMLのbootstrap scriptタグの自動修正が必要なとき
- ✓非推奨のテーマ値やライブラリを更新するとき
- ✓bootstrap関連のエラーメッセージが出力されたとき
本文(日本語訳)
ブートストラップパラメータの修正
主要ルール
-
ブートストラップの
<script>タグのみを変更してください(id="sap-ui-bootstrap"が指定されているか、srcがsap-ui-core.jsに一致するもので識別)。
インラインスクリプト・設定ブロック・UI5 以外の script 参照を含む、それ以外のすべての<script>タグは必ずそのまま保持してください。
これらは後続フェーズでfix-csp-complianceによって処理されます。 -
ブートストラップタグ以外の
<script>ブロックは、削除・移動・書き換えをしないでください。
ブートストラップタグの前後に<script>window.config = {...}</script>のようなブロックがある場合は、手をつけないでください。
このスキルは、UI5 リンターが検出するものの、アプリケーションの動作に影響を与える可能性があるため自動修正できない HTML ブートストラップパラメータの問題を修正します。
対応するリンタールール
| ルール ID | メッセージパターン | このスキルのアクション |
|---|---|---|
no-deprecated-api |
ブートストラップパラメータ data-sap-ui-async が見つかりません |
data-sap-ui-async="true" を追加 |
no-deprecated-api |
ブートストラップパラメータ data-sap-ui-compat-version が見つかりません |
data-sap-ui-compat-version="edge" を追加 |
no-deprecated-api |
ブートストラップパラメータ data-sap-ui-async に非推奨の値 false が使用されています |
"true" に変更 |
no-deprecated-api |
ブートストラップパラメータ data-sap-ui-compat-version に非推奨の値 ... が使用されています |
"edge" に変更 |
no-deprecated-api |
廃止されたブートストラップパラメータ ... を削除してください |
パラメータを削除 |
no-deprecated-api |
冗長なブートストラップパラメータ ... を削除してください |
パラメータを削除 |
no-deprecated-api |
ブートストラップパラメータ ... を ... に置き換えてください |
新しいパラメータに置換 |
no-deprecated-theme |
非推奨のテーマ ... が使用されています |
sap_horizon に変更 |
no-deprecated-library |
非推奨のライブラリ ... が使用されています |
libs から削除 |
次のような場合に使用
以下のようなリンター出力が確認されたときにこのスキルを適用してください:
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async' no-deprecated-api
index.html:9:3 error Missing bootstrap parameter 'data-sap-ui-compat-version' no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed no-deprecated-api
index.html:15:3 error Use of deprecated theme 'sap_bluecrystal' no-deprecated-theme
修正方針
1. ブートストラップ script タグを特定する
以下のいずれかに該当する <script> タグを探してください:
id="sap-ui-bootstrap"src属性がsap-ui-core.js・sap-ui-custom.js・sap-ui-boot.js等のパターンに一致する
2. ルールとメッセージに基づいて修正を適用する
no-deprecated-api — パラメータの欠落
data-sap-ui-async が欠落している場合: data-sap-ui-async="true" を追加
data-sap-ui-compat-version が欠落している場合: data-sap-ui-compat-version="edge" を追加
<!-- 修正前 -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_horizon">
</script>
<!-- 修正後 -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-async="true"
data-sap-ui-compat-version="edge"
data-sap-ui-theme="sap_horizon">
</script>
no-deprecated-api — 非推奨の値
data-sap-ui-async="false": "true" に変更
data-sap-ui-compat-version に edge 以外の値が設定されている場合: "edge" に変更
no-deprecated-api — 廃止済みパラメータ(完全に削除)
以下のパラメータは完全に削除してください:
data-sap-ui-no-duplicate-ids— モダン UI5 では強制適用済みdata-sap-ui-auto-aria-body-role— モダン UI5 で廃止data-sap-ui-manifest-first— 代わりにComponent.createの manifest オプションを使用data-sap-ui-origin-info— サポート終了data-sap-ui-areas— 代わりにControl.placeAtを使用data-sap-ui-trace— サポート終了data-sap-ui-xx-no-less— サポート終了
no-deprecated-api — 冗長なパラメータ
data-sap-ui-binding-syntax="simple"— 削除(モダン UI5 では complex 構文が強制適用)data-sap-ui-binding-syntax="complex"—compat-version="edge"が設定されている場合は削除data-sap-ui-preloadに無効な値が指定されている場合 — 削除
no-deprecated-api — 置き換えが必要なパラメータ
data-sap-ui-animation→data-sap-ui-animation-mode(値の変換:true→full、false→minimal)
no-deprecated-theme — 非推奨テーマ
以下のテーマをモダンなテーマに置き換えてください:
sap_bluecrystal→sap_horizonsap_belize→sap_horizonsap_belize_plus→sap_horizonsap_belize_hcb→sap_horizon_hcbsap_belize_hcw→sap_horizon_hcwsap_hcb→sap_horizon_hcbsap_ux→sap_horizonsap_platinum→sap_horizonsap_goldreflection→sap_horizon
no-deprecated-library — 非推奨ライブラリ
以下の非推奨ライブラリを data-sap-ui-libs から削除してください:
sap.ui.commonssap.ui.ux3sap.makitsap.mesap.ca.uisap.sac.gridsap.ui.suitesap.zen.commonssap.zen.crosstabsap.zen.dsh
実装手順
- HTML ファイルを読み込む
- ブートストラップ script タグを解析して特定する
- 各リンターエラー(ルール ID とメッセージで識別)に対して以下を実行:
- パラメータが欠落している場合: 推奨値でパラメータを追加
- 非推奨の値が使用されている場合: 推奨値に更新
- 廃止済み・冗長な場合: パラメータを削除
- 非推奨テーマの場合: モダンなテーマに置換
- 非推奨ライブラリの場合: libs リストから削除
- インデントや改行などの書式をできる限り保持する
- 更新したファイルを書き出す
修正例
リンター出力:
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async' no-deprecated-api
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-compat-version' no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed no-deprecated-api
index.html:10:3 error Use of deprecated theme 'sap_bluecrystal' no-deprecated-theme
変換内容:
<!-- 修正前 -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-no-duplicate-ids="true"
data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>
<!-- 修正後 -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-async="true"
data-sap-ui-compat-version="edge"
data-sap-ui-theme="sap_horizon"
data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>
注意事項
- 一貫性のため、
data-sap-ui-async="true"は常に他の data 属性より前に追加してください compat-version="edge"を設定すると complex バインディング構文が自動的に有効になるため、binding-syntaxは冗長になります- 削除したパラメータの箇所に余分な空白や空行を残さないようにしてください
- ファイルに複数の script タグが含まれている場合は、ブートストラップタグのみを変更し、その他(フェーズ 5 の CSP コンプライアンス処理で対応するインライン
<script>ブロックを含む)はすべてそのまま残してください
原文(English)を表示
Fix Bootstrap Parameters
Key Rules
- ONLY modify the bootstrap
<script>tag (identified byid="sap-ui-bootstrap"orsrcmatchingsap-ui-core.js). All other<script>tags — including inline scripts, config blocks, and non-UI5 script references — MUST be preserved exactly as-is. They will be handled byfix-csp-compliancein a later phase. - Do not delete, move, or rewrite any
<script>block that is not the bootstrap tag. If the file has<script>window.config = {...}</script>before or after the bootstrap tag, leave it untouched.
This skill fixes HTML bootstrap parameter issues that the UI5 linter detects but cannot auto-fix because the changes may affect application behavior.
Linter Rules Handled
| Rule ID | Message Pattern | This Skill's Action |
|---|---|---|
no-deprecated-api |
Missing bootstrap parameter 'data-sap-ui-async' | Add data-sap-ui-async="true" |
no-deprecated-api |
Missing bootstrap parameter 'data-sap-ui-compat-version' | Add data-sap-ui-compat-version="edge" |
no-deprecated-api |
Use of deprecated value 'false' for bootstrap parameter 'data-sap-ui-async' | Change to "true" |
no-deprecated-api |
Use of deprecated value '...' for bootstrap parameter 'data-sap-ui-compat-version' | Change to "edge" |
no-deprecated-api |
Abandoned bootstrap parameter '...' should be removed | Remove the parameter |
no-deprecated-api |
Redundant bootstrap parameter '...' should be removed | Remove the parameter |
no-deprecated-api |
Bootstrap parameter '...' should be replaced with '...' | Replace with new parameter |
no-deprecated-theme |
Use of deprecated theme '...' | Change to sap_horizon |
no-deprecated-library |
Use of deprecated library '...' | Remove from libs |
When to Use
Apply this skill when you see linter output like:
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async' no-deprecated-api
index.html:9:3 error Missing bootstrap parameter 'data-sap-ui-compat-version' no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed no-deprecated-api
index.html:15:3 error Use of deprecated theme 'sap_bluecrystal' no-deprecated-theme
Fix Strategy
1. Locate the Bootstrap Script Tag
Find the <script> tag with either:
id="sap-ui-bootstrap"srcattribute matching pattern:sap-ui-core.js,sap-ui-custom.js,sap-ui-boot.js, etc.
2. Apply Fixes Based on Rule and Message
no-deprecated-api - Missing Parameters
Missing data-sap-ui-async: Add data-sap-ui-async="true"
Missing data-sap-ui-compat-version: Add data-sap-ui-compat-version="edge"
<!-- Before -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_horizon">
</script>
<!-- After -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-async="true"
data-sap-ui-compat-version="edge"
data-sap-ui-theme="sap_horizon">
</script>
no-deprecated-api - Deprecated Values
data-sap-ui-async="false": Change to "true"
data-sap-ui-compat-version with non-edge value: Change to "edge"
no-deprecated-api - Abandoned Parameters (remove completely)
Remove these parameters entirely:
data-sap-ui-no-duplicate-ids- Enforced in modern UI5data-sap-ui-auto-aria-body-role- Removed in modern UI5data-sap-ui-manifest-first- Use Component.create manifest option insteaddata-sap-ui-origin-info- No longer supporteddata-sap-ui-areas- Use Control.placeAt insteaddata-sap-ui-trace- No longer supporteddata-sap-ui-xx-no-less- No longer supported
no-deprecated-api - Redundant Parameters
data-sap-ui-binding-syntax="simple"- Remove; complex syntax is enforced in modern UI5data-sap-ui-binding-syntax="complex"- Remove ifcompat-version="edge"is setdata-sap-ui-preloadwith invalid values - Remove
no-deprecated-api - Replaced Parameters
data-sap-ui-animation→data-sap-ui-animation-mode(converttrue→full,false→minimal)
no-deprecated-theme - Deprecated Themes
Replace with modern theme:
sap_bluecrystal→sap_horizonsap_belize→sap_horizonsap_belize_plus→sap_horizonsap_belize_hcb→sap_horizon_hcbsap_belize_hcw→sap_horizon_hcwsap_hcb→sap_horizon_hcbsap_ux→sap_horizonsap_platinum→sap_horizonsap_goldreflection→sap_horizon
no-deprecated-library - Deprecated Libraries
Remove deprecated libraries from data-sap-ui-libs:
sap.ui.commonssap.ui.ux3sap.makitsap.mesap.ca.uisap.sac.gridsap.ui.suitesap.zen.commonssap.zen.crosstabsap.zen.dsh
Implementation Steps
- Read the HTML file
- Parse to find the bootstrap script tag
- For each linter error (identified by rule ID and message):
- If missing parameter: Add the parameter with recommended value
- If deprecated value: Update to recommended value
- If abandoned/redundant: Remove the parameter
- If deprecated theme: Replace with modern theme
- If deprecated library: Remove from libs list
- Preserve formatting (indentation, line breaks) as much as possible
- Write the updated file
Example Fix
Given linter output:
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async' no-deprecated-api
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-compat-version' no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed no-deprecated-api
index.html:10:3 error Use of deprecated theme 'sap_bluecrystal' no-deprecated-theme
Transform:
<!-- Before -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-no-duplicate-ids="true"
data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>
<!-- After -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-async="true"
data-sap-ui-compat-version="edge"
data-sap-ui-theme="sap_horizon"
data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>
Notes
- Always add
data-sap-ui-async="true"before other data attributes for consistency - Setting
compat-version="edge"enables complex binding syntax automatically, sobinding-syntaxbecomes redundant - Removed parameters should not leave trailing whitespace or empty lines
- If the file has multiple script tags, only modify the bootstrap tag — leave all others intact (including inline
<script>blocks that will be handled by CSP compliance in Phase 5)
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。