Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to apply to plain string variables #77

Open
kunanyi opened this issue Oct 3, 2024 · 1 comment
Open

Option to apply to plain string variables #77

kunanyi opened this issue Oct 3, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@kunanyi
Copy link

kunanyi commented Oct 3, 2024

I am using cn (clsw, twMerge) - this means I have class lists inside plain string variables.

Would be nice we could target the formatting for certain string variables:

const buttonClassName = 'flex h-8 w-8 items-center justify-center rounded-l-lg border-1 border-black';
return( <button className={cn(buttonClassName, 'extraClass')}>Button</button> );

In my VSCode I set up intellisense to recognize "*ClassName" variables, so "buttonClassName" gets the intellisense. Maybe the prettier config could also target variables with "*ClassName" patterns, or whatever the user chooses.

@kunanyi kunanyi added the enhancement New feature or request label Oct 3, 2024
@ony3000
Copy link
Owner

ony3000 commented Oct 9, 2024

Hi, sorry for the late reply! I will consider adding that option.

Currently, you can work around this by defining a separate identity function and then adding that function name to the customFunctions option.

const id = (x) => x;

const buttonClassName = id('flex h-8 w-8 items-center justify-center rounded-l-lg border-1 border-black');
{
  customFunctions: ['id']
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants