-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect
trailingComma
in angular templates (#15926)
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
- Loading branch information
1 parent
c2e20fb
commit 8a88cdc
Showing
10 changed files
with
761 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#### Respect `trailingComma` in Angular templates (#15926 by @fisker) | ||
|
||
If you are using an old version of Angular doesn't support trailing comma, make sure add | ||
|
||
```yaml | ||
overrides: | ||
- files: "<patterns-of-my-angular-files>" | ||
options: | ||
trailingComma: none | ||
``` | ||
to your `.prettierrc` file. | ||
|
||
<!-- prettier-ignore --> | ||
```jsx | ||
// Input | ||
<div | ||
[ngClass]="{ | ||
'px-lg': ctx.spacing == 'lg', | ||
'px-md': ctx.spacing == 'md', | ||
'px-xs': ctx.spacing == 'xs', | ||
}" | ||
></div> | ||
// Prettier stable | ||
<div | ||
[ngClass]="{ | ||
'px-lg': ctx.spacing == 'lg', | ||
'px-md': ctx.spacing == 'md', | ||
'px-xs': ctx.spacing == 'xs' | ||
}" | ||
></div> | ||
// Prettier main | ||
<div | ||
[ngClass]="{ | ||
'px-lg': ctx.spacing == 'lg', | ||
'px-md': ctx.spacing == 'md', | ||
'px-xs': ctx.spacing == 'xs', | ||
}" | ||
></div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.