@@ -44,13 +44,16 @@ const categories = [
44
44
! entry [ 1 ] . meta . deprecated &&
45
45
entry [ 1 ] . meta . docs . category === category
46
46
)
47
- )
47
+ )
48
48
49
49
// Throw if an invalid category has been used
50
50
for ( const entry of rules ) {
51
51
const category = entry [ 1 ] . meta . docs . category
52
52
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
+ }
54
57
}
55
58
}
56
59
@@ -59,7 +62,8 @@ const categoryTitles = {
59
62
essential : 'Priority A: Essential (Error Prevention)' ,
60
63
'strongly-recommended' : 'Priority B: Strongly Recommended (Improving Readability)' ,
61
64
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'
63
67
}
64
68
65
69
// Throw if no title is defined for a category
@@ -71,18 +75,29 @@ for (const category of categories) {
71
75
72
76
const rulesTableContent = categories . map ( category => `
73
77
### ${ categoryTitles [ category ] }
74
-
78
+ ${
79
+ category === 'uncategorized' ? '' : `
75
80
Enforce all the rules in this category, as well as all higher priority rules, with:
76
81
77
82
\`\`\` json
78
83
"extends": "plugin:vue/${ category } "
79
84
\`\`\`
80
-
85
+ `
86
+ }
81
87
| | Rule ID | Description |
82
88
|:---|:--------|:------------|
83
89
${
84
90
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
+ )
86
101
. map ( entry => {
87
102
const name = entry [ 0 ]
88
103
const meta = entry [ 1 ] . meta
112
127
return `| ${ link } | ${ replacedBy } |`
113
128
} )
114
129
. join ( '\n' )
115
- }
130
+ }
116
131
`
117
132
118
133
categories . forEach ( ( category , categoryIndex ) => {
134
+ if ( category === 'uncategorized' ) return
119
135
createRulesFile ( category , categories . slice ( 0 , categoryIndex + 1 ) )
120
136
} )
121
137
0 commit comments