1
+ const vitestFiles = [ 'app/**/__tests__/**/*' , 'app/**/*.{spec,test}.*' ]
2
+ const testFiles = [ '**/tests/**' , ...vitestFiles ]
3
+ const appFiles = [ 'app/**' ]
4
+
1
5
/** @type {import('@types/eslint').Linter.BaseConfig } */
2
6
module . exports = {
3
7
extends : [
4
8
'@remix-run/eslint-config' ,
5
9
'@remix-run/eslint-config/node' ,
6
10
'prettier' ,
7
11
] ,
12
+ rules : {
13
+ '@typescript-eslint/consistent-type-imports' : [
14
+ 'warn' ,
15
+ {
16
+ prefer : 'type-imports' ,
17
+ disallowTypeAnnotations : true ,
18
+ fixStyle : 'inline-type-imports' ,
19
+ } ,
20
+ ] ,
21
+ '@typescript-eslint/no-duplicate-imports' : 'warn' ,
22
+ } ,
8
23
overrides : [
24
+ {
25
+ plugins : [ 'remix-react-routes' ] ,
26
+ files : appFiles ,
27
+ excludedFiles : testFiles ,
28
+ rules : {
29
+ 'remix-react-routes/use-link-for-routes' : 'error' ,
30
+ 'remix-react-routes/require-valid-paths' : 'error' ,
31
+ // disable this one because it doesn't appear to work with our
32
+ // route convention. Someone should dig deeper into this...
33
+ 'remix-react-routes/no-relative-paths' : [
34
+ 'off' ,
35
+ { allowLinksToSelf : true } ,
36
+ ] ,
37
+ 'remix-react-routes/no-urls' : 'error' ,
38
+ 'no-restricted-imports' : [
39
+ 'error' ,
40
+ {
41
+ patterns : [
42
+ {
43
+ group : testFiles ,
44
+ message : 'Do not import test files in app files' ,
45
+ } ,
46
+ ] ,
47
+ } ,
48
+ ] ,
49
+ } ,
50
+ } ,
9
51
{
10
52
extends : [ '@remix-run/eslint-config/jest-testing-library' ] ,
11
- files : [ 'app/**/__tests__/**/*' , 'app/**/*.{spec,test}.*' ] ,
53
+ files : vitestFiles ,
12
54
rules : {
13
55
'testing-library/no-await-sync-events' : 'off' ,
14
56
'jest-dom/prefer-in-document' : 'off' ,
@@ -23,15 +65,4 @@ module.exports = {
23
65
} ,
24
66
} ,
25
67
] ,
26
- rules : {
27
- '@typescript-eslint/consistent-type-imports' : [
28
- 'warn' ,
29
- {
30
- prefer : 'type-imports' ,
31
- disallowTypeAnnotations : true ,
32
- fixStyle : 'inline-type-imports' ,
33
- } ,
34
- ] ,
35
- '@typescript-eslint/no-duplicate-imports' : 'warn' ,
36
- } ,
37
68
}
0 commit comments