Skip to content

LouisSung/TypeScript-Linter_and_Git_Hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 

Repository files navigation

Linter & Git Hooks for TypeScript | NestJS

Config files

  • Validate commit message
  • Generate valid commit message through interactive Q&A
    • npm run commit
    • Note that the generation for body is not good enough (at least to me)
      • The body wrapping is not friendly enough (use | as line break rather than enter)
      • The length limitation is unconfigurable as of no
        • CZ use 100 as default but our commitlint setting requires 72
    • The better solution is to let CZ generate header for you, then post it to Vim, which helps you on auto wrap
      • Use empty body and force quit when confirm

Environment set up

Linter

ESLint for JavaScript

JS only

  • npm install eslint --save-dev
TypeScript ESLint for TypeScript

Add TS support

  • npm install @typescript-eslint/eslint-plugin@^2.12.0 --save-dev

commitlint for Git commit

Follow the Conventional Commits

  • npm install @commitlint/config-conventional@^8.3.4 --save-dev
  • npm install @commitlint/cli@^8.3.5 --save-dev
  • npm install commitizen@^4.0.3 --save-dev
  • npm install cz-customizable@^6.2.0 --save-dev
    • Add config to package.json
      • "config": {"commitizen": {"path": "./node_modules/cz-customizable"}}

Git Hooks

Husky for pre-commit, pre-push, and commit message hooks

  • npm install husky@^4.2.3 --save-dev
Compodoc for docs auto generation
  • npm install @compodoc/compodoc@^1.1.11 --save-dev
    • NestJS documentation tutorial
      • compodoc src -p tsconfig.json -n 'Title Here' --hideGenerator

License

  • These config files are licensed under the MIT License

About

ESLint, commitlint, Commitizen, Husky, and Compodoc settings for NestJS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published