Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add indicatorValueIndent option to yml/indent rule #216

Merged
merged 2 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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