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
| import type { Linter } from 'eslint';
|
| import { interopDefault } from '../util';
|
| export async function perfectionist(): Promise<Linter.Config[]> {
| const perfectionistPlugin = await interopDefault(
| import('eslint-plugin-perfectionist'),
| );
|
| return [
| perfectionistPlugin.configs['recommended-natural'],
| {
| rules: {
| 'perfectionist/sort-exports': [
| 'error',
| {
| order: 'asc',
| type: 'natural',
| },
| ],
| 'perfectionist/sort-imports': [
| 'error',
| {
| customGroups: [
| {
| selector: 'type',
| groupName: 'vben-core-type',
| elementNamePattern: '^@vben-core/.+',
| },
| {
| selector: 'type',
| groupName: 'vben-type',
| elementNamePattern: '^@vben/.+',
| },
| {
| selector: 'type',
| groupName: 'vue-type',
| elementNamePattern: ['^vue$', '^vue-.+', '^@vue/.+'],
| },
| {
| groupName: 'vben',
| elementNamePattern: '^@vben/.+',
| },
| {
| groupName: 'vben-core',
| elementNamePattern: '^@vben-core/.+',
| },
| {
| groupName: 'vue',
| elementNamePattern: ['^vue$', '^vue-.+', '^@vue/.+'],
| },
| ],
| environment: 'node',
| groups: [
| ['type-external', 'type-builtin', 'type-import'],
| 'vue-type',
| 'vben-type',
| 'vben-core-type',
| ['type-parent', 'type-sibling', 'type-index'],
| ['type-internal'],
| 'value-builtin',
| 'vue',
| 'vben',
| 'vben-core',
| 'value-external',
| 'value-internal',
| ['value-parent', 'value-sibling', 'value-index'],
| 'side-effect',
| 'side-effect-style',
| 'style',
| 'ts-equals-import',
| 'unknown',
| ],
| internalPattern: ['^#/.+'],
| newlinesBetween: 1,
| order: 'asc',
| type: 'natural',
| },
| ],
| 'perfectionist/sort-modules': 'off',
| 'perfectionist/sort-named-exports': [
| 'error',
| {
| order: 'asc',
| type: 'natural',
| },
| ],
| 'perfectionist/sort-objects': [
| 'off',
| {
| customGroups: {
| items: 'items',
| list: 'list',
| children: 'children',
| },
| groups: ['unknown', 'items', 'list', 'children'],
| ignorePattern: ['children'],
| order: 'asc',
| type: 'natural',
| },
| ],
| },
| },
| ];
| }
|
|