ui icon indicating copy to clipboard operation
ui copied to clipboard

Export pattern causes warning from `eslint-plugin-react-refresh`

Open lunelson opened this issue 9 months ago • 3 comments

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 },
    ],
  },
}

lunelson avatar Sep 16 '23 14:09 lunelson

same issue here, any updates?

enix79 avatar Oct 13 '23 09:10 enix79

I would also prefer that there were no warnings.

DocMoebiuz avatar Feb 20 '24 10:02 DocMoebiuz

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.

koutaro-masaki avatar Apr 24 '24 05:04 koutaro-masaki