@@ -44,13 +44,16 @@ const categories = [
4444 ! entry [ 1 ] . meta . deprecated &&
4545 entry [ 1 ] . meta . docs . category === category
4646 )
47- )
47+ )
4848
4949// Throw if an invalid category has been used
5050for ( const entry of rules ) {
5151 const category = entry [ 1 ] . meta . docs . category
5252 if ( ! categories . includes ( category ) ) {
53- throw new Error ( `Rule category ${ category } from ${ entry [ 0 ] } is invalid` )
53+ categories . push ( 'uncategorized' )
54+ if ( category ) {
55+ throw new Error ( `Rule category ${ category } from ${ entry [ 0 ] } is invalid` )
56+ }
5457 }
5558}
5659
@@ -59,7 +62,8 @@ const categoryTitles = {
5962 essential : 'Priority A: Essential (Error Prevention)' ,
6063 'strongly-recommended' : 'Priority B: Strongly Recommended (Improving Readability)' ,
6164 recommended : 'Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)' ,
62- 'use-with-caution' : 'Priority D: Use with Caution (Potentially Dangerous Patterns)'
65+ 'use-with-caution' : 'Priority D: Use with Caution (Potentially Dangerous Patterns)' ,
66+ uncategorized : 'Uncategorized'
6367}
6468
6569// Throw if no title is defined for a category
@@ -71,18 +75,29 @@ for (const category of categories) {
7175
7276const rulesTableContent = categories . map ( category => `
7377### ${ categoryTitles [ category ] }
74-
78+ ${
79+ category === 'uncategorized' ? '' : `
7580Enforce all the rules in this category, as well as all higher priority rules, with:
7681
7782\`\`\` json
7883"extends": "plugin:vue/${ category } "
7984\`\`\`
80-
85+ `
86+ }
8187| | Rule ID | Description |
8288|:---|:--------|:------------|
8389${
8490 rules
85- . filter ( entry => entry [ 1 ] . meta . docs . category === category && ! entry [ 1 ] . meta . deprecated )
91+ . filter ( entry =>
92+ (
93+ category === 'uncategorized' &&
94+ ! entry [ 1 ] . meta . docs . category
95+ ) ||
96+ (
97+ entry [ 1 ] . meta . docs . category === category &&
98+ ! entry [ 1 ] . meta . deprecated
99+ )
100+ )
86101 . map ( entry => {
87102 const name = entry [ 0 ]
88103 const meta = entry [ 1 ] . meta
112127 return `| ${ link } | ${ replacedBy } |`
113128 } )
114129 . join ( '\n' )
115- }
130+ }
116131`
117132
118133categories . forEach ( ( category , categoryIndex ) => {
134+ if ( category === 'uncategorized' ) return
119135 createRulesFile ( category , categories . slice ( 0 , categoryIndex + 1 ) )
120136} )
121137
0 commit comments