5 ms·
I'm looking through the docs, specifically the formatter stuff ( https://biomejs.dev/formatter https://biomejs.dev/formatter ), and it feels like all the exampl
by ehutch79 3y ago
I'm looking through the docs, specifically the formatter stuff ( https://biomejs.dev/formatter https://biomejs.dev/formatter ), and it feels like all the examples are backwards?
Am I missing stuff?
- ufo 3y agoThose diffs are rare corner cases where the input is invalid Javascript. Prettier's parser is permissive and emits beautifully indented nonsense (which is arguably a bug in prettier). For example, in the original program there is a "private public" but the prettier output in red only says "private". Biome decided that in these cases it should not touch the indentation at all. The output is indented exactly the same as the input. The concern is that if you reindent something that you don't understand, it might break it. https://github.com/biomejs/biome/issues/739 https://github.com/biomejs/biome/issues/739
- conaclos 3y agoWhat do you mean by "backwards"?
- surye 3y agoThe "diff" appears to be backwards (it's subtracting what prettier would emit, and adding back the original).
- explaininjs 3y agoThe diff is between the test cases’s expected output (red) and the utility’s current output (green).
- ematipico 3y agoThe red represents what would Prettier emits, and the green represents what Biom e emits. If you think that's unclear, feel free to send a PR to help us make it clearer.
- globular-toast 3y agoThis was intuitive to me, especially because it's in a section titled "Differences with Prettier".
- explaininjs 3y agoThat’s giving the diff between prettier (“correct”, yet red) and their implementation (green, yet arguably incorrect)
- surye 3y agoIt feels backwards to me from a purely linear time perspective, you have an input, transform it, diff would be the patch, to the desired output.