Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 2.52 KB

migrating-v2-to-v3.md

File metadata and controls

68 lines (47 loc) · 2.52 KB
id title
migrating-v2-to-v3
Migrating from v2 to v3

3.x.x Breaking Changes

Versions 1.x.x up to 2.x.x of typescript-node-scripts used TSLint as the default linter. However, TSLint has announced that it will be deprecated sometime in 2019, and packages that use TSLint should migrate to use ESLint.

Version 3.x.x of typescript-node-scripts will now use ESLint instead of TSLint to lint your project.

Automatic Migration via CLI

We've included a migration script so that you can migrate your TSLint configuration to ESLint configuration without heavylifting, and installs the necessary base packages to make your project ESLint compatible.

# go to your project root
cd <app_directory>

# install version 3.x.x of `typescript-node-scripts`
yarn upgrade typescript-node-scripts@^3.0.0

# run the migration script
npx typescript-node-scripts migration/tslint-to-eslint

You're done! Be sure to go through the console output so that you can see what potential issues that needs to be addressed.

Gotchas

Since there is a disparity between ESLint and TSLint rules and plugins, custom added TSLint rules and plugins has to be migrated to ESLint manually.

If you are using the default tslint.json generated with typescript-node-scripts, you shouldn't need to do anything more than running the migration script.

TypeScript support in ESLint is supported by the typescript-eslint toolchain, and you should take a look at the repository to find out how to migrate your rules and plugins manually.

Additionally, tools like tslint-to-eslint-config can aid in converting your custom TSLint rules to ESLint-compatible rules.

Adding Prettier

A lot of projects use Prettier, and here's a short guide on how to get Prettier up and running with ESLint.

Be sure that you have already ran the migration script above, have Prettier installed, and have an existing .prettierrc already in your project root.

  1. Install the ESLint plugins:
yarn add eslint-config-prettier eslint-plugin-prettier --dev
  1. Modify extends in .eslintrc.json:
    "extends": [
        "eslint:recommended",
+       "prettier"
    ],
    "overrides: [
        {
            "extends": [
                "plugin:@typescript-eslint/recommended"
+               "prettier",
+               "prettier/@typescript-eslint"
            ]
        }
    ]