@hyperfrontend/project-scope/tech/linting

linting

Linting-tool detectors for code-quality tools commonly found alongside JavaScript/TypeScript projects.

Covers ESLint, Prettier, Stylelint, and Biome. Each <tool>Detector follows the shared LintingToolDetector contract; tools that ship multiple config-file shapes also expose a <TOOL>_CONFIG_PATTERNS constant. detectLintingTools runs the full set and returns the aggregate LintingToolDetection[].

API Reference

ƒ Functions

§function

biomeDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection

Detect Biome in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

LintingToolDetection
Detection result or null if not detected

Example

Detecting Biome linter

const result = biomeDetector('/path/to/project', {
  devDependencies: { '@biomejs/biome': '^1.5.0' },
})
// => { id: 'biome', name: 'Biome', confidence: 70, version: '1.5.0', ... }
§function

detectLintingTools(projectPath: string, packageJson?: PackageJson): LintingToolDetection[]

Detect all linting tools in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

LintingToolDetection[]
Array of detected linting tools, sorted by confidence

Example

Detecting multiple linting tools

const results = detectLintingTools('/path/to/project', {
  devDependencies: { eslint: '^8.0.0', prettier: '^3.0.0' },
})
// => [{ id: 'eslint', confidence: 50 }, { id: 'prettier', confidence: 50 }]
§function

eslintDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection

Detect ESLint in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

LintingToolDetection
Detection result or null if not detected

Example

Detecting ESLint linter

const result = eslintDetector('/path/to/project', {
  devDependencies: { eslint: '^8.50.0', '@typescript-eslint/parser': '^6.0.0' },
  scripts: { lint: 'eslint src/' },
})
// => { id: 'eslint', name: 'ESLint', confidence: 65, version: '8.50.0', ... }
§function

prettierDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection

Detect Prettier in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

LintingToolDetection
Detection result or null if not detected

Example

Detecting Prettier formatter

const result = prettierDetector('/path/to/project', {
  devDependencies: { prettier: '^3.0.0' },
  scripts: { format: 'prettier --write .' },
})
// => { id: 'prettier', name: 'Prettier', confidence: 55, version: '3.0.0', ... }
§function

stylelintDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection

Detect Stylelint in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

LintingToolDetection
Detection result or null if not detected

Example

Detecting Stylelint linter

const result = stylelintDetector('/path/to/project', {
  devDependencies: { stylelint: '^15.0.0', 'stylelint-config-standard': '^30.0.0' },
})
// => { id: 'stylelint', name: 'Stylelint', confidence: 65, version: '15.0.0', ... }

Interfaces

§interface

LintingToolDetection

Linting tool detection result.

Properties

§confidence:number
Detection confidence (0-100)
§configPath?:string
Config file path
§detectedFrom:DetectionSource[]
Detection sources
§id:"eslint" | "prettier" | "stylelint" | "biome"
Tool identifier
§name:string
Human-readable name
§version?:string
Detected version
§interface

LintingToolDetector

Linting tool detector interface.

Properties

§id:"eslint" | "prettier" | "stylelint" | "biome"
Tool identifier
§name:string
Human-readable name

Variables

§type

ESLINT_CONFIG_PATTERNS

Config patterns for ESLint
§type

lintingDetectors

All linting tool detectors
§type

PRETTIER_CONFIG_PATTERNS

Config patterns for Prettier
§type

STYLELINT_CONFIG_PATTERNS

Config patterns for Stylelint