포시코딩

[Prettier] 버전에 따른 default 값 변화 본문

카테고리 없음

[Prettier] 버전에 따른 default 값 변화

포시 2024. 1. 9. 17:12
728x90

https://meetup.nhncloud.com/posts/243

 

prettier 2.0에서 달라진 옵션 살펴보기 : NHN Cloud Meetup

prettier 2.0은 얼마 전(2020.3) 정식 릴리즈되었습니다. 바로 적용을 하려다 조금 기간을 두고 적용하자는 의견이 있어 쪼-금 두고 봤습니다. 두 달 정도 시간이 지나 Chart 4.0 개발에 Prettier2.0을 적용

meetup.nhncloud.com

 

https://github.com/prettier/prettier/issues/11465

 

Change the default value for `trailingComma` to `"all"` in v3 · Issue #11465 · prettier/prettier

Trailing commas in function syntax was introduced in ES2017, it's supported since Node.js 8.2.1, modern browsers supports it too. I think it's time to change trailingComma to "all".

github.com

 

 

prettier 설정을 그냥 갖다 쓰거나 내가 보기에 좋게 써왔는데 

협업하는 과정에서 옵션을 선정하던 중 

default 값으로 되어 있는 값들이 버전마다 다른걸 보고 왜 그럴까 하다 위 링크들에서 이유를 찾을 수 있었다. 

 

브라우저 환경이나, 개발자들의 편의성 등을 고려해 업데이트 해온 것을 알 수 있었는데 

억지로 명시해서 이상한 값으로 쓰는거보다 

{
  "singleQuote": true,
  "trailingComma": "all"
}

 

두줄만 적혀있을 때 제일 보기 편한게 그 이유이지 않았을까 싶다. 

 

{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "quoteProps": "as-needed",
  "trailingComma": "all",
  "bracketSpacing": true,
  "arrowParens": "always",
  "endOfLine": "lf", 
  "embeddedLanguageFormatting": "auto"
}

 

당분간은 최종적으론 위와 같이 사용할듯

728x90