Skip to content
SonarJS rules for ESLint
TypeScript JavaScript Shell
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github add github issue and pull request templates (#35) Apr 11, 2018
docs add rule no-collapsible-if (#110) May 31, 2019
ruling
scripts Add script to generate metadata for SonarJS (#86) Oct 2, 2018
src no-collapsible-if: report on enclosing if as primary location (#115) May 31, 2019
tests no-collapsible-if: report on enclosing if as primary location (#115) May 31, 2019
.eslintrc.js add sonarjs to eslintrc Apr 12, 2018
.gitattributes initial commit Apr 3, 2018
.gitignore configure dev environment Apr 4, 2018
.gitmodules add ruling (#22) Apr 5, 2018
.npmignore update .npmignore (#60) Apr 12, 2018
.travis.yml add eslint (#41) Apr 11, 2018
LICENSE initial commit Apr 3, 2018
README.md add rule no-collapsible-if (#110) May 31, 2019
package.json v0.4.0 (#116) May 31, 2019
sonar-project.properties update project description Apr 4, 2018
tsconfig-src.json add ruling (#22) Apr 5, 2018
tsconfig.json add ruling (#22) Apr 5, 2018
yarn.lock upgrade lint-staged version to support node v10 (#76) Sep 25, 2018

README.md

eslint-plugin-sonarjs npm version Build Status Quality Gate Coverage

SonarJS rules for ESLint to detect bugs and suspicious patterns in your code.

We also have a plugin for TSLint

Rules

Bug Detection 🐛

Rules in this category aim to find places in code which have a high chance of being bugs, i.e. don't work as intended.

Code Smell Detection 🐷

Code Smells, or maintainability issues, are raised for places of code which might be costly to change in the future. These rules also help to keep the high code quality and readability. And finally some rules report issues on different suspicious code patters.

Prerequisites

Node.js (>=6.x).

Usage

  • If you don't have ESLint yet configured for your project, follow these instructions.
  • Install eslint-plugin-sonarjs using npm (or yarn) for you project or globally:
npm install eslint-plugin-sonarjs --save-dev # install for your project
npm install eslint-plugin-sonarjs -g         # or install globally
  • Add eslint-plugin-sonarjs to the plugins option of your .eslintrc:
{
  "plugins": ["sonarjs"]
}
  • Add plugin:sonarjs/recommended to the extends option to enable all recommended rules:
{
  "extends": ["plugin:sonarjs/recommended"]
}
  • or enable only some rules manually:
{
  "rules": {
    "sonarjs/cognitive-complexity": "error",
    "sonarjs/no-identical-expressions": "error"
    // etc
  }
}

Contributing

You want to participate in the development of the project? Have a look at our contributing guide!

You can’t perform that action at this time.