eslint-plugin-react-refresh
Validate that your components can safely be updated with fast refresh.
⚠️ To avoid false positive, this plugin is only applied on tsx
& jsx
files.
Installation
npm i -D eslint-plugin-react-refresh
Usage
{
"plugins": ["react-refresh"],
"rules": {
"react-refresh/only-export-components": "warn"
}
}
Fail
export const foo = () => {};
export const Bar = () => <></>;
export const CONSTANT = 3;
export const Foo = () => <></>;
export default function () {}
export * from "./foo";
Pass
export default function Foo() {
return <></>;
}
const foo = () => {};
export const Bar = () => <></>;