File tree 3 files changed +36
-21
lines changed
3 files changed +36
-21
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { getPluginRoot } from './package-json.js';
12
12
import { generateLegend } from './legend.js' ;
13
13
import { relative } from 'node:path' ;
14
14
import { COLUMN_TYPE } from './types.js' ;
15
+ import { markdownTable } from 'markdown-table' ;
15
16
import type {
16
17
Plugin ,
17
18
RuleDetails ,
@@ -109,27 +110,25 @@ function generateRulesListMarkdown(
109
110
: headerStrOrFn ,
110
111
] ;
111
112
} ) ;
112
- const listSpacerRow = Array . from ( { length : listHeaderRow . length } ) . fill (
113
- ':--'
114
- ) ; // Left-align header with colon.
115
- return [
116
- listHeaderRow ,
117
- listSpacerRow ,
118
- ...details
119
- . sort ( ( { name : a } , { name : b } ) => a . localeCompare ( b ) )
120
- . map ( ( rule : RuleDetails ) =>
121
- buildRuleRow (
122
- columns ,
123
- rule ,
124
- configsToRules ,
125
- pluginPrefix ,
126
- configEmojis ,
127
- ignoreConfig
128
- )
129
- ) ,
130
- ]
131
- . map ( ( column ) => [ ...column , ' ' ] . join ( '|' ) )
132
- . join ( '\n' ) ;
113
+
114
+ return markdownTable (
115
+ [
116
+ listHeaderRow ,
117
+ ...details
118
+ . sort ( ( { name : a } , { name : b } ) => a . localeCompare ( b ) )
119
+ . map ( ( rule : RuleDetails ) =>
120
+ buildRuleRow (
121
+ columns ,
122
+ rule ,
123
+ configsToRules ,
124
+ pluginPrefix ,
125
+ configEmojis ,
126
+ ignoreConfig
127
+ )
128
+ ) ,
129
+ ] ,
130
+ { align : 'l' } // Left-align headers.
131
+ ) ;
133
132
}
134
133
135
134
export async function updateRulesList (
Original file line number Diff line number Diff line change 45
45
"dependencies" : {
46
46
"@typescript-eslint/utils" : " ^5.38.1" ,
47
47
"commander" : " ^9.4.0" ,
48
+ "markdown-table" : " ^3.0.2" ,
48
49
"type-fest" : " ^3.0.0"
49
50
},
50
51
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments