@@ -16,30 +16,55 @@ const rule: TextlintRuleModule<Options> = (context, options = {}) => {
1616 const disableBoldListItems = options . disableBoldListItems ?? false ;
1717 const disableEmojiListItems = options . disableEmojiListItems ?? false ;
1818
19- // AI-like emoji patterns commonly used in lists
20- const emojiPatterns = [
19+ // Pattern to detect "flashy" emojis commonly used in AI-generated content
20+ // Using explicit list of decorative emojis that give mechanical impression
21+ const flashyEmojis = [
22+ // Check marks and status indicators
2123 "✅" ,
2224 "❌" ,
2325 "⭐" ,
24- "💡" ,
26+ "✨" ,
27+ "💯" ,
28+ // Warning and attention symbols
29+ "⚠️" ,
30+ "❗" ,
31+ "❓" ,
32+ "💥" ,
33+ // Energy and fire symbols
2534 "🔥" ,
26- "📝" ,
2735 "⚡" ,
28- "🎯 " ,
36+ "💪 " ,
2937 "🚀" ,
30- "🎉" ,
31- "📌" ,
32- "🔍" ,
33- "💰" ,
38+ // Ideas and thinking
39+ "💡" ,
40+ "🤔" ,
41+ "💭" ,
42+ "🧠" ,
43+ // Targets and goals
44+ "🎯" ,
45+ "📈" ,
3446 "📊" ,
35- "🔧" ,
36- "⚠️" ,
37- "❗" ,
38- "💻" ,
39- "📱" ,
40- "🌟"
47+ "🏆" ,
48+ // Common decorative symbols
49+ "👍" ,
50+ "👎" ,
51+ "😊" ,
52+ "😎" ,
53+ "🎉" ,
54+ "🌟" ,
55+ // Work and productivity
56+ "📝" ,
57+ "📋" ,
58+ "✏️" ,
59+ "🖊️" ,
60+ "💼"
4161 ] ;
4262
63+ // Create pattern from explicit emoji list
64+ // Need to escape special regex characters
65+ const escapedEmojis = flashyEmojis . map ( ( emoji ) => emoji . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, "\\$&" ) ) ;
66+ const flashyEmojiPattern = new RegExp ( `(${ escapedEmojis . join ( "|" ) } )` ) ;
67+
4368 return {
4469 [ Syntax . ListItem ] ( node ) {
4570 const text = getSource ( node ) ;
@@ -72,19 +97,18 @@ const rule: TextlintRuleModule<Options> = (context, options = {}) => {
7297
7398 // Check for emoji list items
7499 if ( ! disableEmojiListItems ) {
75- for ( const emoji of emojiPatterns ) {
76- const emojiIndex = text . indexOf ( emoji ) ;
77- if ( emojiIndex !== - 1 ) {
78- const matchRange = [ emojiIndex , emojiIndex + emoji . length ] as const ;
79- const ruleError = new RuleError (
80- `リストアイテムでの絵文字「${ emoji } 」の使用は、読み手によっては機械的な印象を与える場合があります。テキストベースの表現も検討してみてください。` ,
81- {
82- padding : locator . range ( matchRange )
83- }
84- ) ;
85- report ( node , ruleError ) ;
86- break ; // Only report the first emoji found in each list item
87- }
100+ const emojiMatch = text . match ( flashyEmojiPattern ) ;
101+ if ( emojiMatch ) {
102+ const emoji = emojiMatch [ 0 ] ;
103+ const emojiIndex = emojiMatch . index ?? 0 ;
104+ const matchRange = [ emojiIndex , emojiIndex + emoji . length ] as const ;
105+ const ruleError = new RuleError (
106+ `リストアイテムでの絵文字「${ emoji } 」の使用は、読み手によっては機械的な印象を与える場合があります。テキストベースの表現も検討してみてください。` ,
107+ {
108+ padding : locator . range ( matchRange )
109+ }
110+ ) ;
111+ report ( node , ruleError ) ;
88112 }
89113 }
90114 }
0 commit comments