ui
ui copied to clipboard
Export pattern causes warning from `eslint-plugin-react-refresh`
After initializing in a new React Vite TS Storybook starter, that happened to have this eslint plugin installed, I get warnings on a number of files that export functions in addition to a component.
Also, although documentation about "Fast Refresh" is a bit scant unfortunately, some resources on it also say that each export requires its own export statement...
https://github.com/ArnaudBarre/eslint-plugin-react-refresh
...from my eslint config:
{
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
same issue here, any updates?
I would also prefer that there were no warnings.
It was surprising that this hasn't been a major issue, but it seems that most of the components provided by shadcn/ui are following the only-export-components
rule. The only example of rule violation I found was with the button
. Additionally, I don't think the button
needs to export the buttonVariants
function. I have removed the buttonVariants
function from the export
object in the installed button.tsx
.