Skip to content

Instantly share code, notes, and snippets.

@arol
Created October 31, 2018 07:23
Show Gist options
  • Save arol/f2755a00a8f89d31fe9acccc2c31bd4f to your computer and use it in GitHub Desktop.
Save arol/f2755a00a8f89d31fe9acccc2c31bd4f to your computer and use it in GitHub Desktop.
Node.js + Babel + TypeScript

Babel + Typescript in the

  1. Install babel (https://babeljs.io/setup#installation)
  2. Add typescript (https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/)
  3. Change all files from .js extension to .ts.
  4. Set up the development process to be babel-node --extensions '.ts,.tsx’ index.ts
  5. Install tslint. (https://palantir.github.io/tslint/usage/cli/). Here you have a tslint.json file example:
{
  "extends": "tslint:recommended",
  "rules": {
    "max-line-length": {
      "options": [120]
    },
    "new-parens": true,
    "no-arg": true,
    "no-bitwise": true,
    "no-conditional-assignment": true,
    "no-consecutive-blank-lines": false,
    "no-console": {
      "severity": "warning",
      "options": ["debug", "info", "log", "time", "timeEnd", "trace"]
    }
  },
  "jsRules": {
    "max-line-length": {
      "options": [120]
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment