Skip to content

m99coder/typescript-eslint-prettier

Repository files navigation

typescript-starter

Setup

How to Setup a TypeScript + Node.js Project

npm init -y
npm install typescript --save-dev
npm install @types/node --save-dev
npx tsc --init \
  --rootDir src \
  --outDir build \
  --esModuleInterop \
  --resolveJsonModule \
  --lib es6 \
  --module commonjs \
  --allowJs true \
  --noImplicitAny true
# npx tsc
npm install ts-node nodemon --save-dev
npm install rimraf --save-dev

How to use ESLint with TypeScript

npm install eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-dev

How to use Prettier with ESLint and TypeScript in VSCode

npm install prettier --save-dev
npm install eslint-config-prettier eslint-plugin-prettier --save-dev

Enforcing Coding Conventions with Husky Pre-commit Hooks

npm install husky --save-dev
npm set-script prepare "husky install"
npm run prepare
npx husky add .husky/pre-commit "npm run lint"

Alternatively, use lint-staged

npx mrm@2 lint-staged

Testing

npm install eslint-plugin-jest jest jest-cucumber ts-jest @types/jest --save-dev
npm set-script test "jest"
npm set-script test:dev "jest --watchAll"
npx ts-jest config:init

Backup

tar -czvf typescript-starter.tar.gz typescript-starter
du -h typescript-starter.tar.gz
tar -xvf typescript-starter.tar.gz

About

Basic starter for TypeScript with ESLint, Prettier and Jest

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published