# indent

Rule `unicorn/indent`. Enforce consistent indentation in JSON and CSS.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2005 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/indent` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/indent.md) |

## Code examples

### Correct: the rule accepts this

```css
a {
  color: red;
}

b {
color: blue;
}
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/indent": "error",
    },
  },
];
```

## Related rules

- [eslint/indent](https://lintradar.dev/rules/eslint/indent.md): Enforce consistent indentation
- [unicorn/id-match](https://lintradar.dev/rules/unicorn/id-match.md): Require identifiers to match a specified regular expression.
- [unicorn/iteration-fallback-style](https://lintradar.dev/rules/unicorn/iteration-fallback-style.md): Enforce a consistent style for optional loop sources.
- [unicorn/consistent-function-style](https://lintradar.dev/rules/unicorn/consistent-function-style.md): Enforce function syntax by role.
- [unicorn/key-name-casing](https://lintradar.dev/rules/unicorn/key-name-casing.md): Enforce a case style for data keys.
- [unicorn/consistent-destructuring](https://lintradar.dev/rules/unicorn/consistent-destructuring.md): Use destructured variables over properties.

---

Web page: https://lintradar.dev/rules/unicorn/indent. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
