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

singleAttributePerLine is not working on tsx files #16159

Closed
Godrules500 opened this issue Mar 20, 2024 · 2 comments
Closed

singleAttributePerLine is not working on tsx files #16159

Godrules500 opened this issue Mar 20, 2024 · 2 comments

Comments

@Godrules500
Copy link

return (
    <div className="group relative flex items-start md:-ml-12">
      <div className="flex size-[25px] shrink-0 select-none items-center justify-center rounded-md border bg-background shadow-sm">
        <IconUser />
      </div>
      <div className="ml-4 flex-1 space-y-2 overflow-hidden px-1 relative">
        {isEditing ? (
          <>
            <textarea
              className="w-full h-24 p-2" // Adjust height as needed
              value={editableText}
              onChange={handleTextChange}
            />
            <div className="flex justify-center">
              <Button
                className=""
                onClick={handleSubmitChanges}
                size="md"
                variant="filled"
              >
                Submit Changes
              </Button>
              <Button
                className="ml-2"
                onClick={toggleEdit}
                size="md"
                variant="filled"
              >
                Cancel
              </Button>
            </div>
          </>
        ) : (
          <>
            {children}
            <button
              onClick={toggleEdit}
              className="absolute right-0 top-0 p-2 cfaRed"
              disabled={isEditing}
            >
              <IconEdit />
            </button>
          </>
        )}
      </div>
    </div>

prettier.config.cjs

{
  printWidth: 2000,
  singleAttributePerLine: true
}

Why?

I am using tsx and when I format the file using prettier, it is keeping the attributes all on their individual line. I am on version 3.2.4.

Thanks!

@sosukesuzuki
Copy link
Member

This looks like an attribute thanks to the CSS framework you are using, but it is really just a class name. The singleAttributePerLine option does not respect the content of the class name. This is the intended behavior.

@sosukesuzuki sosukesuzuki closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
@sosukesuzuki
Copy link
Member

Also, next time you create an issue, please use the issue template. It will make it easier to triage and may speed up our replies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants