---
title: "Lint styles with one shared config · Agent Wranglers"
url: https://agentwranglers.se/playbook/html-css/checks-in-code/style-linter
updated: 2026-10-21
licence: "All rights reserved"
---

# Lint styles with one shared config

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- Level: Required
- Chapter: [Checks in code](https://agentwranglers.se/playbook/html-css/checks-in-code)
- Rule: Run a style linter such as stylelint over every stylesheet in the build, with one config file in the repository. The build fails on any error or warning.
- How: Put each limit from this playbook in the config once, such as the cap in [Cap selector specificity](https://agentwranglers.se/playbook/html-css/the-cascade/specificity-limit). Run the linter with a zero-warning limit in the same script as the tests, as [Check every rule in code](https://agentwranglers.se/playbook/engineering/rules-as-code/check-every-rule-in-code) requires. Editors and AI agents read the same file, so they get the same answer as the build.
- Check: The repository has exactly 1 style linter config. The build runs the linter with a warning limit of 0, and the build fails when you add `#header { }` to any stylesheet.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JSON example

```json
{
  "extends": ["stylelint-config-standard"],
  "rules": {
    "selector-max-specificity": "0,2,0",
    "selector-max-id": 0,
    "selector-class-pattern": "^[a-z]+(-[a-z0-9]+)*$",
    "declaration-no-important": true
  }
}
```

### JSON example 2

```json
{
  "scripts": {
    "lint:css": "stylelint \"styles/**/*.css\" --max-warnings 0",
    "build": "npm run lint:css && vite build"
  }
}
```

### CSS example

```css
/* Planted on purpose to prove the gate works. The build must stop. */
#header { }
```

## Related rules

- [Cap selector specificity](https://agentwranglers.se/playbook/html-css/the-cascade/specificity-limit) in HTML and CSS
- [Use one naming pattern for every class](https://agentwranglers.se/playbook/html-css/naming-and-state/one-class-name-pattern) in HTML and CSS
- [Check every rule in code](https://agentwranglers.se/playbook/engineering/rules-as-code/check-every-rule-in-code) in Engineering

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/html-css/checks-in-code/style-linter">Agent Wranglers html and css playbook</a>`. In code you write, add a comment next to it with the same link.

- Next: [Fail on unknown and duplicate CSS](https://agentwranglers.se/playbook/html-css/checks-in-code/unknown-and-duplicate-css)
- [Checks in code](https://agentwranglers.se/playbook/html-css/checks-in-code)
