Skip to content

Commit 1b2005b

Browse files
authored
Add Next config [publish] (#87)
1 parent 4ddbb1f commit 1b2005b

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## 0.4.21
4+
5+
- Add Next config (fixes [#85](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/issues/85))
6+
7+
This allows exports like `fetchCache` and `revalidate` which are used in Page or Layout components and don't trigger a full page reload.
8+
9+
```js
10+
import reactRefresh from "eslint-plugin-react-refresh";
11+
12+
export default [
13+
/* Main config */
14+
reactRefresh.configs.next,
15+
];
16+
```
17+
318
## 0.4.20
419

520
- Don't warn on nested HOC calls (fixes [#79](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/issues/79))

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ export default [
5454
];
5555
```
5656

57+
### Next config
58+
59+
This allows exports like `fetchCache` and `revalidate` which are used in Page or Layout components and don't trigger a full page reload.
60+
61+
```js
62+
import reactRefresh from "eslint-plugin-react-refresh";
63+
64+
export default [
65+
/* Main config */
66+
reactRefresh.configs.next,
67+
];
68+
```
69+
5770
### Without config
5871

5972
```js

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-refresh",
3-
"version": "0.4.20",
3+
"version": "0.4.21",
44
"type": "module",
55
"license": "MIT",
66
"scripts": {

src/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,28 @@ export const configs = {
2222
],
2323
},
2424
},
25+
next: {
26+
name: "react-refresh/vite",
27+
plugins: { "react-refresh": plugin },
28+
rules: {
29+
"react-refresh/only-export-components": [
30+
"error",
31+
{
32+
// from https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
33+
allowExportNames: [
34+
"experimental_ppr",
35+
"dynamic",
36+
"dynamicParams",
37+
"revalidate",
38+
"fetchCache",
39+
"runtime",
40+
"preferredRegion",
41+
"maxDuration",
42+
],
43+
},
44+
],
45+
},
46+
},
2547
};
2648

2749
// Probably not needed, but keep for backwards compatibility

src/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ declare const _default: {
88
configs: {
99
recommended: Config;
1010
vite: Config;
11+
next: Config;
1112
};
1213
};
1314

0 commit comments

Comments
 (0)