Skip to content

Commit 98aa03a

Browse files
committed
Fix TS import & document limitations [publish]
1 parent 206c1e3 commit 98aa03a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22

33
Validate that your components can safely be updated with fast refresh.
44

5-
⚠️ To avoid false positive, this plugin is only applied on `tsx` & `jsx` files.
5+
## Limitations
6+
7+
⚠️ To avoid false positive, this plugin is only applied on `tsx` & `jsx` files ⚠️
8+
9+
Like the implementation for [vite](https://github.com/vitejs/vite/blob/e6495f0a52c9bd2cae166934dc965f8955ce035d/packages/plugin-react/src/fast-refresh.ts#L108), the plugin rely on naming conventions (i.e. use ). This is why there is some limitations:
10+
11+
- `export *` are not supported and will be reported as an error
12+
- anonymous function are not supported (i.e `export default function() {}`)
13+
- Full uppercase export would be considered as an error. It can be disabled locally when it's effectively a React component:
14+
15+
```jsx
16+
// eslint-disable-next-line react-refresh/eslint-plugin-react-refresh
17+
export const CMS = () => <></>;
18+
```
619

720
## Installation
821

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "eslint-plugin-react-refresh",
33
"description": "Validate that your components can safely be updated with fast refresh",
4-
"version": "0.1.0",
4+
"version": "0.2.0",
55
"license": "MIT",
66
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
77
"main": "src/index.js",
8+
"repository": "github:ArnaudBarre/eslint-plugin-react-refresh",
89
"keywords": [
910
"eslint",
1011
"eslint-plugin",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const rules = {
2-
"only-export-components": require("./only-export-components.ts").rule,
2+
"only-export-components": require("./only-export-components").rule,
33
};

0 commit comments

Comments
 (0)