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

Ugly logical expression break in Vue v-if #16168

Open
fisker opened this issue Mar 27, 2024 · 0 comments
Open

Ugly logical expression break in Vue v-if #16168

fisker opened this issue Mar 27, 2024 · 0 comments
Labels
lang:vue Issues affecting Vue status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:enhancement A potential new feature to be added, or an improvement to how we print something

Comments

@fisker
Copy link
Member

fisker commented Mar 27, 2024

Prettier 3.2.5
Playground link

--parser vue

Input:

<template>
  <div>	  <div>	  <div>	
            <foo-bar
            v-if="
             a_long_long_long_long_name ===
               a_long_long_long_long_long_name.foo && !foo.bar
            "
            />
  </div></div></div>
  </template>

Output:

<template>
  <div>
    <div>
      <div>
        <foo-bar
          v-if="
            a_long_long_long_long_name ===
              a_long_long_long_long_long_name.foo && !foo.bar
          "
        />
      </div>
    </div>
  </div>
</template>

Expected output:

<template>
  <div>
    <div>
      <div>
        <foo-bar
          v-if="
            a_long_long_long_long_name === a_long_long_long_long_long_name.foo &&
            !foo.bar
          "
        />
      </div>
    </div>
  </div>
</template>

Why?

The expected output is more readable, IMO

@fisker fisker added type:enhancement A potential new feature to be added, or an improvement to how we print something status:needs discussion Issues needing discussion and a decision to be made before action can be taken lang:vue Issues affecting Vue labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:vue Issues affecting Vue status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

No branches or pull requests

1 participant