0

With this code

<template>
  <v-toolbar app color="brown darken-4" dark>
    <v-btn color="brown lighten-3" class="hidden-sm-and-down">REGISTRIEREN</v-btn>
  </v-toolbar>
</template>

Prettier suggests this:

  3:62  warning  Replace `>REGISTRIEREN</v-btn` with `⏎······>REGISTRIEREN</v-btn⏎····`  prettier/prettier

But the code than would look like this:

<template>
  <v-toolbar app color="brown darken-4" dark>
    <v-btn color="brown lighten-3" class="hidden-sm-and-down"
      >REGISTRIEREN</v-btn
    >
  </v-toolbar>
</template>

Where prettier does not complain. Is this expected behaviour or a bug in VSCode?

1 Answer 1

3

That is expected behaviour. Prettier does a line break after 80 characters or so. And it breaks before the > because if it breaks after, it actually adds a white space, so you might run into display issues later on.

this is correct:

 <v-btn color="brown lighten-3" class="hidden-sm-and-down"
   >REGISTRIEREN</v-btn
 >

this is not (the line break before and after 'REGISTRIEREN' is an actual character):

<v-btn color="brown lighten-3" class="hidden-sm-and-down">
   REGISTRIEREN
</v-btn>

You can customise some of these rules, but I honestly recommend just keeping what comes out of the box - the more you customise, the more things keep breaking during updates etc.

Sign up to request clarification or add additional context in comments.

2 Comments

This behavior of Prettier is also explained here: prettier.io/blog/2018/11/07/…
Thanks for the link @thorn̈. I was aware of "significant" white space but thought it a thing of the dark (xhtml/html 4) ages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.