@codacy/tools-stylelint-0
Table of Contents
Overview
CSS/SCSS/Less linter using Stylelint. Uses the Library execution strategy — calls the Stylelint API directly rather than spawning a subprocess.
| Property | Value |
|---|---|
| Tool ID | Stylelint |
| Codacy UUID | 1f03328a-086e-459e-bfa3-73e56f01020f |
| Strategy | Library |
| Languages | CSS, LESS, SASS |
| Dependency | stylelint npm package (v17.x) |
| File patterns | **/*.css, **/*.scss, **/*.less |
Updating patterns
# Re-fetch pattern metadata from the Codacy API
pnpm prefetch
# Commit the result
git add src/patterns.json
Pattern IDs follow the format Stylelint_block-no-empty, Stylelint_color-no-invalid-hex, etc.
Updating the Stylelint version
- Update the
stylelintversion indevDependenciesofpackage.json, andpreferredVersioninsrc/metadata.ts - Run
pnpm install - Run
pnpm generate-payloads stylelint-0from the repo root to re-pinpayload/package.jsonand regenerate its lockfile - Run
pnpm prefetchto check for new/removed rules - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
stylelint-1/)
Development
pnpm build # Build with tsup
pnpm test # Run tests
Notes for maintainers
- Stylelint v16+ is pure ESM. The adapter uses dynamic
import()at runtime to stay CJS-compatible with the tsup build. stylelint-config-standardis used as the default config when no local config or Codacy patterns are provided. Without it, Stylelint has zero rules enabled.- Stylelint appends the rule name in parentheses to warning text (e.g.
"Unexpected empty block (block-no-empty)"). The adapter strips this suffix for cleaner messages. checkAvailabilitydynamically imports Stylelint and runs a trivial lint to verify it loads.- The tool is an npm payload, not a dependency: it is resolved at run time (a Codacy-managed install under
~/.codacy/tools/<id>/, aCODACY_TOOL_ROOT_<ID>root, or this package's ownnode_modulesin the monorepo) andinstallrunsnpm ciagainst the committedpayload/package-lock.json. Seesrc/payload.ts.