new-rule

Scaffold SonarJS rules for JavaScript, TypeScript, and CSS development.

1.3k|191|Updated May 15, 2012
One-click install
npx skills add https://github.com/SonarSource/SonarJS --skill new-rule-sonarsource
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-rule
Source: https://github.com/SonarSource/SonarJS/tree/main/.claude/skills/new-rule
Command: npx skills add https://github.com/SonarSource/SonarJS --skill new-rule-sonarsource

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires npm, maven, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill simplifies the process of creating new SonarJS rules, from initial scaffolding to final implementation and testing.

Core Features & Use Cases

  • Rule Scaffolding: Automates the creation of rule files and related test fixtures.
  • Java Check Class Configuration: Provides guidance on setting up the Java check class for the rule.
  • Rule Implementation: Offers a template and best practices for writing the rule implementation.
  • Testing: Assists in writing and running tests to ensure the rule's correctness.
  • Use Case: Ideal for developers who need to add custom SonarJS rules for their projects.

Quick Start

Run the command 'npm run new-rule' to generate a new rule skeleton and start the implementation process.

Frequently Asked Questions about new-rule

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom SonarJS rule for JavaScript and TypeScript?

You can create a custom SonarJS rule by running 'npm run new-rule' to automatically scaffold rule files, configure the Java check class, and generate test fixtures for JavaScript and TypeScript.

What is the best way to scaffold a code quality rule in SonarJS?

The best way to scaffold a SonarJS code quality rule is using an automated generator that creates the initial skeleton, sets up the Java check class, and provides implementation templates and best practices.

Do I need Maven and Node.js to develop SonarJS rules?

Yes, you need both Maven and Node.js (npm) installed to execute the SonarJS rule creation process, as the workflow requires configuring Java check classes alongside JavaScript and TypeScript rule implementation.

Can I implement CSS code quality rules using the SonarJS rule scaffolding process?

Yes, the SonarJS rule scaffolding process specifically targets and supports the development of custom code quality rules for CSS, in addition to JavaScript and TypeScript rule implementation.

How do I test a newly implemented SonarJS rule?

You test a newly implemented SonarJS rule by using the generated test fixtures provided during scaffolding, which assist in writing and running tests to verify the correctness of your rule logic.