Skip to content

feat(markuplint)!: upgrade markuplint to v5.0.0-alpha.3#841

Draft
YusukeHirao wants to merge 6 commits intodevfrom
feat/markuplint-v5
Draft

feat(markuplint)!: upgrade markuplint to v5.0.0-alpha.3#841
YusukeHirao wants to merge 6 commits intodevfrom
feat/markuplint-v5

Conversation

@YusukeHirao
Copy link
Copy Markdown
Member

概要

markuplint を v4.14.0 から v5.0.0-alpha.3 にアップグレードし、v5 の新機能・新ルールを導入する。

変更内容

パッケージバージョン更新

  • markuplint: 4.14.05.0.0-alpha.3
  • @markuplint/pug-parser: 4.6.235.0.0-alpha.3

v5 Named Rule Groups への移行

D-ZERO 独自ルール(nodeRules)に name プロパティを追加し、v5 の Named Rule Groups 形式に変換。
これにより違反メッセージに [d-zero/rule-name] のようなラベルが付与され、どのルールによる違反か特定しやすくなる。

対象ルール:

  • d-zero/html-allow-prefix-attr
  • d-zero/img-require-alt
  • d-zero/img-src-kebab-case
  • d-zero/media-src-kebab-case
  • d-zero/a-href-convention
  • d-zero/button-require-command
  • d-zero/button-prefer-commandfor
  • d-zero/button-prefer-command-action
  • d-zero/no-brrules 内に Named Rule Group として再構成)

v5 新ルールの追加

recommended プリセットに含まれない以下のルールを採用:

ルール 説明
attr-order 属性順序を id > class > role > aria-* > data-* > 要素固有属性 に統一
head-element-order <head> 内要素の順序を検証
no-boolean-attr-value boolean 属性の冗長な値を禁止(例: disabled="disabled"
no-default-value デフォルト値と同一の属性値指定を禁止(例: type="text"
no-use-event-handler-attr インラインイベントハンドラ属性を禁止
no-unsupported-features browserslist 設定に基づくブラウザ未サポート要素・属性の検出

img の performance/img-aspect-ratio 無効化

markuplint:recommended-static-html の performance プリセットに含まれる img[src] に対する width/height 必須ルールを無効化。
ビルド時に自動付与されるため不要。(v4 では nodeRules で上書きしていたが、v5 では rules で直接無効化に変更)

テストの更新

  • テスト出力フォーマットに ruleIdname(Named Rule Group名)を含めるよう変更
  • 全フィクスチャファイルの属性順序を attr-order ルールに準拠するよう修正
  • no-default-value ルールにより冗長な type="text" を削除
  • attr-order 専用テストケースを新規追加(正常5パターン + 違反5パターン)
  • 全110テストパス確認

既知の問題

BREAKING CHANGE

markuplint v5 は ARIA 1.3 をデフォルトで使用する。一部の ARIA 属性の検証結果が v4 と異なる場合がある。

テスト計画

  • yarn test で全110テストパス
  • attr-order テストで正常系・異常系の両方を検証
  • Image Naming / Button Command / Extended Naming のテスト期待値更新済み

🤖 Generated with Claude Code

YusukeHirao and others added 6 commits February 27, 2026 11:03
BREAKING CHANGE: upgrade markuplint and @markuplint/pug-parser to v5.0.0-alpha.3

- Use named rule group to disable performance/img-aspect-ratio
  (width/height are auto-injected at build time)
- Remove outdated nodeRule comment for img required-attr override

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Adjust violation output order for CLI test
- Add new v5 checks: ARIA parent role requirements,
  dialog autofocus, redundant-accessible-name
- Remove class-naming violations from button-command test
  due to v5 -c flag now fully replacing .markuplintrc

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add name properties to all D-ZERO nodeRules (e.g., d-zero/img-require-alt,
d-zero/button-require-command) and convert the disallowed-element rule
to a NamedRuleGroup (d-zero/no-br) for better identification in
violation output.
Add (ruleId) and [name] to markuplint test violation format string
to verify that named rule groups are correctly applied. Update all
test expectations accordingly.
Enable 6 new rules:
- attr-order: id > class > role > aria-* > data-* > element-specific
- head-element-order: enforce optimal <head> element ordering
- no-boolean-attr-value: disallow redundant boolean attribute values
- no-default-value: warn on explicit default attribute values
- no-use-event-handler-attr: disallow inline event handlers
- no-unsupported-features: detect unsupported browser features
  (requires browserslist config, see markuplint/markuplint#3328)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant