Skip to content

Commit 5485406

Browse files
committed
fix: 番号付きリスト(ordered list)内の太字+コロンパターンを検知する
`no-ai-list-formatting` の太字+コロンパターンの正規表現が リストマーカーとして `[-*+]` のみを対象としていたため、 `1. **label**: description` のような番号付きリストが検知されなかった。 正規表現に `\d+[.)]` を追加し、番号付きリストでも検知されるようにした。
1 parent c7da636 commit 5485406

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/rules/no-ai-list-formatting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const rule: TextlintRuleModule<Options> = (context: TextlintRuleContext, options
7979

8080
// Check for bold list item pattern: - **text**: description
8181
if (!disableBoldListItems) {
82-
const boldListPattern = /^[\s]*[-*+]\s+\*\*([^*]+)\*\*\s*([:])/;
82+
const boldListPattern = /^[\s]*(?:[-*+]|\d+[.)])\s+\*\*([^*]+)\*\*\s*([:])/;
8383
const boldMatch: RegExpMatchArray | null = text.match(boldListPattern);
8484
if (boldMatch) {
8585
const matchStart: number = boldMatch.index ?? 0;

test/rules/no-ai-list-formatting.test.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ tester.run("no-ai-list-formatting", noAiListFormatting, {
5656
"- 🍎 りんご",
5757
"- 🐱 猫",
5858
"- 🌸 桜",
59-
"- ❤️ ハート"
59+
"- ❤️ ハート",
60+
// Normal ordered list items (no bold+colon pattern)
61+
"1. 通常の番号付きリストアイテム",
62+
"2. これは問題ない記述です"
6063
],
6164
invalid: [
6265
// Bold list item pattern
@@ -176,6 +179,39 @@ tester.run("no-ai-list-formatting", noAiListFormatting, {
176179
}
177180
]
178181
},
182+
// Ordered list with bold+colon pattern (dot separator)
183+
{
184+
text: "1. **重要**: これは重要な項目です",
185+
errors: [
186+
{
187+
message:
188+
"リストアイテムで強調(**)とコロン(:)の組み合わせは機械的な印象を与える可能性があります。より自然な表現を検討してください。",
189+
range: [0, 10]
190+
}
191+
]
192+
},
193+
// Ordered list with bold+colon pattern (parenthesis separator)
194+
{
195+
text: "2) **注意**: 注意が必要な項目です",
196+
errors: [
197+
{
198+
message:
199+
"リストアイテムで強調(**)とコロン(:)の組み合わせは機械的な印象を与える可能性があります。より自然な表現を検討してください。",
200+
range: [0, 10]
201+
}
202+
]
203+
},
204+
// Ordered list with bold+full-width colon pattern
205+
{
206+
text: "1. **重要情報**:これは重要な項目です",
207+
errors: [
208+
{
209+
message:
210+
"リストアイテムで強調(**)とコロン(:)の組み合わせは機械的な印象を与える可能性があります。より自然な表現を検討してください。",
211+
range: [0, 12]
212+
}
213+
]
214+
},
179215
// Full-width colon
180216
{
181217
text: "- **重要情報**:これは重要な項目です",

0 commit comments

Comments
 (0)