id | title |
---|---|
migrating-v2-to-v3 |
Migrating from v2 to v3 |
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.
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.
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 withtypescript-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.
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.
- Install the ESLint plugins:
yarn add eslint-config-prettier eslint-plugin-prettier --dev
- Modify
extends
in.eslintrc.json
:
"extends": [
"eslint:recommended",
+ "prettier"
],
"overrides: [
{
"extends": [
"plugin:@typescript-eslint/recommended"
+ "prettier",
+ "prettier/@typescript-eslint"
]
}
]