Last active
April 17, 2021 17:17
-
-
Save PranjalAgni/8dde905152edcf7bfc6c74b73f5c6fdd to your computer and use it in GitHub Desktop.
Setting up NodeJS + Typescript project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"root": true, | |
"parser": "@typescript-eslint/parser", | |
"plugins": ["@typescript-eslint", "prettier"], | |
"extends": [ | |
"eslint:recommended", | |
"plugin:@typescript-eslint/recommended", | |
"prettier" | |
], | |
"rules": { | |
"no-console": 1, | |
"prettier/prettier": 2 | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"semi": true, | |
"trailingComma": "none", | |
"singleQuote": false, | |
"printWidth": 80 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"watch": ["src"], | |
"ext": ".ts,.js", | |
"ignore": [], | |
"exec": "ts-node --files ./src/index.ts" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"build": "rimraf ./dist && tsc", | |
"start": "npm run build && node dist/server.js", | |
"start:dev": "nodemon", | |
"lint": "eslint . --ext .ts" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm init -y | |
npm install -D typescript | |
npm install -D @types/node | |
npm install --save-dev ts-node nodemon | |
npm install -D prettier | |
npm install -D eslint-config-prettier eslint-plugin-prettier | |
npx eslint --init | |
Add tsconfig.json | |
Add nodemon.json | |
Add .eslintrc | |
Add .prettierrc | |
Sample package.json scripts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"esModuleInterop": true, | |
"allowSyntheticDefaultImports": true, | |
"target": "es6", | |
"noImplicitAny": true, | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"outDir": "dist", | |
"baseUrl": ".", | |
"paths": { | |
"*": ["node_modules/*", "src/types/*"] | |
} | |
}, | |
"include": ["src/**/*"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment