dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Investigate feedback and fix issues related to JSX elements

Open dsherret opened this issue 4 years ago • 2 comments

See here https://github.com/dprint/dprint-plugin-typescript/issues/19#issuecomment-767702524

Edit... Copy and pasted over for better tracking:

dsherret avatar Jan 27 '21 12:01 dsherret

From https://github.com/denoland/deno/issues/7870


Here are some examples - top is denofmt, bottom is prettier:

1

    <div
      class="bg-gradient-to-tr from-teal-500 to-teal-700 h-14 my-6"
    >
      <div
        class="flex justify-between items-center max-w-screen-lg mx-auto px-4 sm:px-6 md:px-8"
      >
        <a class="flex items-center" href="/dashboard" title="Go to dasboard">
          <img src="/img/logo.svg" alt="logo" class="w-20 h-20 -my-3" />
          <span class="ml-3 text-white text-3xl font-extrabold tracking-wide">
            foo site
          </span>
        </a>
        {user && <a href="/account" title="Go to account page">
          <ProfileImage class="w-10 h-10" />
        </a>}
      </div>
    </div>
    <div class="bg-gradient-to-tr from-teal-500 to-teal-700 h-14 my-6">
      <div class="flex justify-between items-center max-w-screen-lg mx-auto px-4 sm:px-6 md:px-8">
        <a class="flex items-center" href="/dashboard" title="Go to dasboard">
          <img src="/img/logo.svg" alt="logo" class="w-20 h-20 -my-3" />
          <span class="ml-3 text-white text-3xl font-extrabold tracking-wide">
            foo site
          </span>
        </a>
        {user && (
          <a href="/account" title="Go to account page">
            <ProfileImage class="w-10 h-10" />
          </a>
        )}
      </div>
    </div>

2

function App(props: AppProps) {
  return <AuthProvider>
    {props.children}
  </AuthProvider>;
}
function App(props: AppProps) {
  return <AuthProvider>{props.children}</AuthProvider>;
}

3

    <html lang="en">
      <head>
        <meta charSet="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      </head>
      <body>
        {props.children}
      </body>
    </html>
    <html lang="en">
      <head>
        <meta charSet="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      </head>
      <body>{props.children}</body>
    </html>

4

    <Page>
      {user
        ? <>
          <div class="flex">
            <ProfileImage class="w-16 h-16" />
            <div class="ml-4 flex flex-col justify-center">
              <p class="font-medium text-xl">{user.name}</p>
              <p class="text-gray-800">{user.login}</p>
            </div>
          </div>
          <button
            onClick={(e) => signout()}
            className="h-6 sm:h-8 w-32 rounded text-md sm:text-lg font-semibold
                 tracking-wider focus:outline-none
                 transition duration-150 ease-in-out mt-8
                 text-black bg-gradient-to-r from-teal-400 to-teal-300 focus:text-white focus:bg-teal-500
                     active:text-white active:bg-teal-500"
          >
            SIGN OUT
          </button>
        </>
        : <div></div>}
    </Page>

    <Page>
      {user ? (
        <>
          <div class="flex">
            <ProfileImage class="w-16 h-16" />
            <div class="ml-4 flex flex-col justify-center">
              <p class="font-medium text-xl">{user.name}</p>
              <p class="text-gray-800">{user.login}</p>
            </div>
          </div>
          <button
            onClick={(e) => signout()}
            className="h-6 sm:h-8 w-32 rounded text-md sm:text-lg font-semibold
                 tracking-wider focus:outline-none
                 transition duration-150 ease-in-out mt-8
                 text-black bg-gradient-to-r from-teal-400 to-teal-300 focus:text-white focus:bg-teal-500
                     active:text-white active:bg-teal-500"
          >
            SIGN OUT
          </button>
        </>
      ) : (
        <div></div>
      )}
    </Page>

dsherret avatar Dec 01 '21 15:12 dsherret

I agree that in all presented instances prettier looks better.

Bessonov avatar Dec 25 '23 20:12 Bessonov