docs: make "A note on formatting reversibility" linkable
This commit is contained in:
1 parent
8f17187bf7
commit
6dcc20c0fc
2 files changed
+6
-2
No files matched your search
+3
-1
@@ -77,7 +77,9 @@ const user = {
|
||||
[stylesheets]: https://github.com/prettier/prettier/issues/74#issuecomment-275262094
|
||||
[keyed methods]: https://github.com/prettier/prettier/pull/495#issuecomment-275745434
|
||||
|
||||
> ♻️ **A note on formatting reversibility:** The semi-manual formatting for object literals is in fact a workaround, not a feature. It was implemented only because at the time a good heuristic wasn’t found and an urgent fix was needed. However, as a general strategy, Prettier avoids _non-reversible_ formatting like that, so the team is still looking for heuristics that would allow either to remove this behavior completely or at least to reduce the number of situations where it’s applied.
|
||||
> #### ♻️ A note on formatting reversibility
|
||||
>
|
||||
> The semi-manual formatting for object literals is in fact a workaround, not a feature. It was implemented only because at the time a good heuristic wasn’t found and an urgent fix was needed. However, as a general strategy, Prettier avoids _non-reversible_ formatting like that, so the team is still looking for heuristics that would allow either to remove this behavior completely or at least to reduce the number of situations where it’s applied.
|
||||
>
|
||||
> What does **reversible** mean? Once an object literal becomes multiline, Prettier won’t collapse it back. If in Prettier-formatted code, we add a property to an object literal, run Prettier, then change our mind, remove the added property, and then run Prettier again, we might end up with a formatting not identical to the initial one. This useless change might even get included in a commit, which is exactly the kind of situation Prettier was created to prevent.
|
||||
|
||||
|
||||
Reference in new issue
Block a user