Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/rules/no-ai-list-formatting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ const rule: TextlintRuleModule<Options> = (context: TextlintRuleContext, options

// Check for bold list item pattern: - **text**: description
if (!disableBoldListItems) {
const boldListPattern = /^[\s]*[-*+]\s+\*\*([^*]+)\*\*\s*:/;
const boldListPattern = /^[\s]*[-*+]\s+\*\*([^*]+)\*\*\s*([::])/;
const boldMatch: RegExpMatchArray | null = text.match(boldListPattern);
if (boldMatch) {
const matchStart: number = boldMatch.index ?? 0;
const matchEnd = matchStart + boldMatch[0].length;
const matchRange = [matchStart, matchEnd] as const;
const colon = boldMatch[2];
const ruleError = new RuleError(
"リストアイテムで強調(**)とコロン(:)の組み合わせは機械的な印象を与える可能性があります。より自然な表現を検討してください。",
`リストアイテムで強調(**)とコロン(${colon})の組み合わせは機械的な印象を与える可能性があります。より自然な表現を検討してください。`,
{
padding: locator.range(matchRange)
}
Expand Down
11 changes: 11 additions & 0 deletions test/rules/no-ai-list-formatting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ tester.run("no-ai-list-formatting", noAiListFormatting, {
range: [2, 4]
}
]
},
// Full-width colon
{
text: "- **重要情報**:これは重要な項目です",
errors: [
{
message:
"リストアイテムで強調(**)とコロン(:)の組み合わせは機械的な印象を与える可能性があります。より自然な表現を検討してください。",
range: [0, 11]
}
]
}
]
});