Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm looking through the docs, specifically the formatter stuff ( https://biomejs.dev/formatter ), and it feels like all the examples are backwards?

Am I missing stuff?



That’s giving the diff between prettier (“correct”, yet red) and their implementation (green, yet arguably incorrect)


It 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.


Those 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


What do you mean by "backwards"?


The "diff" appears to be backwards (it's subtracting what prettier would emit, and adding back the original).


The 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.


This was intuitive to me, especially because it's in a section titled "Differences with Prettier".


The diff is between the test cases’s expected output (red) and the utility’s current output (green).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: