---
title: "Keep every exception in the linter config · Agent Wranglers"
url: https://agentwranglers.se/playbook/html-css/checks-in-code/one-exceptions-list
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Keep every exception in the linter config

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

For AI agents: [llms.txt](https://agentwranglers.se/llms.txt) is a short guide that sends you to the rules your problem needs, and [rules.json](https://agentwranglers.se/playbook/html-css/rules.json) holds every rule of this playbook as JSON.

- Level: Recommended
- Chapter: [Checks in code](https://agentwranglers.se/playbook/html-css/checks-in-code)
- Rule: Write every exception to a lint rule in the config file, with a reason and a file path. Source files contain 0 comments that turn a linter off.
- How: Inline disable comments spread, and nobody can list them. An override in the config is one place to read, review and remove. Make the linter report disable comments that are not needed or have no reason, so the count can only go down. Each exception still follows [Check every rule in code](https://agentwranglers.se/playbook/engineering/rules-as-code/check-every-rule-in-code).
- Check: A search of the stylesheets and templates finds 0 `stylelint-disable` or `html-validate-disable` comments. Every override in the config names a file path and has a comment with its reason on the line above.

## 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.

### JavaScript example

```js
// stylelint.config.mjs: the one place for exceptions, each with its reason
export default {
  reportNeedlessDisables: true,
  reportDescriptionlessDisables: true,
  overrides: [
    {
      // Must win over every component, so it is the one allowed !important
      files: ['styles/utilities/visually-hidden.css'],
      rules: { 'declaration-no-important': null },
    },
  ],
};
```

### Python example

```python
# Build check: no linter is switched off inside a source file
import pathlib, re, sys
DISABLE = re.compile(r"(stylelint|html-validate)-disable")
hits = [str(p) for p in pathlib.Path("src").rglob("*") if p.suffix in {".css", ".html"} and DISABLE.search(p.read_text())]
print("\n".join(f"FAIL {hit} turns a linter off" for hit in hits))
sys.exit(1 if hits else 0)
```

### CSS example

```css
/* Fails the check: an exception hidden in a source file */
/* stylelint-disable-next-line selector-max-id */
#promo { }
```

## Related rules

- [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/one-exceptions-list">Agent Wranglers HTML and CSS playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Check the built CSS as well as the source](https://agentwranglers.se/playbook/html-css/checks-in-code/check-built-css)
- Next: [Lint every feature against one Baseline target](https://agentwranglers.se/playbook/html-css/checks-in-code/baseline-target)
- [Checks in code](https://agentwranglers.se/playbook/html-css/checks-in-code)
