Skip to content

Commit b75947f

Browse files
committed
feat: turn on perfectionist/sort-vue-attributes
1 parent 0308654 commit b75947f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/configs/perfectionist.ts

+34
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,40 @@ export function perfectionist(): TypedFlatConfigItem[] {
4545
'warn',
4646
{ groupKind: 'values-first' },
4747
],
48+
'perfectionist/sort-vue-attributes': [
49+
'error',
50+
{
51+
// Based on: https://vuejs.org/style-guide/rules-recommended.html#element-attribute-order
52+
customGroups: {
53+
CONDITIONALS: 'v-*(else-if|if|else|show|cloak)',
54+
CONTENT: 'v-*(html|text)',
55+
DEFINITION: '*(is|:is|v-is)',
56+
// OTHER_DIRECTIVES e.g. 'v-custom-directive'
57+
EVENTS: '*(v-on|@*)',
58+
GLOBAL: '*(:id|id)',
59+
LIST_RENDERING: 'v-for',
60+
RENDER_MODIFIERS: 'v-*(pre|once)',
61+
SLOT: '*(v-slot|slot)',
62+
TWO_WAY_BINDING: '*(v-model|v-model:*)',
63+
UNIQUE: '*(ref|key|:ref|:key)',
64+
65+
},
66+
groups: [
67+
'DEFINITION',
68+
'LIST_RENDERING',
69+
'CONDITIONALS',
70+
'RENDER_MODIFIERS',
71+
'GLOBAL',
72+
'UNIQUE',
73+
'SLOT',
74+
'TWO_WAY_BINDING',
75+
'unknown',
76+
'EVENTS',
77+
'CONTENT',
78+
],
79+
type: 'natural',
80+
},
81+
],
4882
},
4983
},
5084
]

0 commit comments

Comments
 (0)