-
Notifications
You must be signed in to change notification settings - Fork 0
/
perfectionist.cjs
91 lines (82 loc) · 2.77 KB
/
perfectionist.cjs
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
const perfectionist = require('eslint-plugin-perfectionist');
const tseslint = require('typescript-eslint');
// https://perfectionist.dev/
const recommendedNatural = perfectionist.configs['recommended-natural'];
Object.keys(recommendedNatural.rules).forEach((name) => {
recommendedNatural.rules[name][1].ignoreCase = false;
});
module.exports = {
flat: [recommendedNatural],
legacy: {
extends: ['plugin:perfectionist/recommended-natural-legacy'],
},
recommended: tseslint.config(
{
rules: {
...recommendedNatural.rules,
// https://perfectionist.dev/rules/sort-imports
'perfectionist/sort-imports': [
'error',
{
...recommendedNatural.rules['perfectionist/sort-imports'][1],
groups: [
'type',
['builtin', 'external'],
'internal-type',
'internal',
['parent-type', 'sibling-type', 'index-type'],
['parent', 'sibling', 'index'],
'object',
'side-effect',
'style',
'unknown',
],
internalPattern: [
'@/**', // next.js default pattern
'~/**', // remix default pattern
],
},
],
// https://perfectionist.dev/rules/sort-jsx-props
'perfectionist/sort-jsx-props': [
'error',
{
...recommendedNatural.rules['perfectionist/sort-jsx-props'][1],
customGroups: {
reserved: '{key,ref}',
},
groups: ['reserved', 'unknown'],
},
],
// https://perfectionist.dev/rules/sort-union-types
'perfectionist/sort-union-types': [
'error',
{
...recommendedNatural.rules['perfectionist/sort-union-types'][1],
groups: ['unknown', 'nullish'],
},
],
},
},
{
rules: {
// https://perfectionist.dev/rules/sort-interfaces
// https://perfectionist.dev/rules/sort-object-types
'@typescript-eslint/adjacent-overload-signatures': 'off',
// https://perfectionist.dev/rules/sort-intersection-types
// https://perfectionist.dev/rules/sort-union-types
'@typescript-eslint/sort-type-constituents': 'off',
// https://perfectionist.dev/rules/sort-imports
// https://perfectionist.dev/rules/sort-named-imports
'import/order': 'off',
// https://perfectionist.dev/rules/sort-jsx-props
'react/jsx-sort-props': 'off',
// https://perfectionist.dev/rules/sort-imports
// https://perfectionist.dev/rules/sort-named-imports
'sort-imports': 'off',
// https://perfectionist.dev/rules/sort-objects
'sort-keys': 'off',
},
},
),
};