Skip to content

Commit ba20ebd

Browse files
committed
feat(shared-configurations): [nextjs] enhance compatibility with react-refresh
- update documentation
1 parent aa4975f commit ba20ebd

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ export default boehringer.config(
158158
);
159159
```
160160

161-
This shared ESLint configuration is specifically tailored for [Next.js](https://nextjs.org/) projects. It extends the [react configuration](#react) and includes the [`@next/eslint-plugin-next`](https://nextjs.org/docs/app/api-reference/config/eslint) plugin with the recommended and [`core-web-vital`](https://nextjs.org/docs/app/api-reference/config/eslint#with-core-web-vitals) rule set.
161+
This shared ESLint configuration is specifically tailored for [Next.js](https://nextjs.org/) projects. It extends the [react configuration](#react) and includes the [`@next/eslint-plugin-next`](https://nextjs.org/docs/app/api-reference/config/eslint) plugin with the recommended and [`core-web-vital`](https://nextjs.org/docs/app/api-reference/config/eslint#with-core-web-vitals) rule set. The configuration also adapts the rule `react-refresh/only-export-components` to be compatible with Next.js.
162+
163+
It
162164

163165
### Playwright
164166

configs/nextjs.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@ module.exports = tseslint.config(...react, {
88
'@next/next': nextPlugin,
99
},
1010
rules: {
11+
// eslint-plugin-react-refresh: https://github.com/ArnaudBarre/eslint-plugin-react-refresh
12+
'react-refresh/only-export-components': [
13+
'warn',
14+
{
15+
/**
16+
* Next.js allows exporting the following options in pages, layouts and route handlers
17+
*
18+
* @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
19+
*/
20+
allowExportNames: [
21+
'config',
22+
'dynamic',
23+
'dynamicParams',
24+
'fetchCache',
25+
'generateMetadata',
26+
'generateStaticParams',
27+
'generateViewport',
28+
'maxDuration',
29+
'metadata',
30+
'preferredRegion',
31+
'revalidate',
32+
'runtime',
33+
'viewport',
34+
],
35+
},
36+
],
1137
...nextPlugin.configs.recommended.rules,
1238
...nextPlugin.configs['core-web-vitals'].rules,
1339
},

0 commit comments

Comments
 (0)