eslint-config-sonarqube

raw JSON →
2.1.3 verified Fri May 01 auth: no javascript

ESLint shareable config for SonarCloud/SonarQube analysis. Version 2.1.3, released as needed. Includes rules for TypeScript, React, Jest, and accessibility. Requires manual installation of all peer dependencies. Differentiator: official SonarSource config that matches SonarQube's built-in analysis; unlike other configs, it enforces Sonar's exact rule set.

error Error: Cannot find module 'eslint-plugin-import'
cause Missing peer dependency.
fix
Install eslint-plugin-import or add it to devDependencies.
error Configuration for rule "react/jsx-no-target-blank" is invalid
cause Conflicting rule configurations from multiple configs.
fix
Check if another config (e.g., airbnb) sets the same rule and override or reorder configs.
error Oops! Something went wrong! :( ESLint: 8.0.0 ESLint config extends: sonarqube - failed to load
cause eslint-config-sonarqube not installed or version mismatch.
fix
Ensure eslint-config-sonarqube is listed in devDependencies and installed.
gotcha All peer dependencies must be manually installed – not automatically installed by npm/yarn when using older versions or pnpm.
fix Install all listed peer deps explicitly, or use npm>=7 auto-install (works with npm v7+). For pnpm, add each package to devDependencies.
deprecated This config is tightly coupled to the rules used in SonarQube analysis. Future SonarQube versions may deprecate or add rules, so keep the config version aligned.
fix Check CHANGELOG.md for rule changes when upgrading config version.
gotcha Using this config may cause rule conflicts with other ESLint configs if composed incorrectly.
fix Use ESLint's override pattern or carefully order configs; see documentation for composing configs.
npm install eslint-config-sonarqube
yarn add eslint-config-sonarqube
pnpm add eslint-config-sonarqube

Installs all peer dependencies and configures ESLint to extend sonarqube config.

# Install all peer deps and config
yarn add --dev \
  @typescript-eslint/eslint-plugin \
  @typescript-eslint/parser \
  eslint \
  eslint-config-sonarqube \
  eslint-plugin-import \
  eslint-plugin-jest \
  eslint-plugin-jest-dom \
  eslint-plugin-jsx-a11y \
  eslint-plugin-promise \
  eslint-plugin-testing-library \
  eslint-plugin-react \
  eslint-plugin-react-hooks

# Then in .eslintrc.json:
{
  "extends": "sonarqube",
  "rules": {
    // optional overrides
  }
}