TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.
TSLint currently supports:
- an extensive set of core rules
- custom lint rules
- custom formatters (failure reporters)
- inline disabling and enabling of rules with comment flags in source code
- configuration presets (
tslint:latest
,tslint-react
, etc.) and plugin composition - automatic fixing of formatting & style violations
- integration with MSBuild, Grunt, Gulp, Atom, Eclipse, Emacs, Sublime, Vim, Visual Studio 2015, Visual Studio 2017, Visual Studio code (alternative: use this extension for TS <3.2), WebStorm and more
Please refer to the full installation & usage documentation on the TSLint website. There, you'll find information about
- configuration,
- core rules,
- core formatters, and
- customization of TSLint.
- inline disabling and enabling of rules with comment flags
- tslint-react - Lint rules related to React & JSX.
- tslint-blueprint - Lint rules to enforce best practices with blueprintjs libraries
If we don't have all the rules you're looking for, you can either write your own custom rules or use rules implementations developed by the community. The repos below are a good source of custom rules:
- ESLint rules for TSLint - Improve your TSLint with the missing ESLint Rules
- tslint-microsoft-contrib - A set of TSLint rules used on some Microsoft projects
- codelyzer - A set of tslint rules for static code analysis of Angular TypeScript projects
- vrsource-tslint-rules
- tslint-immutable - TSLint rules to disable mutation in TypeScript
- tslint-consistent-codestyle - TSLint rules to enforce consistent code style in TypeScript
- tslint-sonarts - Bug-finding rules based on advanced code models to spot hard to find errors in TypeScript
- tslint-clean-code - A set of TSLint rules inspired by the Clean Code handbook
- rxjs-tslint-rules - TSLint rules for RxJS
Prerequisites:
node
v7+yarn
v1.0+
git clone git@github.com:palantir/tslint.git --config core.autocrlf=input --config core.eol=lf
cd tslint
yarn
yarn compile
yarn test