Open ReDrUm opened 6 years ago
I have same problem and it is caused by prettier with range options, IMO.
If you use raw prettier with --range-start
and --range-end
options, you will get same result in your question.
@ReDrUm In order to reproduce and diagnose, it is important to know what characters were actually changed before precise-commits ran on it.
In your example above, which bits changed?
Hi @JamesHenry, Sure, thanks.
I think @Sheile is correct and it's related or caused by bleeding outside of the range options which is mentioned via #13
For the purpose of this example let's assume i changed and staged a single line:
<div><p>foo</p></div>
Regardless of bleeding the formatting inconsistency is my concern in this issue.
Looks like this is #15 duplicate
I ran into the issue and did a bit of investigation. Seems like the problem is in Prettier itself.
When running Prettier (CLI) directly with the same --range-start
and --range-end
parameters, I get the same (wrong) result that precise-commits
is producing.
Hi,
When using precise-commits i'm unexpectedly getting different output compared to running prettier directly myself. Specifically it's stripping brackets from return statements within my react render functions and doing weird things with alignment/indentation.
Is precise-commits using it's own Prettier config instead of finding the
.prettierrc
file in my project root? Based on the below quote from your docs I had assumed it would be consistent.Something like this:
Becomes this via precise-commits:
Compared to this expectation which I get when running prettier directly:
Any ideas how to re-align the formatting so that precise-commits outputs the same result as prettier is?