Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use the built in linter in Typescript >2 or TSLint?

I'm trying to decide why I should use TSLint in my Typescript2/Angular2 project.

List of rules exposed by TSLint: https://palantir.github.io/tslint/rules/

Compiler options available using TypeScript: https://www.typescriptlang.org/docs/handbook/compiler-options.html

Since Typescript2 now has some compiler options such as --noUnusedParameters, is there really a need for TSLint? Is TSLint a superset of the compiler options?

Project structure:

.
├── bower.json
├── index.js
├── package.json
├── src
│   ├── app
│   │   ├── app.component.spec.ts
│   │   ├── app.component.ts
│   │   └── app.module.ts
│   ├── index.html
│   ├── main.ts
│   └── tsconfig.json
├── tslint.js
├── webpack.common.js
└── webpack.dev.config.js
like image 568
bobbyrne01 Avatar asked May 30 '17 11:05

bobbyrne01


People also ask

Should I use ESLint or TSLint?

TSLint can only be used for TypeScript, while ESLint supports both JavaScript and TypeScript. It is likely, within a large project that you may use both JavaScript and TypeScript.

Is TSLint obsolete?

TSLint has been the recommended linter in the past but now TSLint is deprecated and ESLint is taking over its duties.

Do we need TSLint?

Ts lint is deprecated now. It still works totally fine, but if you want to stay current in your next typescript project you should use ESlint. If you have an existing code base using TsLint you should upgrade as soon as possible. The primary benefit of moving to Eslint is that you get continuous updates from the team.

Why is TSLint deprecated?

Palantir, the creators of TSLint, recently announced the deprecation of TSLint, putting their support behind typescript-eslint to consolidate efforts behind one unified linting solution for TypeScript users. Discussions between the TypeScript team, ESLint team, and TSLint team have been ongoing.


2 Answers

TSLint removes rules when they are added to TypeScript proper. There's still a lot of rules in there that TypeScript doesn't check for, though, so if you care about it, you'll probably want to use both.

like image 114
Vincent Avatar answered Sep 19 '22 20:09

Vincent


I'm happily using TSLint for Typescript Library Starter in combination with TSLint config standard which not only offers you a widen set of rules, but also they aim to be standardised.

like image 25
Alex JM Avatar answered Sep 20 '22 20:09

Alex JM