indent

This rule enforces consistent indentation.

How to use

.eslintrc.js
module.exports = {
  rules: {
    "@html-eslint/indent": "error",
  },
};

Rule Details

Options

//...
"@html-eslint/indent": ["error", "tab" | number]

This rule has two options.

  1. number(0, 1, ..) (default 4): requires the use of indentation with specified number of spaces.

  2. "tab": requires the use of indentation with tab (\t).

Examples of incorrect code for this rule:

<html>
  <body></body>
</html>

Examples of correct code for this rule:

<html>
  <body></body>
</html>

number (default: 4)

If the option is number it means the number of spaces for indentation.

{
  "@html-eslint/indent": ["error", 2]
}

Examples of incorrect code for this rule with the "2" option:

<html>
      <body></body>
</html>

Examples of correct code for this rule with the "2" option:

<html>
  <body></body>
</html>

tab

If the option is "tab" it means using tab for indentation.

{
  "@html-eslint/indent": ["error", "tab"]
}

Examples of incorrect code for this rule:

<html>
          <body></body>
</html>

Examples of correct code for this rule:

<html>
  <body></body>
</html>