Sonarjs

From managedcode/dotnet-skills · View interactive version

Sonarjs is an AI agent skill from the GitHub repository managedcode/dotnet-skills. Use SonarJS-derived rules in .NET repositories that ship JavaScript or TypeScript frontends and need deeper bug-risk, code-smell, or cognitive-complexity checks than a minimal ESLint baseline. USE FOR: SonarQube, SonarCloud, or eslint-plugin-sonarjs setups; frontend code smells; cognitive complexity

How to use this skill

Skill file

SonarJS Rules for Frontend Assets in .NET Repositories

Trigger On

Do Not Use For

Inputs

flowchart LR
  A["Need Sonar-style checks in a .NET repo frontend"] --> B{"Local developer loop or existing server gate?"}
  B -->|Local| C["Install eslint-plugin-sonarjs"]
  C --> D["Run through the normal eslint command"]
  B -->|Existing SonarQube or SonarCloud gate| E["Keep full analysis in the existing scanner pipeline"]
  D --> F["Phase rules and fix code"]
  E --> F

Workflow

  1. Decide the execution path first:
  1. For local work, treat SonarJS as an ESLint extension rather than a standalone CLI.
  2. Keep the first rollout narrow:
  1. Add rules to the existing ESLint command instead of inventing a parallel local lint entrypoint.
  2. If the repo already has SonarQube or SonarCloud, align local rule expectations with the server gate instead of maintaining two conflicting policies.
  3. Fix code or phase rules deliberately; do not hide the first rollout behind broad disables.
  4. Document licensing or hosting caveats before making Sonar-based tooling the default quality gate.

Current Upstream Notes

Bootstrap When Missing

  1. Detect current state:
  1. Prefer the local ESLint-plugin path for developer workflows:
  1. Add the plugin and selected rules to the checked-in ESLint config.
  2. Verify with the repo's normal lint entrypoint, for example:
  1. If the repo already uses SonarQube or SonarCloud, keep the full analysis in that existing CI path instead of inventing a new local scanner flow.
  2. Return status: configured if SonarJS-derived checks now have explicit ownership, or status: improved if an existing setup was tightened.
  3. Return status: not_applicable when the repo explicitly chooses a purely OSS lint baseline without Sonar-based extensions.

Handle Failures

Deliver

Validate

Ralph Loop

  1. Plan: analyze current state, target outcome, constraints, and risks.
  2. Execute one step and produce a concrete delta.
  3. Review the result and capture findings.
  4. Apply fixes in small batches and rerun checks.
  5. Update the plan after each iteration.
  6. Repeat until outcomes are acceptable.
  7. If a dependency is missing, bootstrap it or return status: not_applicable with a reason.

Required Result Format

Example Requests

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.