Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 1.65 KB

File metadata and controls

69 lines (48 loc) · 1.65 KB

ember/template-block-indentation

🔧 This rule is automatically fixable by the --fix CLI option.

Migrated from ember-template-lint/block-indentation.

Rule Details

Forces valid indentation for blocks and their children.

  1. Forces block begin and block end statements to be at the same indentation level, when not on one line.
  2. Forces children of all blocks to start at a single indentation level deeper.

Configuration

Name Type
ignoreComments Boolean
indentation Integer

Examples

Examples of incorrect code for this rule:

{{#each foo as |bar|}}{{/each}}
<div>
  <p>{{t 'greeting'}}</p>
</div>
<div>
  <p>{{t 'Stuff here!'}}</p></div>

Examples of correct code for this rule:

{{#each foo as |bar|}}
  {{bar.name}}
{{/each}}
<div>
  <p>{{t 'greeting'}}</p>
</div>

Options

  • Integer (e.g., 2, 4): Number of spaces for indentation.
  • "tab": Use tab-style indentation (1 character).
  • Object:
    • indentation (integer, default 2): Number of spaces to indent.
    • ignoreComments (boolean, default false): Skip indentation checking for comments.

When no option is specified, the rule reads indent_size from .editorconfig (if present). If no .editorconfig is found, the default is 2 spaces.