Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vs code prettier - adds new line after @Input() decorator in angular

I've been using prettier for near 2 years now to format my angular code. Starting last week prettier starts to insert a new line behind all angular statements with decorators like @Input(), @Output(), @ViewChild(),..

resulting in something like

@Input()
property1

@Output()
emitter

which doubles the line count and doesn't add to readability.

My prettier settings are:

  "editor.tabSize": 2,
  "prettier.singleQuote": true,
  "prettier.tabWidth": 2,
  "prettier.useTabs": false,
  "prettier.semi": true,
  "prettier.printWidth": 120,
  "prettier.eslintIntegration": true,

Event when I reset to default settings, this new line thing still occurs. Does anybody has suggestions? Thanks.

like image 692
Han Che Avatar asked Aug 13 '18 11:08

Han Che


1 Answers

I found the following related open feature request: https://github.com/prettier/prettier/issues/1974

It looks like, for now, they do not have an option to change the behaviour...

According to Angular style guideline, it should be on one line: https://angular.io/guide/styleguide#decorate-input-and-output-properties

like image 186
MadKonst Avatar answered Sep 30 '22 22:09

MadKonst