-
코드 포맷터 ( Prettier ) 사용하기기타 2023. 6. 15. 12:45
js 를 변경하고 싶을 때,
다음과 같이 띄어쓰기가 되어있지 않다면 매우 곤란하다.
이 때 자동으로 코드를 포맷해주는 Prettier를 사용해보자
사용방법은 간단하다.
npm에서 전역으로 prettier를 설치하고3번의 명령어를 실행하면 되는데, vsCode의 powerShell 에서는 보안상 스크립트를 실행할 수 없었다.
이럴때는powerShell을 관리자 권한으로 실행한 뒤
실행 정책을 Restricted 에서 RemoteSigned로 변경해서
js 를 powerShell에서 실행할 수 있도록 변경한 후, prettier를 사용하면해당 js 파일이 다음과 같이 보기 좋아진다
'기타' 카테고리의 다른 글
mybatis: resultMap ( 1:1 / 1:n select ) (0) 2023.06.21 if문과 논리연산자 (0) 2023.06.15 ajax를 사용하지 않는 방법 생각해보기 (1) 2023.06.12 더미데이터 생성하기 ( Mockaroo ) (0) 2023.06.07 반응형 웹 레이아웃 만들기 (0) 2023.05.15