helpers

Provide AST navigation, type checking, and module analysis utilities for SonarJS rule development.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Simplifies the implementation and maintenance of SonarJS rules by providing a comprehensive set of helper functions and utilities.

Core Features & Use Cases

  • AST Navigation: Offers functions to traverse and query JavaScript/TypeScript abstract syntax trees (ASTs).
  • Type Checking: Provides helpers for type inference and validation using TypeScript parser services.
  • Module Analysis: Functions for analyzing JavaScript modules, including imports and exports.
  • String & Regex Tools: Standard string and regular expression utilities for pattern matching.
  • Use Case: When implementing new rules for SonarJS, these helpers enable developers to avoid reinventing the wheel and leverage existing tools for AST manipulation and type checking.

Quick Start

Use the helper functions to analyze and manipulate the AST of a JavaScript file for your custom SonarJS rule.

Frequently Asked Questions about helpers

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

FAQPage Schema
How do I write custom SonarJS rules for JavaScript and TypeScript AST navigation?

To write custom SonarJS rules for JavaScript and TypeScript, you can use dedicated helper functions that simplify abstract syntax tree navigation, type checking, and module analysis. These utilities prevent reinventing the wheel during rule implementation.

What utilities are available for TypeScript type checking in SonarJS rule development?

For TypeScript type checking in SonarJS, helper utilities provide type inference and validation by leveraging TypeScript parser services. This allows developers to accurately query and validate types when analyzing code for custom static analysis.

Can I analyze JavaScript module imports and exports when creating custom linter rules?

Yes, you can analyze JavaScript module imports and exports when creating custom linter rules. The helpers provide specific functions for module analysis, allowing you to inspect import and export structures within the abstract syntax tree.

How do I use string and regex utilities for pattern matching in JavaScript code analysis?

You can use string and regex utilities for pattern matching in JavaScript code analysis by applying standard string and regular expression helper functions provided for SonarJS rule development. These tools streamline identifying specific code patterns.

Do I need TypeScript parser services to validate types in my static analysis rules?

Yes, you need TypeScript parser services to validate types in your static analysis rules. The helpers use these services to provide accurate type inference and validation, which is essential for effective JavaScript and TypeScript code analysis.