HTML ESLint

HTML ESLint

  • Docs
  • GitHub
  • PlayGround

›Style

Getting Started

  • Getting Started

Disabling with inline comments

  • Disable rules with inline comments

CLI (Check HTML file on URL)

  • CLI (Run on URLs)

Rules

  • All Rules
  • SEO

    • @html-eslint/require-lang
    • @html-eslint/require-title
    • @html-eslint/no-multiple-h1
    • @html-eslint/require-meta-description

    Style

    • @html-eslint/no-extra-spacing-attrs
    • @html-eslint/element-newline
    • @html-eslint/indent
    • @html-eslint/quotes
    • @html-eslint/id-naming-convention
    • @html-eslint/no-multiple-empty-lines

    Best Practice

    • @html-eslint/require-doctype
    • @html-eslint/no-duplicate-id
    • @html-eslint/no-inline-styles
    • @html-eslint/require-li-container
    • @html-eslint/no-obsolete-tags
    • @html-eslint/require-closing-tags
    • @html-eslint/require-meta-charset
    • @html-eslint/no-target-blank
    • @html-eslint/no-duplicate-attrs
    • @html-eslint/require-button-type
    • @html-eslint/no-restricted-attrs

    Accessibility

    • @html-eslint/require-img-alt
    • @html-eslint/no-skip-heading-levels
    • @html-eslint/require-frame-title
    • @html-eslint/no-non-scalable-viewport
    • @html-eslint/no-positive-tabindex
    • @html-eslint/require-meta-viewport
    • @html-eslint/no-abstract-roles
    • @html-eslint/no-aria-hidden-body
    • @html-eslint/no-accesskey-attrs

@html-eslint/indent

Enforce consistent indentation

Rule Details

This rule enforces consistent indentation styles. The default indent is 4spaces.

Options

This rule has two options

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

  • "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>

Options

space

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

{
  "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.

{
  "indent": ["error", "tab"]
}

Examples of incorrect code for this rule:

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

Examples of correct code for this rule:

<html>
  <body>
    <!-- tab -->
  </body>
  <!-- tab -->
</html>
← @html-eslint/element-newline@html-eslint/quotes →
  • Enforce consistent indentation
    • Rule Details
  • Options
    • Options
Docs
Getting StartedAll Rules
More
GitHubStar
Built with Docusaurus