Custom Rules
If we don’t have all the rules you’re looking for, you can either write your own custom rules or use custom rules that others have developed.
Then, when using the CLI, point it to a directory with your compiled custom rules like the following:
tslint --rules-dir path/to/directory-with-rules/ file/to/lint.ts
You can do similarly when using the library version by specifying a rulesDirectory
field of your options
object.
Finally, you can specify the path to your custom rules inside of your tslint.json
file.
Custom Rules from the TypeScript Community
The repos below are good sources of community-created TSLint 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
- ng2lint - A set of TSLint rules for static code analysis of Angular 2 TypeScript projects