Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.46 KB

block-indentation.md

File metadata and controls

60 lines (41 loc) · 1.46 KB

block-indentation

💅 The extends: 'stylistic' property in a configuration file enables this rule.

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Good indentation is crucial for long-term maintenance of templates. For example, having blocks misaligned is a common cause of logic errors.

Examples

This rule forbids the following:

{{#each foo as |bar|}}

  {{/each}}
<div>
<p>{{t "greeting"}}</p>
</div>
<div>
  <p>{{t 'Stuff here!'}}</p></div>

This rule allows the following:

{{#my-component}}
  <div>
    <p>{{t "greeting"}}</p>
  </div>
{{/my-component}}

Configuration

The following values are valid configuration:

  • boolean -- true indicates a 2 space indent, false indicates that the rule is disabled.
  • numeric -- the number of spaces to require for indentation
  • "tab" -- To indicate tab style indentation (1 char)
  • object -- An object with the following keys:
    • indentation: <numeric> - number of spaces to indent (defaults to 2)
    • ignoreComments: <boolean> - skip indentation for comments (defaults to false)

If .editorconfig file present, rule configuration will be inherit from it.

Related Rules

References