1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
| import type { Linter } from 'eslint';
|
| import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
| export async function perfectionist(): Promise<Linter.Config[]> {
| return [
| perfectionistPlugin.configs['recommended-natural'],
| {
| rules: {
| 'perfectionist/sort-exports': [
| 'error',
| {
| order: 'asc',
| type: 'natural',
| },
| ],
| 'perfectionist/sort-imports': [
| 'error',
| {
| customGroups: {
| type: {
| vben: 'vben',
| vue: 'vue',
| },
| value: {
| vben: ['@vben*', '@vben/**/**', '@vben-core/**/**'],
| vue: ['vue', 'vue-*', '@vue*'],
| },
| },
| groups: [
| ['external-type', 'builtin-type', 'type'],
| ['parent-type', 'sibling-type', 'index-type'],
| ['internal-type'],
| 'builtin',
| 'vue',
| 'vben',
| 'external',
| 'internal',
| ['parent', 'sibling', 'index'],
| 'side-effect',
| 'side-effect-style',
| 'style',
| 'object',
| 'unknown',
| ],
| internalPattern: ['#*', '#*/**'],
| newlinesBetween: 'always',
| order: 'asc',
| type: 'natural',
| },
| ],
| 'perfectionist/sort-named-exports': [
| 'error',
| {
| order: 'asc',
| type: 'natural',
| },
| ],
| 'perfectionist/sort-objects': [
| 'error',
| {
| customGroups: {
| items: 'items',
| list: 'list',
| children: 'children',
| },
| groups: ['unknown', 'items', 'list', 'children'],
| ignorePattern: ['children'],
| order: 'asc',
| partitionByComment: 'Part:**',
| type: 'natural',
| },
| ],
| 'perfectionist/sort-vue-attributes': [
| 'error',
| {
| // Based on: https://vuejs.org/style-guide/rules-recommended.html#element-attribute-order
| customGroups: {
| /* eslint-disable perfectionist/sort-objects */
| DEFINITION: '*(is|:is|v-is)',
| LIST_RENDERING: 'v-for',
| CONDITIONALS: 'v-*(else-if|if|else|show|cloak)',
| RENDER_MODIFIERS: 'v-*(pre|once)',
| GLOBAL: '*(:id|id)',
| UNIQUE: '*(ref|key|:ref|:key)',
| SLOT: '*(v-slot|slot)',
| TWO_WAY_BINDING: '*(v-model|v-model:*)',
| // OTHER_DIRECTIVES e.g. 'v-custom-directive'
| EVENTS: '*(v-on|@*)',
| CONTENT: 'v-*(html|text)',
| /* eslint-enable perfectionist/sort-objects */
| },
| groups: [
| 'DEFINITION',
| 'LIST_RENDERING',
| 'CONDITIONALS',
| 'RENDER_MODIFIERS',
| 'GLOBAL',
| 'UNIQUE',
| 'SLOT',
| 'TWO_WAY_BINDING',
| 'unknown',
| 'EVENTS',
| 'CONTENT',
| ],
| type: 'natural',
| },
| ],
| },
| },
| ];
| }
|
|