Java Script

[error] comment are not permitted in json

은선은 2022. 4. 7. 17:43

.prettierrc 기본적으로 json으로 작성되어 있다.

그 json 파일에 주석을 달고 싶은데 에러가 뜬다.

 

comment are not permitted in json

해결방법

.prettierrc파일을 js파일로 바꾸고 module.exports 해준다.

 

1. 파일명 변경 (.prettierrc -> .prettierrc.js)

2. module.exports

// before
{
  "printWidth": 100, // 프린터가 줄 바꿈할 줄 길이를 지정
};


// after
module.exports = {
  "printWidth": 100, // 프린터가 줄 바꿈할 줄 길이를 지정
};