cli
cli copied to clipboard
End of line is not respected by "sfdx force:source:retrieve or deploy" command
Summary
We are using prettier code formatter, which by default preserves line ending.
However when we commit, deploy and then retrieve, ending lines are removed from my local files, creating large diffs.
That happens on APEX, AURA and LWC files.
Steps To Reproduce:
- Create an apex class
MyCls
with an empty line at the end. - Commit this class locally using git.
- Deploy the class to a sandbox using
sfdx force:source:deploy
. - Retrieve the class from the sandbox using
sfdx force:source:retrieve
. - Run git diff.
Expected result
The retrieved apex class should not have been changed.
Actual result
Ending line is removed from the apex class creating an unnecessary diff.
Additional information
SFDX CLI Version:
sfdx-cli/7.45.1 darwin-x64 node-v12.16.0
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
@salesforce/sfdx-diff 0.0.5
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.7.0 (core)
dependencies-cli 2.0.1
generator 1.1.2 (core)
salesforcedx 47.18.0
├─ salesforce-alm 47.16.0
└─ salesforcedx-templates 47.19.0
sfdx-cli 7.45.1 (core)
OS and version:
macOS Mojave
10.14.6
@mostafa-anm we are having the mdapi team take a look at this issue.
+1
this is still happening. Any news?
@mostafa-anm I had the same issue. I have added this to the prettier config file to prevent the diffs:
{ "files": "*.{cls,trigger}", "options": { "apexInsertFinalNewline": false } }