Revert adding spaces in Angular Pipes · Issue #13887 · prettier/prettier (original) (raw)
Prettier 2.8.0
Prettier 2.8.0 "fixes" issue #13058
But it was not thoroughly discussed. I think it was not discussed at all in the Angular Repository. Opinions of a few Taiga UI users should not overweight all the examples in the official Angular documentation, where pipes are separated with spaces, and pipe arguments stand close to pipe names.
Reference:
https://angular.io/guide/pipes-transform-data
https://angular.io/api/common/CurrencyPipe#usage-notes
Input:
{{ (user$ | async).credit | currency:'CAD':'symbol-narrow':'4.2-2' }} {{ (user$ | async).items | slice:1:5 }}
Output:
{{ (user$ | async).credit | currency : 'CAD' : 'symbol-narrow' : '4.2-2' }} {{ (user$ | async).items | slice : 1 : 5 }}
Expected behavior:
{{ (user$ | async).credit | currency:'CAD':'symbol-narrow':'4.2-2' }} {{ (user$ | async).items | slice:1:5 }}
Also, Webstorm displays names of arguments, and it does not look as good with additional spaces:
As a compromise, I suggest not adding spaces if a pipe argument is a string or a number, but add spaces in all other cases.
Expected behavior:
{{ (user$ | async).credit | currency:'CAD':'symbol-narrow':'4.2-2' }} {{ (user$ | async).items | slice:1:5 }} {{ chart | tuiFilter : filter : range | tuiMapper : toNumbers : range }}