question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unstable Vue formatting / semicolon issue

See original GitHub issue

Prettier 1.15.1 Playground link

--parser vue

Input:

<template>
  <p @click="() => {console.log(test)}">
    test
    </p>
</template>

Output:

<template>
  <p
    @click="
      () => {
        console.log(test);
      }
    "
  >
    test
  </p>
</template>

Second Output:

<template>
  <p
    @click="
      () => {
        console.log(test);
      };
    "
  >
    test
  </p>
</template>

Expected behavior:

  1. Stable formatting
  2. According to https://github.com/prettier/prettier/pull/5259#issuecomment-437064991 the semicolon after the } is not allowed.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jordan-erismancommented, Nov 8, 2018

@michaeljota the leading semi colon is definitely strange, not an error though

1reaction
ikatyangcommented, Nov 10, 2018

The fix is available in 1.15.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop Visual Studio Code From Automatically Adding ...
vue file and chose "Format Document" option Visual Studio Code automatically add the semicolons that intentionally removed them. How do I stop ...
Read more >
Code in Vue.js project templates missing semicolons - YouTrack
js project templates missing semicolons. WebStorm flags these with an error, and because it is only a semicolon, this is often hard to...
Read more >
How to Setup Vue.js with VS Code and Fix Formatting and ES ...
When you create a Vue.js project with the Vue CLI or UI and select Prettier - you'll have a bunch of ES Lint...
Read more >
ESLint with Prettier and Vue in VS Code - YouTube
In this video I show how to setup ESLint and Prettier in your VueJS applications and how to get them working properly inside...
Read more >
Prettier 1.15: HTML, Vue, Angular and MDX Support
Prettier can now format HTML, Vue and Angular files! ... To solve this problem, we flattened the else-branch for nested ternaries in a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found