jolbol1 / jolly-ui

shadcn/ui compatible react aria components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://jollyui.dev
MIT License
770 stars 21 forks source link

Rename `className` param used in the callback function within `composeRenderProps` #80

Open nikitarevenco opened 1 week ago

nikitarevenco commented 1 week ago

Everywhere in the library we are shadowing the className variable in the callback function (2nd argument to composeRenderProps):

      className={composeRenderProps(className, (className) =>
        cn("group flex flex-col gap-2", className),
      )}

It's problematic because a lot of projects use ESLint no-shadow rule. Which generates many errors for each of these files

Same with this:

      {composeRenderProps(children, (children) => (
        <>
          {children}
          <ChevronDown aria-hidden="true" className="size-4 opacity-50" />
        </>
      ))}

children is being shadowed, changing it to something like renderChildren won't trigger ESLint errors

examples are taken from Select component

musjj commented 5 days ago

The composeRenderProps isn't actually necessary at all in most cases and you can just do className={cn(...)}.