Google TypeScript Style

Google의 TypeScript 스타일 가이드 도구 → GTS

GTS는 Google의 TypeScript 스타일 가이드이며 포맷터(formatter), 린터(linter), 자동 코드 수정(automatic code fixer)의 구성(configuration)입니다. 이 구성을 사용해 TypeScript 프로젝트를 손쉽게 시작할 수 있습니다.

GTS로 프로젝트 시작하기

GTS를 사용해 프로젝트를 시작하는 방법은 다음과 같이 간단합니다.

npx gts init

앞서 작성한 명령은 TypeScript 프로젝트 설정에 필요한 tsconfig.json, .eslintrc.json , .prettierrc.js 파일을 생성하고, package.json 파일을 만든 후 (설치 과정 옵션 질문에 Y 답변 시), 의존 패키지까지 설치합니다.

.
├── src/
   └── index.ts        # 엔트리 파일
├── .eslintignore       # ESLint 제외 항목
├── .eslintrc.json      # ESLint 구성
├── .prettierrc.js      # Prettier 구성
├── tsconfig.json       # TypeScript 구성
├── package.json
└── package-lock.json

GTS 명령 목록

GTS는 다음 명령을 제공합니다. (package.json 파일 scripts 참고)

개별 파일 명령

디렉토리(폴더) 단위가 아닌, 개별 파일 단위로 명령을 실행할 수도 있습니다.

npx gts lint index.ts 
npx gts lint one.ts two.ts three.ts 
npx gts lint *.ts

Last updated