Skip to content

Commit 1ff02d4

Browse files
committed
feat(deps): update eslint-plugin-perfectionist to v5
- bump package eslint-plugin-perfectionist from ^4.15.1 to ^5.3.1 - migrate configuration of eslint-plugin-perfectionist - remove obsolete `newlinesBetween` configuration as it is now the default value
1 parent 50e5f1a commit 1ff02d4

File tree

5 files changed

+252
-97
lines changed

5 files changed

+252
-97
lines changed

configs/base.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ module.exports = defineConfig(
102102
{
103103
...perfectionist.configs['recommended-natural'].rules['perfectionist/sort-imports'][1],
104104
groups: SORT_IMPORTS_GROUPS,
105-
newlinesBetween: 'ignore',
106105
},
107106
],
108107
'perfectionist/sort-intersection-types': [

configs/react.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,30 @@ module.exports = defineConfig(
6060
'perfectionist/sort-imports': [
6161
'error',
6262
{
63-
customGroups: {
64-
type: {
65-
react: ['react'],
63+
customGroups: [
64+
{
65+
elementNamePattern: ['^react$'],
66+
groupName: 'react',
6667
},
67-
value: {
68-
react: ['react'],
69-
},
70-
},
68+
],
7169
groups: ['react', ...SORT_IMPORTS_GROUPS],
7270
ignoreCase: true,
73-
newlinesBetween: 'ignore',
7471
type: 'natural',
7572
},
7673
],
7774
'perfectionist/sort-jsx-props': [
7875
'error',
7976
{
80-
customGroups: {
81-
callback: '^on.+',
82-
reservedProps: ['children', 'dangerouslySetInnerHTML', 'key', 'ref'], // Reserved props from: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/jsx-sort-props.js#L41-L46
83-
},
77+
customGroups: [
78+
{
79+
elementNamePattern: '^on.+',
80+
groupName: 'callback',
81+
},
82+
{
83+
elementNamePattern: ['children', 'dangerouslySetInnerHTML', 'key', 'ref'], // Reserved props from: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/jsx-sort-props.js#L41-L46
84+
groupName: 'reservedProps',
85+
},
86+
],
8487
groups: ['reservedProps', 'unknown', 'callback'],
8588
ignoreCase: true,
8689
type: 'natural',

lib/eslint-plugin-perfectionist.js

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
* The following group names are available for configuration: https://eslint-plugin-perfectionist.azat.io/rules/sort-imports#groups
66
*/
77
const SORT_IMPORTS_GROUPS = [
8-
['builtin', 'builtin-type'],
9-
['external', 'external-type'],
10-
['internal', 'internal-type'],
11-
['parent', 'parent-type', 'sibling', 'sibling-type', 'index', 'index-type'],
12-
'style',
13-
['side-effect-style', 'side-effect'],
14-
'object',
8+
['value-builtin', 'named-type-builtin'],
9+
['value-external', 'named-type-external'],
10+
['value-internal', 'named-type-internal'],
11+
['value-parent', 'named-type-parent'],
12+
['value-sibling', 'named-type-sibling'],
13+
['value-index', 'named-type-index'],
14+
'value-style',
15+
['value-side-effect-style', 'value-side-effect'],
16+
'value-ts-equals-import',
1517
'unknown',
1618
];
1719

1820
/**
19-
* This is the the groups configuration of all the recommended configs by eslint-plugin-perfectionist.
21+
* This is the the default groups configuration of all the recommended configs by eslint-plugin-perfectionist.
2022
* This array can be used to reconfigure some options of the perfectionist/sort-classes rule without
2123
* overwriting the groups configuration of this rule.
2224
* This config can be found here:
@@ -25,19 +27,31 @@ const SORT_IMPORTS_GROUPS = [
2527
*/
2628
const SORT_CLASSES_GROUPS = [
2729
'index-signature',
28-
'static-property',
29-
'private-property',
30-
'property',
31-
'constructor',
32-
'static-method',
33-
'private-method',
34-
'method',
30+
['static-property', 'static-accessor-property'],
31+
['static-get-method', 'static-set-method'],
32+
['protected-static-property', 'protected-static-accessor-property'],
33+
['protected-static-get-method', 'protected-static-set-method'],
34+
['private-static-property', 'private-static-accessor-property'],
35+
['private-static-get-method', 'private-static-set-method'],
36+
'static-block',
37+
['property', 'accessor-property'],
3538
['get-method', 'set-method'],
39+
['protected-property', 'protected-accessor-property'],
40+
['protected-get-method', 'protected-set-method'],
41+
['private-property', 'private-accessor-property'],
42+
['private-get-method', 'private-set-method'],
43+
'constructor',
44+
['static-method', 'static-function-property'],
45+
['protected-static-method', 'protected-static-function-property'],
46+
['private-static-method', 'private-static-function-property'],
47+
['method', 'function-property'],
48+
['protected-method', 'protected-function-property'],
49+
['private-method', 'private-function-property'],
3650
'unknown',
3751
];
3852

3953
/**
40-
* This array can be used to configure the perfectionist/sort-intersection-types rule.
54+
* Customized configuration to configure the perfectionist/sort-intersection-types rule.
4155
* The following group names are available for configuration: https://perfectionist.dev/rules/sort-intersection-types#groups
4256
*/
4357
const SORT_INTERSECTION_TYPES_GROUPS = [

0 commit comments

Comments
 (0)