eslint-plugin-sonarjs
    TypeScript icon, indicating that this package has built-in type declarations

    0.10.0 • Public • Published

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

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

    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 (>=10.x).
    • ESLint 5.x, 6.x or 7.x (peer dependency for the plugin).

    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.
      }
    }
    • To enable all rules of this plugin, use @typescript-eslint/parser as a parser for ESLint (like we do) and set the parserOptions.project option. Thanks to it, type information is available, which is beneficial or even essential for some rules.

    Available Configurations

    This plugin provides only recommended configuration. Almost all rules are activated in this profile with a few exceptions (check disabled tag in the rules list). recommended configuration activates rules with error severity.

    Contributing

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

    Install

    npm i eslint-plugin-sonarjs

    DownloadsWeekly Downloads

    256,698

    Version

    0.10.0

    License

    LGPL-3.0

    Unpacked Size

    288 kB

    Total Files

    143

    Last publish

    Collaborators

    • saberduck
    • elena-vilchik
    • andrea-guarino-sonarsource
    • yassin-kammoun-sonarsource
    • sonartech
    • stas-vilchik