eslint-plugin-sonarjs
Version:
SonarJS rules for ESLint
33 lines (32 loc) • 1.49 kB
TypeScript
import type { Rule } from 'eslint';
import { ComputedCache } from '../cache.js';
import { Minimatch } from 'minimatch';
import { type NormalizedAbsolutePath } from '../files.js';
/**
* Cache for the available dependencies by dirname. Exported for tests
*/
export declare const dependenciesCache: ComputedCache<NormalizedAbsolutePath, Set<string | Minimatch>, NormalizedAbsolutePath>;
/**
* Retrieve the dependencies of all the package.json files available for the given file.
*
* @param dir dirname of the context.filename
* @param topDir working dir, will search up to that root
* @returns Set with the dependency names
*/
export declare function getDependencies(dir: NormalizedAbsolutePath, topDir: NormalizedAbsolutePath): Set<string | Minimatch>;
export declare function getDependenciesSanitizePaths(context: Rule.RuleContext): Set<string | Minimatch>;
/**
* Gets the React version from the closest package.json.
*
* @param context ESLint rule context
* @returns React version string (coerced from range) or null if not found
*/
export declare function getReactVersion(context: Rule.RuleContext): string | null;
/**
* Parses a React version string and returns a valid semver version.
* Exported for testing purposes.
*
* @param reactVersion Version string from package.json (e.g., "^18.0.0", "19.0", "catalog:frontend")
* @returns Valid semver version string or null if parsing fails
*/
export declare function parseReactVersion(reactVersion: string): string | null;