Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,14 @@ rules in templates can be disabled with eslint directives with mustache or html

### Stylistic Issues

| Name                     | Description | 💼 | 🔧 | 💡 |
| :----------------------------------------------------------------- | :------------------------------------------------------------- | :- | :- | :- |
| [order-in-components](docs/rules/order-in-components.md) | enforce proper order of properties in components | | 🔧 | |
| [order-in-controllers](docs/rules/order-in-controllers.md) | enforce proper order of properties in controllers | | 🔧 | |
| [order-in-models](docs/rules/order-in-models.md) | enforce proper order of properties in models | | 🔧 | |
| [order-in-routes](docs/rules/order-in-routes.md) | enforce proper order of properties in routes | | 🔧 | |
| [template-attribute-order](docs/rules/template-attribute-order.md) | enforce consistent ordering of attributes in template elements | | | |
| Name                           | Description | 💼 | 🔧 | 💡 |
| :----------------------------------------------------------------------------- | :----------------------------------------------------------------------------- | :- | :- | :- |
| [order-in-components](docs/rules/order-in-components.md) | enforce proper order of properties in components | | 🔧 | |
| [order-in-controllers](docs/rules/order-in-controllers.md) | enforce proper order of properties in controllers | | 🔧 | |
| [order-in-models](docs/rules/order-in-models.md) | enforce proper order of properties in models | | 🔧 | |
| [order-in-routes](docs/rules/order-in-routes.md) | enforce proper order of properties in routes | | 🔧 | |
| [template-attribute-indentation](docs/rules/template-attribute-indentation.md) | enforce proper indentation of attributes and arguments in multi-line templates | | | |
| [template-attribute-order](docs/rules/template-attribute-order.md) | enforce consistent ordering of attributes in template elements | | | |

### Testing

Expand Down
91 changes: 91 additions & 0 deletions docs/rules/template-attribute-indentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# ember/template-attribute-indentation

<!-- end auto-generated rule header -->

Migrated from [ember-template-lint/attribute-indentation](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/attribute-indentation.md).

## Rule Details

This rule requires the positional params, attributes, and block params of helpers/components to be indented by moving them to multiple lines when the open invocation has more than 80 characters (configurable).

## Configuration

<!-- begin auto-generated rule options list -->

| Name | Type | Choices |
| :------------------------ | :------ | :--------------------------- |
| `as-indentation` | | `attribute`, `closing-brace` |
| `element-open-end` | | `new-line`, `last-attribute` |
| `indentation` | Integer | |
| `mustache-open-end` | | `new-line`, `last-attribute` |
| `open-invocation-max-len` | Integer | |
| `process-elements` | Boolean | |

<!-- end auto-generated rule options list -->

## Examples

Examples of **incorrect** code for this rule:

Non-block form (> 80 characters):

```hbs
{{employee-details firstName=firstName lastName=lastName age=age avatarUrl=avatarUrl}}
```

Block form (> 80 characters):

```hbs
{{#employee-details
firstName=firstName lastName=lastName age=age avatarUrl=avatarUrl
as |employee|
}}
{{employee.fullName}}
{{/employee-details}}
```

HTML element (> 80 characters):

```hbs
<input disabled id='firstName' value={{firstName}} class='input-field first-name' type='text' />
```

Examples of **correct** code for this rule:

Non-block form:

```hbs
{{employee-details firstName=firstName lastName=lastName age=age avatarUrl=avatarUrl}}
```

Block form:

```hbs
{{#employee-details
firstName=firstName lastName=lastName age=age avatarUrl=avatarUrl
as |employee|
}}
{{employee.fullName}}
{{/employee-details}}
```

HTML element:

```hbs
<input disabled id='firstName' value={{firstName}} class='input-field first-name' type='text' />
```

Short invocations (< 80 characters) are allowed on a single line:

```hbs
{{employee-details firstName=firstName lastName=lastName}}
```

## Options

- `open-invocation-max-len` (integer, default `80`): Maximum length of the opening invocation before attributes must be on separate lines.
- `indentation` (integer, default `2`): Number of spaces for attribute indentation.
- `process-elements` (boolean, default `true`): Also validate indentation of HTML/SVG element attributes.
- `element-open-end` (`"new-line"` | `"last-attribute"`, default `"new-line"`): Position of the closing `>` bracket.
- `mustache-open-end` (`"new-line"` | `"last-attribute"`, default `"new-line"`): Position of the closing `}}` braces.
- `as-indentation` (`"attribute"` | `"closing-brace"`, default `"closing-brace"`): Position of `as |param|` block params relative to attributes or closing brace.
Loading
Loading