-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint-plugin-perfectionist.js
More file actions
87 lines (83 loc) · 3.04 KB
/
eslint-plugin-perfectionist.js
File metadata and controls
87 lines (83 loc) · 3.04 KB
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
/**
* Opinionated 'default' settings for eslint-plugin-perfectionist.
* @see https://perfectionist.dev/guide/getting-started#settings
*/
const PERFECTIONIST_SETTINGS = {
ignoreCase: true, // Ignore case when sorting
type: 'natural',
};
/**
* While the sorting of imports is done by `eslint-plugin-perfectionist/sort-imports`,
* the order and grouping of imports is still taken from the previous configuration of `eslint-plugin-import/order`,
* as it feels more natural.
* The following group names are available for configuration: https://eslint-plugin-perfectionist.azat.io/rules/sort-imports#groups
*/
const SORT_IMPORTS_GROUPS = [
['value-builtin', 'named-type-builtin'],
['value-external', 'named-type-external'],
['value-internal', 'named-type-internal'],
['value-parent', 'named-type-parent'],
['value-sibling', 'named-type-sibling'],
['value-index', 'named-type-index'],
'value-style',
['value-side-effect-style', 'value-side-effect'],
'value-ts-equals-import',
'unknown',
];
/**
* This is the the default groups configuration of all the recommended configs by eslint-plugin-perfectionist.
* This array can be used to reconfigure some options of the perfectionist/sort-classes rule without
* overwriting the groups configuration of this rule.
* This config can be found here:
* - https://eslint-plugin-perfectionist.azat.io/rules/sort-classes#groups
* - https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/index.ts#L61
*/
const SORT_CLASSES_GROUPS = [
'index-signature',
['static-property', 'static-accessor-property'],
['static-get-method', 'static-set-method'],
['protected-static-property', 'protected-static-accessor-property'],
['protected-static-get-method', 'protected-static-set-method'],
['private-static-property', 'private-static-accessor-property'],
['private-static-get-method', 'private-static-set-method'],
'static-block',
['property', 'accessor-property'],
['get-method', 'set-method'],
['protected-property', 'protected-accessor-property'],
['protected-get-method', 'protected-set-method'],
['private-property', 'private-accessor-property'],
['private-get-method', 'private-set-method'],
'constructor',
['static-method', 'static-function-property'],
['protected-static-method', 'protected-static-function-property'],
['private-static-method', 'private-static-function-property'],
['method', 'function-property'],
['protected-method', 'protected-function-property'],
['private-method', 'private-function-property'],
'unknown',
];
/**
* Customized configuration to configure the perfectionist/sort-intersection-types rule.
* The following group names are available for configuration: https://perfectionist.dev/rules/sort-intersection-types#groups
*/
const SORT_INTERSECTION_TYPES_GROUPS = [
'conditional',
'function',
'import',
'intersection',
'union',
'named',
'keyword',
'literal',
'operator',
'tuple',
'object',
'nullish',
'unknown',
];
export {
PERFECTIONIST_SETTINGS,
SORT_CLASSES_GROUPS,
SORT_IMPORTS_GROUPS,
SORT_INTERSECTION_TYPES_GROUPS,
};