This package has been deprecated

Author message:

Package no longer supported. Consider using eslint-plugin-sonarjs.

tslint-sonarts

1.9.0 • Public • Published

SonarTS Build Status NPM version Quality Gate Coverage

Static code analyzer for TypeScript detecting bugs and suspicious patterns in your code.

Follow us on twitter

To analyze pure JavaScript code, see SonarJS

How does it work?

Rules

Bug Detection 🐛

Rules in this category aim to find places in code which has a high chance to be bugs, i.e. don't work as intended. Most of the time this is a result of bad copy-paste (no-identical-conditions) or improvident API usage (no-misleading-array-reverse). Some rules are raising issues on unused values (no-useless-increment), which is at best wasted code and at worst a bug.

Code Smell Detection 🐷

Code Smells issues, or Maintainability issues, are raised for places of code which might be costly to change in the future (cognitive-complexity). These rules also help to keep the high code quality and readability (no-commented-code, no-identical-functions, use-primitive-type). And finally some rules report issues on different suspicious code patters (no-dead-store, no-gratuitous-expressions).

Prerequisites

Node.js (>=6.x).

Use in TSLint

  • If you don't have TSLint yet configured for your project follow these instructions.
  • Install tslint-sonarts
npm install tslint-sonarts --save-dev   # install in your project 
npm install tslint-sonarts -g           # or install globally 
  • Add tslint-sonarts to your tslint.json extends property:
{
  "extends": ["tslint:recommended", "tslint-sonarts"]
}
  • Some of the rules in SonarTS require type information. So in order to provide as much value as possible run TSLint with type-checker, for example:
tslint --project ./tsconfig.json 'src/**/*.{ts,tsx}'

We also have a plugin for ESLint

Use in SonarQube

SonarTS is available as plugin for SonarQube. SonarQube is an open source platform for continuous inspection of code quality. Thanks to the platform, SonarTS provides additional features:

  • Code coverage import
  • Duplication detection
  • Various metrics
  • More rules

See the documentation here and example project here.

Also available online on ☁️ SonarCloud

Contributing

You want to participate to the development of our TypeScript analyzer? Have a look at our contributor guide!

Package Sidebar

Install

npm i tslint-sonarts

Weekly Downloads

10,520

Version

1.9.0

License

LGPL-3.0

Unpacked Size

845 kB

Total Files

321

Last publish

Collaborators

  • lpaulger_sonarsource
  • gabssnake
  • lucio.merotta.sonarsource
  • jcarsique-sonar
  • saberduck
  • elena-vilchik
  • andrea-guarino-sonarsource
  • gregaubert
  • sonar-jay
  • philippe-perrin-sonarsource
  • xay.tanovan
  • wouter-admiraal-sonarsource
  • mathieu-sonar
  • antonio.garcia.sonarsource
  • tomverin
  • yassin-kammoun-sonarsource
  • sonartech