@@ -2,9 +2,10 @@ import { dirname } from 'node:path';
2
2
import { fileURLToPath } from 'node:url' ;
3
3
import importPlugin from 'eslint-plugin-import' ;
4
4
import jest from 'eslint-plugin-jest' ;
5
+ import perfectionist from 'eslint-plugin-perfectionist' ;
5
6
import react from 'eslint-plugin-react' ;
6
7
import reactHooks from 'eslint-plugin-react-hooks' ;
7
- import typescriptSortKeys from 'eslint-plugin-typescript-sort-keys ' ;
8
+ import testingLibrary from 'eslint-plugin-testing-library ' ;
8
9
import unicorn from 'eslint-plugin-unicorn' ;
9
10
import unusedImports from 'eslint-plugin-unused-imports' ;
10
11
import tsEslint from 'typescript-eslint' ;
@@ -15,27 +16,28 @@ const __dirname = dirname(__filename);
15
16
export default [
16
17
...tsEslint . configs . strict ,
17
18
{
18
- files : [ '**/*.js' , '**/*.jsx' , '**/*.ts' , '**/*.tsx' ] ,
19
+ files : [ '**/*.mjs' , '**/*. js', '**/*.jsx' , '**/*.ts' , '**/*.tsx' ] ,
19
20
plugins : {
20
21
import : importPlugin ,
22
+ jest,
23
+ perfectionist,
21
24
react,
22
25
'react-hooks' : reactHooks ,
23
26
unicorn,
24
27
'unused-imports' : unusedImports ,
25
- jest,
26
28
} ,
27
29
rules : {
28
- 'import/no-unresolved' : 0 , // handled by TypeScript
29
- 'unicorn/prefer-top-level-await' : 0 , // not valid on RN for the moment
30
- curly : 2 ,
31
30
// `import/default`, `import/namespace` and `import/no-duplicates` are slow.
31
+ curly : 2 ,
32
32
'import/default' : 0 ,
33
33
'import/named' : 0 ,
34
34
'import/namespace' : 0 ,
35
35
'import/no-duplicates' : 0 ,
36
36
'import/no-extraneous-dependencies' : 2 ,
37
37
'import/no-named-as-default-member' : 0 ,
38
+ 'import/no-unresolved' : 0 ,
38
39
'import/order' : 0 ,
40
+ 'no-console' : 2 ,
39
41
'no-const-assign' : 2 ,
40
42
'no-constant-binary-expression' : 2 ,
41
43
'no-extra-parens' : [ 2 , 'functions' ] ,
@@ -46,14 +48,30 @@ export default [
46
48
'no-unused-vars' : 0 ,
47
49
'no-useless-rename' : 2 ,
48
50
'no-var' : 2 ,
49
- 'no-console' : 2 ,
50
51
'no-warning-comments' : [ 2 , { terms : [ '@nocommit' ] } ] ,
51
52
'object-curly-spacing' : 0 ,
52
53
'object-shorthand' : 2 ,
54
+ 'perfectionist/sort-array-includes' : 'error' ,
55
+ 'perfectionist/sort-classes' : 'error' ,
56
+ 'perfectionist/sort-enums' : 'error' ,
57
+ 'perfectionist/sort-exports' : 'error' ,
58
+ 'perfectionist/sort-imports' : 0 ,
59
+ 'perfectionist/sort-interfaces' : 'error' ,
60
+ 'perfectionist/sort-intersection-types' : 'error' ,
61
+ 'perfectionist/sort-jsx-props' : 'error' ,
62
+ 'perfectionist/sort-maps' : 'error' ,
63
+ 'perfectionist/sort-named-exports' : 'error' ,
64
+ 'perfectionist/sort-named-imports' : 'error' ,
65
+ 'perfectionist/sort-object-types' : 'error' ,
66
+ 'perfectionist/sort-objects' : 'error' ,
67
+ 'perfectionist/sort-sets' : 'error' ,
68
+ 'perfectionist/sort-switch-case' : 'error' ,
69
+ 'perfectionist/sort-union-types' : 'error' ,
70
+ 'perfectionist/sort-variable-declarations' : 'error' ,
53
71
'prefer-arrow-callback' : [ 2 , { allowNamedFunctions : true } ] ,
54
72
'prefer-const' : 2 ,
55
73
'react-hooks/exhaustive-deps' : 2 ,
56
- 'react/jsx-sort-props' : 2 ,
74
+ 'react/jsx-sort-props' : 0 , // Handled by perfectionist
57
75
'react/prop-types' : 2 ,
58
76
'react/react-in-jsx-scope' : 0 ,
59
77
'react/require-default-props' : [
@@ -92,10 +110,15 @@ export default [
92
110
'unicorn/prefer-string-slice' : 2 ,
93
111
'unicorn/prefer-structured-clone' : 2 ,
94
112
'unicorn/prefer-ternary' : 2 ,
113
+ 'unicorn/prefer-top-level-await' : 0 , // not valid on RN for the moment
95
114
'unicorn/text-encoding-identifier-case' : 2 ,
96
115
'unused-imports/no-unused-imports' : 0 ,
97
116
} ,
98
117
settings : {
118
+ perfectionist : {
119
+ partitionByComment : true ,
120
+ type : 'alphabetical' ,
121
+ } ,
99
122
react : {
100
123
version : 'detect' ,
101
124
} ,
@@ -105,35 +128,35 @@ export default [
105
128
files : [ '**/*.ts' , '**/*.tsx' ] ,
106
129
languageOptions : {
107
130
ecmaVersion : 'latest' ,
108
- sourceType : 'module' ,
109
131
parser : tsEslint . parser ,
110
132
parserOptions : {
111
133
project : [ './tsconfig.json' ] ,
112
134
tsconfigRootDir : __dirname ,
113
135
} ,
136
+ sourceType : 'module' ,
114
137
} ,
115
138
plugins : {
116
139
'@typescript-eslint' : tsEslint . plugin ,
117
- 'typescript-sort-keys' : typescriptSortKeys ,
118
140
} ,
119
141
rules : {
120
- 'import/no-unresolved' : 0 , // handled by TypeScript
121
- '@typescript-eslint/consistent-type-imports' : 2 ,
122
142
'@typescript-eslint/ban-ts-comment' : 0 ,
143
+ '@typescript-eslint/consistent-type-imports' : 2 ,
123
144
'@typescript-eslint/no-dynamic-delete' : 0 ,
124
145
'@typescript-eslint/no-invalid-void-type' : 0 ,
125
146
'@typescript-eslint/no-namespace' : 0 ,
126
147
'@typescript-eslint/no-non-null-assertion' : 0 ,
127
148
'@typescript-eslint/no-this-alias' : 0 ,
128
149
'@typescript-eslint/no-unused-vars' : 0 ,
129
150
'@typescript-eslint/no-var-requires' : 0 ,
151
+ 'import/no-unresolved' : 0 , // handled by TypeScript
130
152
'react/prop-types' : 0 ,
131
- 'typescript-sort-keys/interface' : 2 ,
132
- 'typescript-sort-keys/string-enum' : 2 ,
133
153
} ,
134
154
} ,
135
155
{
136
156
files : [ './**/*.test.{ts,tsx}' ] ,
157
+ plugins : {
158
+ 'testing-library' : testingLibrary ,
159
+ } ,
137
160
rules : {
138
161
'@typescript-eslint/no-unsafe-assignment' : 0 ,
139
162
'@typescript-eslint/no-unsafe-call' : 0 ,
0 commit comments