File tree 1 file changed +36
-4
lines changed
1 file changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,15 @@ import { GLOB_TS, GLOB_TSX } from '../globs'
7
7
const ReactRefreshAllowConstantExportPackages = [
8
8
'vite' ,
9
9
]
10
+ const RemixPackages = [
11
+ '@remix-run/node' ,
12
+ '@remix-run/react' ,
13
+ '@remix-run/serve' ,
14
+ '@remix-run/dev' ,
15
+ ]
16
+ const NextJsPackages = [
17
+ 'next' ,
18
+ ]
10
19
11
20
export async function react (
12
21
options : OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles = { } ,
@@ -39,9 +48,9 @@ export async function react(
39
48
interopDefault ( import ( '@typescript-eslint/parser' ) ) ,
40
49
] as const )
41
50
42
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages . some (
43
- i => isPackageExists ( i ) ,
44
- )
51
+ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages . some ( i => isPackageExists ( i ) )
52
+ const isUsingRemix = RemixPackages . some ( i => isPackageExists ( i ) )
53
+ const isUsingNext = NextJsPackages . some ( i => isPackageExists ( i ) )
45
54
46
55
const plugins = pluginReact . configs . all . plugins
47
56
@@ -91,7 +100,30 @@ export async function react(
91
100
// react refresh
92
101
'react-refresh/only-export-components' : [
93
102
'warn' ,
94
- { allowConstantExport : isAllowConstantExport } ,
103
+ {
104
+ allowConstantExport : isAllowConstantExport ,
105
+ allowExportNames : [
106
+ ...( isUsingNext
107
+ ? [
108
+ 'config' ,
109
+ 'generateStaticParams' ,
110
+ 'metadata' ,
111
+ 'generateMetadata' ,
112
+ 'viewport' ,
113
+ 'generateViewport' ,
114
+ ]
115
+ : [ ] ) ,
116
+ ...( isUsingRemix
117
+ ? [
118
+ 'meta' ,
119
+ 'links' ,
120
+ 'headers' ,
121
+ 'loader' ,
122
+ 'action' ,
123
+ ]
124
+ : [ ] ) ,
125
+ ] ,
126
+ } ,
95
127
] ,
96
128
97
129
// recommended rules from @eslint -react
You can’t perform that action at this time.
0 commit comments