1---2name: stylelint3description: Use Stylelint in .NET repositories that ship CSS, SCSS, or other stylesheet assets alongside web frontends. USE FOR: stylelint.config.*, .stylelintrc*, CSS or SCSS assets; CSS linting; duplicate style cleanup and naming-convention checks. DO NOT USE FOR: JavaScript or TypeScript lint ownership; runtime accessibility, performance, SEO, or header checks. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.4---56# Stylelint for Stylesheets in .NET Repositories78## Trigger On910- the repo has `stylelint.config.*`, `.stylelintrc*`, or CSS and SCSS assets under frontend folders11- the user asks for CSS linting, duplicate style cleanup, naming convention enforcement, or design-system guardrails12- the repo needs a stylesheet gate beyond formatting alone1314## Do Not Use For1516- JavaScript or TypeScript ownership; route that to `eslint` or `biome`17- runtime accessibility, performance, SEO, or header checks; route that to `webhint`18- repos that intentionally use only Biome for CSS linting and do not want a separate stylesheet linter1920## Inputs2122- the nearest `AGENTS.md`23- `package.json`24- `stylelint.config.*` or `.stylelintrc*`25- the stylesheet file types in scope: CSS, SCSS, Less, embedded styles, or generated output2627## Workflow28291. Confirm what Stylelint should own:30 - plain CSS only31 - CSS plus SCSS32 - embedded styles in HTML, Markdown, or framework files332. Prefer repo-local installation and checked-in config.343. Start from a known shared config such as `stylelint-config-standard`, then add syntax-specific packages only when the repo truly needs them.354. Add repeatable scripts to `package.json`, for example:36 - `stylelint "**/*.{css,scss}"`37 - `stylelint "**/*.{css,scss}" --fix`385. Keep ignore patterns explicit so build output, vendored assets, and generated CSS do not pollute the signal.396. Treat autofix as controlled cleanup:40 - run on a bounded scope first41 - inspect the diff42 - rerun the frontend build if the repo compiles styles437. Use Stylelint for semantic CSS and selector policy, not as a replacement for site-level audits.4445## Bootstrap When Missing46471. Detect current state:48 - `rg --files -g 'package.json' -g 'stylelint.config.*' -g '.stylelintrc*'`49 - `rg -n '"stylelint"|"stylelint-config-" --glob 'package.json' .`502. Prefer a repo-local install:51 - `npm install --save-dev stylelint stylelint-config-standard`523. Add syntax packages only when the repo needs them for SCSS or embedded styles.534. Create or refine `stylelint.config.js`, `stylelint.config.mjs`, or the existing config format.545. Add repeatable commands to `AGENTS.md` and `package.json`, then verify with:55 - `npx stylelint "**/*.{css,scss}"`56 - `npx stylelint "**/*.{css,scss}" --fix`576. Return `status: configured` if Stylelint is now wired and repeatable, or `status: improved` if the existing baseline was tightened.587. Return `status: not_applicable` only when another documented tool already owns stylesheet linting and migration is not requested.5960## Handle Failures6162- `Unknown rule` usually means the config expects a plugin or a different Stylelint major version.63- `Unknown word` on SCSS, Vue, or mixed-content files usually means the repo needs the matching custom syntax package instead of plain CSS parsing.64- Massive autofix churn usually means generated assets or third-party CSS slipped into the lint target.65- Design-system rule noise should be handled by tuning the checked-in config, not by skipping the linter entirely.6667## Current 17.14 Guidance6869- Stylelint `17.14.1` fixes `quiet` suppressing `report*` warnings, unknown-rule diagnostic ranges, invalid `background` shorthand autofixes when `background-size` is present, and `rule-empty-line-before` false positives around shared-line comments. Re-run lint with and without `--quiet`, and inspect any background autofix diff before accepting it.70- Stylelint `17.8.0` also added `languageOptions.directionality`, `property-layout-mappings`, `relative-selector-nesting-notation`, and `selector-no-deprecated`. Re-run the repo baseline after upgrading so any new selector or layout findings are reviewed instead of preserved by default.71- Use `languageOptions.directionality` explicitly when the repo styles bidirectional UI or logical properties. That keeps direction-sensitive rules aligned with the intended writing direction rather than inferred behavior.72- The earlier `*syntax` deprecation under `declaration-property-value-no-unknown` still matters on the 17.x line. If the repo still relies on those options, move the compatibility into `customSyntax` or parser selection instead of extending deprecated rule config.73- Keep repo ignores focused on generated or vendored assets. Re-check any broad ignore globs after upgrading so they are not masking selector or layout regressions that the new rules now catch.7475## Official Sources7677- [Stylelint 17.14.1 release notes](https://github.com/stylelint/stylelint/releases/tag/17.14.1)78- [references/release-notes.md](references/release-notes.md)7980## Deliver8182- explicit stylesheet lint ownership83- checked-in config and repeatable commands84- clear scope boundaries for CSS, SCSS, and generated assets8586## Validate8788- the lint target matches the repo's real stylesheet sources89- ignores exclude generated or vendored assets90- Stylelint ownership does not conflict with Biome without an explicit plan91- fixes were verified against the repo's stylesheet build flow when one exists9293## Ralph Loop94951. Plan: analyze current state, target outcome, constraints, and risks.962. Execute one step and produce a concrete delta.973. Review the result and capture findings.984. Apply fixes in small batches and rerun checks.995. Update the plan after each iteration.1006. Repeat until outcomes are acceptable.1017. If a dependency is missing, bootstrap it or return `status: not_applicable` with a reason.102103### Required Result Format104105- `status`: `complete` | `clean` | `improved` | `configured` | `not_applicable` | `blocked`106- `plan`: concise plan and current step107- `actions_taken`: concrete changes made108- `verification`: commands, checks, or review evidence109- `remaining`: unresolved items or `none`110111## Example Requests112113- "Add Stylelint for the SCSS in this ASP.NET Core app."114- "Block duplicate selectors and invalid CSS in CI."115- "Fix the current Stylelint violations without touching generated CSS."116117## References118119- [release-notes.md](references/release-notes.md) - Current 17.14.1 and 17.8.0 release changes that matter for repo config, autofix review, rule tuning, and selector/layout validation