Skip to content

Commit 69def5d

Browse files
committed
Extract rule: template-block-indentation
1 parent 3f6a7c8 commit 69def5d

4 files changed

Lines changed: 1092 additions & 7 deletions

File tree

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,14 @@ rules in templates can be disabled with eslint directives with mustache or html
352352

353353
### Stylistic Issues
354354

355-
| Name                     | Description | 💼 | 🔧 | 💡 |
356-
| :----------------------------------------------------------------- | :------------------------------------------------------------- | :- | :- | :- |
357-
| [order-in-components](docs/rules/order-in-components.md) | enforce proper order of properties in components | | 🔧 | |
358-
| [order-in-controllers](docs/rules/order-in-controllers.md) | enforce proper order of properties in controllers | | 🔧 | |
359-
| [order-in-models](docs/rules/order-in-models.md) | enforce proper order of properties in models | | 🔧 | |
360-
| [order-in-routes](docs/rules/order-in-routes.md) | enforce proper order of properties in routes | | 🔧 | |
361-
| [template-attribute-order](docs/rules/template-attribute-order.md) | enforce consistent ordering of attributes in template elements | | | |
355+
| Name                       | Description | 💼 | 🔧 | 💡 |
356+
| :--------------------------------------------------------------------- | :--------------------------------------------------------------------- | :- | :- | :- |
357+
| [order-in-components](docs/rules/order-in-components.md) | enforce proper order of properties in components | | 🔧 | |
358+
| [order-in-controllers](docs/rules/order-in-controllers.md) | enforce proper order of properties in controllers | | 🔧 | |
359+
| [order-in-models](docs/rules/order-in-models.md) | enforce proper order of properties in models | | 🔧 | |
360+
| [order-in-routes](docs/rules/order-in-routes.md) | enforce proper order of properties in routes | | 🔧 | |
361+
| [template-attribute-order](docs/rules/template-attribute-order.md) | enforce consistent ordering of attributes in template elements | | | |
362+
| [template-block-indentation](docs/rules/template-block-indentation.md) | enforce consistent indentation for block statements and their children | | | |
362363

363364
### Testing
364365

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# ember/template-block-indentation
2+
3+
<!-- end auto-generated rule header -->
4+
5+
Migrated from [ember-template-lint/block-indentation](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/block-indentation.md).
6+
7+
## Rule Details
8+
9+
Forces valid indentation for blocks and their children.
10+
11+
1. Forces block begin and block end statements to be at the same indentation level, when not on one line.
12+
2. Forces children of all blocks to start at a single indentation level deeper.
13+
14+
## Configuration
15+
16+
<!-- begin auto-generated rule options list -->
17+
18+
| Name | Type |
19+
| :--------------- | :------ |
20+
| `ignoreComments` | Boolean |
21+
| `indentation` | Integer |
22+
23+
<!-- end auto-generated rule options list -->
24+
25+
## Examples
26+
27+
Examples of **incorrect** code for this rule:
28+
29+
```hbs
30+
{{#each foo as |bar|}}{{/each}}
31+
```
32+
33+
```hbs
34+
<div>
35+
<p>{{t 'greeting'}}</p>
36+
</div>
37+
```
38+
39+
```hbs
40+
<div>
41+
<p>{{t 'Stuff here!'}}</p></div>
42+
```
43+
44+
Examples of **correct** code for this rule:
45+
46+
```hbs
47+
{{#each foo as |bar|}}
48+
{{bar.name}}
49+
{{/each}}
50+
```
51+
52+
```hbs
53+
<div>
54+
<p>{{t 'greeting'}}</p>
55+
</div>
56+
```
57+
58+
## Options
59+
60+
- Integer (e.g., `2`, `4`): Number of spaces for indentation.
61+
- `"tab"`: Use tab-style indentation (1 character).
62+
- Object:
63+
- `indentation` (integer, default `2`): Number of spaces to indent.
64+
- `ignoreComments` (boolean, default `false`): Skip indentation checking for comments.
65+
66+
When no option is specified, the rule reads `indent_size` from .editorconfig (if present).
67+
If no .editorconfig is found, the default is `2` spaces.

0 commit comments

Comments
 (0)