alantsui5 / typescript-nodejs-template

A simple template for typescript Node.js project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript Node.js Template

This is a simple template to get you started on writing Node.js applications using TypeScript.

Get started

# Optional: install degit to clone template easier
npm i -g degit

# Clone the project
degit https://github.com/alantsui5/typescript-nodejs-template.git

# Development
npm run watch

# Production
npm run build
npm start

# Run Code Prettier 
npm run prettier-format

# Run ESLint Linter
npm run lint-and-fix
# or
npm run lint

Why use Prettier

In team collaboration, code style consistency is important for people to communicate.
What Prettier does is format the code to maintain consistent style while increase readability. Prettier can be customized with .prettierrc.
The most common two are as follows.

{
  "semi": false,
  "singleQuote": true
}

semi is to choose whether ; need to be at the back of each line.
singleQuote is to use single quote for string, false value means use double quote for string.

Why use ESLint

Debugs consumes time and effort, ESLint can help us to automate fixing and identifying of some syntax error and errors caused by dangerous operations.
The modules used in this .eslintrc are about typescript, you can change the config so that it fits other projects.

About

A simple template for typescript Node.js project


Languages

Language:TypeScript 100.0%