feat(markuplint)!: upgrade markuplint to v5.0.0-rc.7 - #944
Open
YusukeHirao wants to merge 1 commit into
Open
Conversation
BREAKING CHANGE: markuplint v5 requires Node.js >=24. Rule config uses new v5 rule names (require-attr, no-restricted-element, no-unknown-attr, no-restricted-attr, no-malformed-character-reference, no-unescaped-char) in place of their deprecated v4 equivalents. Replaces the stale, alpha.3-based PR #841, whose base had drifted far from dev and no longer applied cleanly against rc.7's rule renames. - Convert D-ZERO custom rules to Named Rule Groups for clearer violation output (eg. [d-zero/no-br]) - Enable new v5 standard rules not in the recommended preset: attr-order, no-boolean-attr-value, no-default-value, no-unsupported-browser-features (head-element-order and no-event-handler-attr are already enabled by the extended performance/security presets, so they are intentionally not re-declared to avoid duplicate violations) - Update fixtures to comply with attr-order and no-default-value, and add dedicated fixtures/tests for attr-order and the new v5 rules
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
markuplint/@markuplint/pug-parserを v4.18.3 から v5.0.0-rc.7 へアップグレードする。PR #841(v5.0.0-alpha.3ベース)は base の
devが既に大きく進んでおり(4.14.0→4.18.3)、rc.7 でのルール名変更にも対応していないため、破棄して現在のdevから作り直した。参考: markuplint v4→v5 migration guide
BREAKING CHANGE
engines.nodeを更新)required-attr→require-attrdisallowed-element→no-restricted-elementinvalid-attr(allowAttrs)→no-unknown-attrinvalid-attr(disallowAttrs)→no-restricted-attrcharacter-reference→no-malformed-character-reference/no-unescaped-charno-use-event-handler-attr→no-event-handler-attr(後述の理由で明示指定は削除)no-unsupported-features→no-unsupported-browser-features変更内容
D-ZERO 独自ルールを v5 Named Rule Groups に変換
nodeRulesにnameを付与し、トップレベルのbr禁止ルールもd-zero/no-brという Named Rule Group にまとめた。違反メッセージに[d-zero/xxx]のようなラベルが付き、どのルールによる違反か特定しやすくなる。v5 標準ルールの追加有効化
recommended プリセットに含まれない以下を有効化:
attr-order: 属性順序をid > class > role > aria-* > data-* > 要素固有属性に統一no-boolean-attr-value: boolean 属性の冗長な値を禁止(例:disabled="disabled")no-default-value: デフォルト値と同一の属性値指定を禁止(例:type="text")no-unsupported-browser-features:browserslist設定に基づくブラウザ未サポート要素・属性の検出(browserslist設定がないプロジェクトでは影響なし)head-element-orderとno-event-handler-attrはmarkuplint:recommended-static-htmlが拡張するperformance/securityプリセットで既に有効になっているため、明示的な再指定はしていない(二重指定すると同一違反が2回報告される不具合になるため意図的に外した)。img の performance/img-aspect-ratio 無効化
img[src]のwidth/height必須ルールを無効化(ビルド時に自動付与されるため不要)。v4 では nodeRules での上書きだったが、v5 では named rule group をトップレベルrulesで直接無効化する形に変更。テスト
attr-order/no-default-valueに準拠するよう属性順序・冗長なtype="text"を修正attr-order-test.html/v5-rules-test.htmlを新規追加し、attr-orderと新規有効化ルール(head-element-order/no-boolean-attr-value/no-default-value/no-event-handler-attr)の発火を個別に検証cli.spec.mjsの期待値を実際の v5.0.0-rc.7 出力に合わせて更新既存バグの修正(今回のPRで触れたついでに修正)
base.jsのscript[src^='https://'], script[src^='https://']セレクタがhttps://を2回指定しておりhttp://が漏れていた(コピペミス)。http://を対象に含めるよう修正。テスト計画
yarn test(137件)全てパスyarn lint(actionlint含む)全てパスyarn build全てパス