Skip to content

Instantly share code, notes, and snippets.

@lucasecdb
Last active February 27, 2019 00:36
Show Gist options
  • Save lucasecdb/948c103849ed99015b900ab928b050f3 to your computer and use it in GitHub Desktop.
Save lucasecdb/948c103849ed99015b900ab928b050f3 to your computer and use it in GitHub Desktop.
Migrate node app to typescript
{
"extends": [
"plugin:@typescript-eslint/recommended",
"eslint:recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
"plugins": ["prettier", "@typescript-eslint"],
"env": {
"es6": true,
"node": true,
"browser": false
},
"parser": "@typescript-eslint/parser",
"rules": {
"no-underscore-dangle": [1, { "allow": ["_id"] }],
"semi": ["error", "never"],
"quotes": ["error", "single"],
"comma-dangle": ["error", "always-multiline"],
"no-console": "off"
}
}
#!/bin/bash
yarn add -D @types/node \
@types/express \
@types/bcrypt \
@types/bodyparser \
@types/cookie-parser \
@types/graphql \
"types/npm-ramda#dist" \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
concurrently \
eslint \
eslint-config-prettier \
eslint-plugin-prettier \
nodemon \
prettier \
typescript
echo "Add the following \"start\" script: concurrently -k -p \\\"[{name}]\\\" -n \\\"TypeScript,Node\\\" -c \\\"cyan.bold,green.bold\\\" \\\"yarn watch-ts\\\" \\\"yarn watch-node\\\""
echo "Add the following \"watch-ts\" script: tsc --watch"
echo "Add the following \"watch-node\" script: nodemon dist/index.js"
echo "Add the following \"build\" script: tsc"
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*", "types/*"]
}
},
"include": ["**/*"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment