Xiphe / eslint-plugin-sonarjs

SonarJS rules for ESLint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

SonarJS rules for ESLint detecting 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 to be bugs, i.e. don't work as indented.

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 to the development of the project? Have a look at our contributing guide!

About

SonarJS rules for ESLint

License:GNU Lesser General Public License v3.0


Languages

Language:TypeScript 97.6%Language:JavaScript 2.1%Language:Shell 0.3%