Migrating from TSLint to ESLint
Source: TSLint to ESLint
Last year TSLint was deprecated in favor of ESLint (TSLint in 2019). TSLint was a valuable project for the TypeScript community and the efforts there were greatly appreciated. The migration from TSLint to ESLint is welcome in being able to leverage more of what the larger JavaScript community has been developing. All of the functionality that was available to us through TSLint is being migrated to ESLint plugins. In this article we will go through migrating a project from TSLint to ESLint. We’ll even throw in Prettier support for a little sprinkles on our sundae.
Our TSLint Project
The first thing to look at is what our project looks like with TSLint. For our purposes something very simple will do.
Highlights here are I have all of my TS source in the src
directory. I have a tsconfig.json
, a tslint.json
and a .prettierrc
. If we dig further and look into the package.json
we’ll see these dev dependencies:
"prettier": "^1.19.1",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.1.0",
"typescript": "^3.7.5"
Next, let’s look at the scripts
I have defined to run these tools.
"lint": "tslint --fix './src/**/*.ts'",
"format": "prettier --write 'src/**/*.ts'",
"prebuild"…