Skip to content

Commit

Permalink
feat: add indicatorValueIndent option to yml/indent rule (#216)
Browse files Browse the repository at this point in the history
* feat: add `indicatorValueIndent` option to `yml/indent` rule

* Create gorgeous-pumpkins-argue.md
  • Loading branch information
ota-meshi authored Feb 10, 2023
1 parent 0964156 commit 815aa61
Show file tree
Hide file tree
Showing 361 changed files with 4,256 additions and 80 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-pumpkins-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-yml": minor
---

feat: add `indicatorValueIndent` option to `yml/indent` rule
34 changes: 34 additions & 0 deletions docs/rules/indent.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ yml/indent:
- error
- 2
- indentBlockSequences: true
indicatorValueIndent: 2
```
- Number option ... Specify the number of indents.
- Object option
- `indentBlockSequences` ... Specifies whether block sequences should be indented or not (when in a mapping).
- `indicatorValueIndent` ... Specifies the number of indents from indicator marks. Defaults to specified indent.

### `"indentBlockSequences": true` (default)

Expand Down Expand Up @@ -104,6 +106,38 @@ key2:

</eslint-code-block>

### `[4, "indicatorValueIndent": 2]`

<eslint-code-block fix>

<!-- eslint-skip -->

```yaml
# eslint yml/indent: [error, 4, { indicatorValueIndent: 2 }]
# ✓ GOOD
good:
key:
- id: 1
name: Foo
- id: 2
name: Bar
- id: 3
name: Baz
# ✗ BAD
bad:
key:
- id: 1
name: Foo
- id: 2
name: Bar
- id: 3
name: Baz
```

</eslint-code-block>

## :couple: Related rules

- [indent]
Expand Down
Loading

0 comments on commit 815aa61

Please sign in to comment.