Skip to end of metadata
Go to start of metadata

Could not retrieve - Page not found.


SonarTS detects bugs, vulnerabilities and code smells in TypeScript code.


  • TypeScript version >=2.2

  • Node.js >=6

First Analysis of a TypeScript Project

  1. Install SonarQube Server (see Setup and Upgrade for more details)
  2. Install SonarQube Scanner and be sure your can call sonar-scanner from the directory where you have your source code
  3. Install SonarTS (see Installing a Plugin for more details)

  4. If missing, install node.js on the machine where you run analysis
  5. In your project, make sure to have typescript as a project dependency or dev dependency. If it's not the case, add it : 

    cd your-project-folder
    npm install -D typescript

    If you can't have typescript as a project dependency you can set your 'NODE_PATH' variable to point to your globally installed typescript, but this is generally discouraged in the node.js documentation.

  6. Run your analysis with the SonarQube Scanner by executing the following command from the root directory of the project:

    sonar-scanner -Dsonar.projectKey=xxx -Dsonar.sources=.
  7. Follow the link provided at the end of the analysis to browse your project's quality in SonarQube UI

Further Analyses

Assuming steps 1-3 above have already been completed, you'll want to encapsulate your analysis parameters in a file at the root of your project (see a sample project on GitHub: Then subsequent analyses can simply be run with:


Configuring Rule Profile

SonarTS provides 2 rule profiles out of the box: "Sonar way" (default) and "Sonar way Recommended".

"Sonar way" Profile

"Sonar way" profile is activated by default. It defines a trimmed list of high-value/low-noise rules useful in almost any TypeScript development context. You can check out the list of rules belonging to "Sonar way" on SonarCloud.

"Sonar way Recommended" Profile

"Sonar way Recommended" contains all rules from "Sonar way" (bugs and pitfall detection), plus more rules that mandate high code readability and long-term project evolution. You can check out the list of rules belonging to "Sonar way Recommended" on SonarCloud.

Above Predefined Rule Profiles

By using SonarQube UI you can create your own rule profiles and activate even more rules which are valuable in your development context.

SonarTS specific properties

SINCE 1.2.0



Can be used to explicitly set location of Node.js executable. If not set analysis will use node from the PATH

SINCE 1.3.0


List of file path patterns to be excluded from analysis of TypeScript files. Default value is `**/node_modules/**,**/bower_components/**`

SINCE 1.8.0


Can be used to explicitly set a path to a tsconfig JSON file relative to the project/module base directory.

Advanced Usage

With SonarTS, you can also:


  • No labels