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.

Different behaviour to Prettier 2.0

See original GitHub issue

Summary

Using the latest Prettier 2.0 CLI produces different formatting to the vscode extension even when using identical settings.

prettier-vscode extension:

  const isPlayer = R.compose(
    equal(player),
    nameGet
  )

running prettier 2.0.0 on the code from the CLI (npx prettier@2.0.0 --write --no-semi "**/*.js"):

const isPlayer = R.compose(equal(player), nameGet)

Both are using the same print width setting (80). The only setting active that differs from the default is semi: false.

Steps To Reproduce:

  1. Download the Prettier vscode extension and set the semi-colon option to false
  2. Format the following code const isPlayer = R.compose(equal(player), nameGet)

Expected result

The expected result is that it doesn’t change the code, as running prettier 2.0.0 via the CLI on this code does not change it.

Actual result

It breaks out the code onto multiple lines.

Additional information

Feel free to attach a screenshot.

Extension version: 4.1.1 VS Code version: Code 1.43.2 (0ba0ca52957102ca3527cf479571617f0de6ed50, 2020-03-24T07:34:57.037Z) OS version: Darwin x64 19.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jordanwadecommented, Apr 13, 2020

I’m also seeing an issue with the recent release (v4.2.0) of the VS code plugin regarding trailing commas being removed when I format a file on save. I fixed my issue by downgrading to release (v4.1.1).

1reaction
ntottencommented, Apr 14, 2020

Should be fixed in v4.4.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier 2.0 “2020”
In version 2.0, this behavior has become the default. ... Besides, contributors on different operating systems could accidentally change ...
Read more >
Options - Prettier
When Prettier identifies cases where it looks like you've placed some code it knows how to format within a string in another file,...
Read more >
Prettier 2.3. In which assignments are consistent, short keys ...
This release focuses on fixing long-standing issues in the JavaScript printer. Be warned that, unfortunately, reformatting a project with ...
Read more >
Prettier 2.1: new --embedded-language-formatting option and ...
This option allows you to switch between the default behavior ( auto ) and disabling this feature entirely ( off ). It applies...
Read more >
Prettier 2.8: improve --cache CLI option and TypeScript 4.9 ...
Previously, the behavior of the Playground was confusingly inconsistent with the local behavior of Prettier in that it surfaced parsing errors ...
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