@d-zero/markuplint-config 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +39 -0
  2. package/base.js +30 -0
  3. package/package.json +8 -4
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # `@d-zero/markuplint-config`
2
2
 
3
+ D-ZERO用のMarkuplint設定です。アクセシブルで保守性の高いHTML実装を促進するためのルールセットを提供します。
4
+
3
5
  ## 個別インストール
4
6
 
5
7
  ```sh
@@ -16,6 +18,43 @@ npm install -D @d-zero/markuplint-config
16
18
  }
17
19
  ```
18
20
 
21
+ ## 含まれるルール
22
+
23
+ このconfigには以下のD-ZERO独自ルールが含まれています:
24
+
25
+ ### 1. 要素の禁止・必須化
26
+
27
+ - **`br`要素の禁止**: CSSでスタイル調整を推奨
28
+ - **`img`要素のalt属性必須**: アクセシビリティ確保のため
29
+ - **`a`要素のhref属性必須**: リンクの明確化
30
+
31
+ ### 2. button要素のInvoker Commands API使用の強制
32
+
33
+ - **`type="button"`のbutton要素**: `command`属性が必須
34
+ - Invoker Commands APIを使用した宣言的なUI実装を推奨
35
+ - 例外: `role`属性を持つボタン、フォーム送信ボタン(`type="submit"`/`type="reset"`/typeなし)
36
+
37
+ - **`popovertarget`属性を持つボタン**: Invoker Commands APIへの移行を推奨
38
+ - `commandfor`/`command`属性の使用を推奨
39
+ - `popovertarget`は将来的に非推奨となる予定
40
+
41
+ 詳細は[CODING_GUIDELINES_NO_CLICK_EVENT.md](../../CODING_GUIDELINES_NO_CLICK_EVENT.md)を参照してください。
42
+
43
+ ### 3. ファイル名の命名規則
44
+
45
+ - **画像/メディアファイル**: 小文字のケバブケース(ハイフン区切り)を強制
46
+ - 対象: `img`, `video`, `audio`, `source`要素の`src`/`poster`属性
47
+ - 大文字、スペース、アンダースコアは使用不可
48
+
49
+ ### 4. 無効な属性
50
+
51
+ - **`a`要素のhref属性**: `javascript:`スキームを禁止
52
+ - 代わりに`button`要素の使用を推奨
53
+
54
+ ### 5. 特殊な属性の許可
55
+
56
+ - **`html`要素の`prefix`属性**: Open Graph Protocolのため許可
57
+
19
58
  ### 拡張
20
59
 
21
60
  プロジェクトに合わせて設定を追加します。
package/base.js CHANGED
@@ -106,5 +106,35 @@ export default {
106
106
  },
107
107
  },
108
108
  },
109
+ {
110
+ selector: 'button[type=button]:not([role]):not([popovertarget])',
111
+ rules: {
112
+ 'required-attr': {
113
+ value: 'command',
114
+ reason:
115
+ 'button要素には原則としてcommand属性が必要です。Invoker Commands APIを使用してアクセシブルなUIを実装してください。role属性を持つボタン(role="tab"など)やtype="submit"/type="reset"/typeなしのボタンは例外として許可されます。(D-ZERO独自ルール)',
116
+ },
117
+ },
118
+ },
119
+ {
120
+ selector: 'button[popovertarget]',
121
+ rules: {
122
+ 'required-attr': {
123
+ value: 'commandfor',
124
+ reason:
125
+ 'popovertarget属性の代わりにcommandfor属性を使用してください。popovertarget属性は将来的に非推奨となる予定です。(D-ZERO独自ルール)',
126
+ },
127
+ },
128
+ },
129
+ {
130
+ selector: 'button[popovertargetaction]',
131
+ rules: {
132
+ 'required-attr': {
133
+ value: 'command',
134
+ reason:
135
+ 'popovertargetaction属性(show/hide/toggle)の代わりにcommand属性(show-popover/hide-popover/toggle-popover)を使用してください。(D-ZERO独自ルール)',
136
+ },
137
+ },
138
+ },
109
139
  ],
110
140
  };
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@d-zero/markuplint-config",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Configurations of Markuplint",
5
- "repository": "https://github.com/d-zero-dev/linters.git",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/d-zero-dev/linters.git",
8
+ "directory": "packages/@d-zero/markuplint-config"
9
+ },
6
10
  "author": "D-ZERO Co., Ltd.",
7
11
  "license": "MIT",
8
12
  "publishConfig": {
@@ -22,8 +26,8 @@
22
26
  "*.js"
23
27
  ],
24
28
  "dependencies": {
25
- "@markuplint/pug-parser": "4.6.22",
29
+ "@markuplint/pug-parser": "4.6.23",
26
30
  "markuplint": "4.14.0"
27
31
  },
28
- "gitHead": "7f635ad8bbb1455d0d362fe00478a2f7bd216924"
32
+ "gitHead": "645a686188fe078102000e8d59860ec33f2ed750"
29
33
  }