[React][TypeScript]create-react-app + tslint + prettier
개요
절차
병아리 생성
npm i -g create-react-app
create-react-app react-ts-sample --typescript
cd react-ts-sample
npm start
# open http://localhost:3000/
tslint 및 prettier 추가
npm i -D tslint tslint-react tslint-config-prettier tslint-plugin-prettier
tslint.json
{
"extends": [
"tslint:recommended",
"tslint-react",
"tslint-config-prettier"
],
"rulesDirectory": [
"tslint-plugin-prettier"
],
"rules": {
"prettier": true,
"interface-name": false
}
}
.prettierrc
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5"
}
VSCode 설정
TSLint 확장 프로그램 추가
다음 두 가지 설정 추가 settings.json { "prettier.tslintIntegration": true, "tslint.autoFixOnSave": true } 요약 이것이 완료되면 VSCode에서 lint 오류를 시각화하고 prettier로 자동 포맷 할 수 있습니다.
Reference
이 문제에 관하여([React][TypeScript]create-react-app + tslint + prettier), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ozaki25/items/a1e5e6f109ce55cbc7e7텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)