salesforcedx-vscode icon indicating copy to clipboard operation
salesforcedx-vscode copied to clipboard

Inconsistent Formatting between Prettier and Org

Open jonny-harte opened this issue 2 years ago • 10 comments

Summary

Every time you retrieve source from Org it detects all Aura & LWC components as different when using prettier and/or the pre-commit hook in a project. This is because prettier adds a new lines to the end of files and the Org removes them.

This has become more of an issue since the updated source control and is making diff detection very noisy and unmanageable in large projects.

I know there is an prettier-plugin-apex plugin which removes the last line (works well!). Could this be expanded to all file types with options in .prettierrc?

Steps To Reproduce:

  1. Create an Aura/LWC.
  2. Prettier files.
  3. Commit to Repo.
  4. Deploy to Org.
  5. Retrieve from Org.
  6. Review source control panel in VSCode

Expected result

No Changes detected.

Actual result

Changes detected, last line from files removed.

Salesforce Extension Version in VS Code: v54.12.0

SFDX CLI Version: sfdx-cli/7.150.0 darwin-x64 node-v16.15.0

OS and version: MacOS 12.3.1

jonny-harte avatar May 26 '22 10:05 jonny-harte

Hi @jonny-harte, thank you for your post. This is a known issue, we will be working on this to provide you with a better experience. Please stay tuned.

floralan avatar Jun 02 '22 19:06 floralan

Thanks @floralan. Will this take into account visualforce pages, components and email templates etc? As there are a lot of inconsistencies between whats deployed after being formatted with prettier and what i then retrieved from the Org.

jonny-harte avatar Jun 06 '22 07:06 jonny-harte

Would love to see some activity on this issue. Some other examples of this, even with prettier-plugin-apex, are Role, Layout and WebLink metadata files. Would be great if we could use apexInsertFinalNewline for all Salesforce metadata files.

gfarb avatar Oct 13 '22 19:10 gfarb

Is there any movement for this one? @floralan

ozanbotanls avatar Dec 19 '22 19:12 ozanbotanls

Please could you tell us about this is going ?

RupertBarrow avatar Jan 24 '23 15:01 RupertBarrow

Sorry for the late reply as I'm not working on this product anymore. @AnanyaJha Could you please follow up on this issue?

floralan avatar Jan 24 '23 21:01 floralan

@AnanyaJha any updates for us? While I appreciate all the work that has gone into prettier-plugin-apex that work is being done by folks in the community and not Salesforce themselves. The plugin is not very efficient and in large projects it consumes a ton of hardware resources (my computer sounds like a rocket ship about to take off).

gfarb avatar Feb 16 '23 14:02 gfarb

Hi @gfarb thanks for bumping this. We'll start triaging this and will let you know once we've pulled it into our backlog.

AnanyaJha avatar Apr 10 '23 19:04 AnanyaJha

Hi @AnanyaJha , are you making progress on this one ?

RupertBarrow avatar Jun 26 '23 10:06 RupertBarrow

Still no progress or updates on this?

@AnanyaJha @floralan

gfarb avatar Jul 20 '23 14:07 gfarb