question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Additional spaces in pipe when use angular parser

See original GitHub issue

Prettier 2.7.2 [Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEAeGBXAlgWgDZZRw5gAWAhgE4wA6UABI-QFRQDmAYhJQLw0h44MemSrCIAM3oATcgE8AzvzpMRecgoV9wFasoZMA2qThY2pGAF1tAJgAMd-asMB3LNJilr-NkIDq7p4AFJTk7HAAlE5GAG7keBhw3jpi9AA+9JhYHFh48JT0SPQSufmF9KHh6ZnYALLkAA4NcAVFMBAAchgAtgBGLQrllb76AHyoAPRZ+ITEotSjdCAANCAQDTBY0ArIoFSUEC4AClQIOyjxLvI7q72hYADWQgDK5N1wADKzyBLxCnC3e5PGDPBrkMCENjIGCURKrOB9ODSaRIj5hNgYci+LiUbrkGCbdjIEDkDDtFYgCzdPB+UhYeAKMFgODPM70rAxelyYlgTQUwj-ahHUJsPE-P4AkAAKwUAA9npDBABFDAQeDivD-VZgyiC4nojDqSgUhqUQgwAIeUjIACM9m1B3+flCDWJprggpicApAEdVfBhetziSFDgiEikRTKHA-Vho8KsWKkL9NZL-t0sNDYWnFXAVWrvcmJasYORepbPMgbCXQrlIQBhCDdJMgD0AVgpGH+ABUy+cU1qQDFEgBJKAo2DPMBmjYAQXHzxgckEGv+AF810A)

# Options (if any):
--parser angular

Input:

<tui-line-chart
    *ngFor="let chart of days"
    class="chart"
    [height]="200"
    [width]="getWidth(range)"
    [value]="chart | tuiFilter : filter : range | tuiMapper : toNumbers : range"
></tui-line-chart>

Output:

<tui-line-chart
  *ngFor="let chart of days"
  class="chart"
  [height]="200"
  [width]="getWidth(range)"
  [value]="chart | tuiFilter: filter:range | tuiMapper: toNumbers:range"
></tui-line-chart>

Expected behavior:

I feel it’s much better to read with spaces.

    [value]="chart | tuiFilter : filter : range | tuiMapper : toNumbers : range"

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:39
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
waterpleacommented, Jul 9, 2022

I asked a friend of mine, GDE for Angular, for his opinion. He said, “I haven’t seen much discussion about the format of this syntax, and it’s hard to decide”. Sorry we are going to close this issue for now. But it does not mean that we as Prettier will never accept your proposal. If several similar issues are opened in the future, we can consider them again.

I’m a GDE for Angular too 🙂 I’ve asked @splincode to raise this issue when he enabled Angular as template parser for prettier in our huge open source library Taiga UI and we all were confused by how weird it looks without spaces 🙂

7reactions
nsenicommented, Nov 23, 2022

@sosukesuzuki It’s a shame this issue was not discussed more thoroughly. 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:

{{ (user$ | async).credit | currency:'CAD':'symbol-narrow':'4.2-2' }}

not

{{ (user$ | async).credit | currency : 'CAD' : 'symbol-narrow' : '4.2-2' }}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Transforming Data Using Pipes - Angular
Use pipes to transform strings, currency amounts, dates, and other data for ... If the pipe accepts multiple parameters, separate the values with...
Read more >
Angular Pipe Space - Stack Overflow
You can define a custom CurrencySpacePipe , which extends CurrencyPipe and inserts a space after the currency symbol:
Read more >
Step by Step Custom Pipes in Angular - Ultimate Courses
It's super convenient to use a Pipe and let it parse out for us! Now you're ready to start venturing into Custom Pipes!...
Read more >
Help:Extension:ParserFunctions - MediaWiki
The ParserFunctions extension provides eleven additional parser functions to supplement the "magic words ", which are already present in MediaWiki.
Read more >
URL Encoding | Google Maps Platform
For example, spaces in a string are either encoded with %20 or replaced with the plus sign ( + ). If you use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found