Linting
⚠️Note that TSLint is now in maintenance and you should try to use ESLint instead. If you are interested in TSLint tips, please check this PR from @azdanov. The rest of this section just focuses on ESLint. You can convert TSlint to ESlint with this tool.
⚠️This is an evolving topic.
typescript-eslint-parser
is no longer maintained and work has recently begun ontypescript-eslint
in the ESLint community to bring ESLint up to full parity and interop with TSLint.
Follow the TypeScript + ESLint docs at https://github.com/typescript-eslint/typescript-eslint:
add a lint
script to your package.json
:
and a suitable .eslintrc.js
(using .js
over .json
here so we can add comments):
Most of this is taken from the tsdx
PR which is for libraries.
More .eslintrc.json
options to consider with more options you may want for apps:
You can read a fuller TypeScript + ESLint setup guide here from Matterhorn, in particular check https://github.com/MatterhornDev/learn-typescript-linting.
Another great resource is "Using ESLint and Prettier in a TypeScript Project" by @robertcoopercode.
If you're looking for information on Prettier, check out the Prettier.