An sbt plugin for tslint. It will statically check your typescript files for error prone code.
By default linting occurs as part of your project's tslint
task. Both src/main/assets/**/*.ts and
src/test/assets/**/*.ts sources are linted.
The rules that will be checked in your project can be specified with a tslint.json
file.
To use this plugin use the addSbtPlugin command within your project's plugins.sbt (or as a global setting) i.e.:
addSbtPlugin("name.de-vries" % "sbt-tslint" % "5.7.0")
Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:
lazy val root = (project in file(".")).enablePlugins(SbtWeb)
If you want to use just the tslint rules you can use this tslint.json as a starter.
You can also use different linting rule sets. The plugin provides convenience settings for the following rule sets:
- tslint-eslint-rules set. Use setting
tsLintEsLintRulesDir
- tslint-mscontrib-rules. Use setting
tslintMsContribRulesDir
- ng2 lint rules. Use setting
ng2LintRulesDir
To add f.i. tslint-eslint add the following to your build.sbt
.
libraryDependencies ++=Seq( "org.webjars.npm" % "tslint-eslint-rules" % "3.1.0")
(rulesDirectories in tslint) := Some(List((tslintEslintRulesDir).value))
See the setting keys for configuration options. For example: the default formatter is "prose".
- version upgrade
- upgrade to sbt 1.0
- version upgrade
- support tslint.json#lintOptions
- version upgrade
- upgrades to tslint 4.0.2 and typescript 2.1.1
- fixes tslint 'extends' feature. tx jsebrech
- upgrades to tslint 3.15.1 and typescript 2.0.10
- upgrades webjars-locator, sbt-web and sbt-js-engine
- follows tslint version nr
- adds support for ts 2 in combination with codelyzer
- fixes ng2 linting
- add convenience setting for ng2 lint rules.
- upgrades to typescript 1.8.10
- extended example tslint.json with eslint configurations
- upgrades to typescript 1.8.7 and tslint 3.6.0
- allows for comments in the tslint.json
- Fixes a bug in the tslint-eslint example.
- support for configuring different rules directories, different formatters, different formatter directories.
- convenience setting for tslint-eslint-rules rules. See the example build.sbt for an example of how to use these rules that lint both ES6 and Typescript.