eslint-plugin-prettier와 prettier-eslint의 구분
이 조합을 사용하려면
1. prettier-eslint 사용
2. eslint-plugin-prettier 사용
두 가지 방법이 있다는 것을! !
각각의 특징
prettier-eslint
This formats your code via
prettier
, and then passes the result of that to eslint --fix
prettier
를 통해서, 그 결과를 eslint --fix
에 더 통과시켜.라는 것.
prettier-eslint-cli 과 함께 사용하는 것으로, 커멘드 라인으로부터 편리하게 사용할 수 있게 되는 것 같다.
eslint-plugin-prettier
Runs Prettier as an ESLint rule and reports differences as individual ESLint issues.
ESLint 규칙으로 prettier를 실행하고 ESLint 오류를보고합니다.
라는 느낌?
그것보다 중요한 것은
The rule is autofixable -- if you run eslint with the
--fix
flag, your code will be formatted according to prettier
style.eslint --fix
에서 prettier
의 스타일을 적용하고 서식을 지정합니다.라는 것.
eslint-config-prettier 그리고 prettier와 eslint 규칙 사이의 충돌을 해결합니다.
prettier-eslint vs eslint-plugin-prettier
그럼, 어느 쪽을 사용하면 엔이나
역시 같은 의문을 가진 사람이 있고, prettier의 컨트리뷰터가 대답해 준다.
htps : // 기주 b. 코 m / p 레치 r / p 레치 r - s s t / 이스 s / 11
이 두 가지 차이점이
prettier-eslint는 prettier의 결과를
eslint --fix
에 전달합니다. 그래서 eslint의 설정이 우선되어 prettier의 포맷은 덮어쓰여져 버릴 가능성이 있다.eslint-plugin-prettier는
eslint --fix
와 동시에 달리기 때문에, prettier 체재는 유지된다.eslint-plugin-prettier - ESLint plugin. While prettier-eslint uses eslint --fix to change the output of prettier, eslint-plugin-prettier keeps the prettier output as-is and integrates it with the regular ESLint workflow.
htps : // 기주 b. 코 m / p 레치 r / p 레치 r- s s t # re d d
그래서 어느 쪽을 사용하는 것이 베스트라고 말하는 것이 아니라 케이스 바이 케이스가 되는 것 같다.
개인적인 감상
eslint-plugin-prettier를 사용합니다. 자신의 프로젝트에서는 airbnb의 스타일을 기반으로 하고 있습니다만, 운용상 이것으로 문제가 되고 있는 곳은 지금의 곳은 없습니다.
eslint에 규약을 고리고리에 써서, prettier는 보조적으로 사용하고 싶다고 하는 사람등은 prettier-eslint를 사용하는 선택이 좋을지도 모른다고 생각했습니다!
Reference
이 문제에 관하여(eslint-plugin-prettier와 prettier-eslint의 구분), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ayuareu/items/23d34605b2e9194651f0텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)