htmlhint / htmlhint/HTMLHint

Rule to check indent level of tags

Open
#1,789 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.3k
Forks
474
Avg merge
1d 11h
Merged PRs (30d)
12

Description

Is your feature request related to a problem? Please describe.
It would be great to have a feature that allows for checking the indent level of tags to ensure that their nesting is properly shown with the correct indentation (i.e. number of spaces or tabs), configurable to a certain number of spaces or a tab as the indent.

Describe the solution you'd like
For example, incorrect code with this rule may look like:

<ul>
<li> <!-- Not indented from parent -->
    <p>Hello world</p>
</li> <!-- Not indented from parent -->
</ul>

or, in the case of a set number of spaces (e.g. 4):

<ul>
    <li>
         <p>Hello world</p> <!-- Error: 9 spaces, expected 8 -->
   </li> <!-- Error: 3 spaces, expected 4 -->
</ul>

Describe alternatives you've considered
Issues #73 and #153 were closed due to inactivity, but this feature is still relevant and would be incredibly useful to ensure that proper tag nesting is reflected through consistent indentation.

Additional context
N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing HTMLHint's existing rule implementations and their tests to understand how configurable checks are structured. Define the expected indentation behavior for nested tags, spaces, and tabs using the examples in this issue, then add coverage showing that incorrect indentation is reported and valid indentation is accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.