Shopify / erb_lint

Lint your ERB or HTML files
MIT License
677 stars 122 forks source link

SpaceInHtmlTag customisation #125

Open TomasBarry opened 5 years ago

TomasBarry commented 5 years ago

When the SpaceInHtmlTag rule is enabled, the following code is flagged:

<img
  alt='...'
  className='...'
/>

I realise that I could just disable this rule but then the following code is accepted:

<img     alt='...'              className='...' />

Which is undesirable.

Is it possible to customise the SpaceInHtmlTag rule such that scenario 1 is accepted but scenario 2 is not? Or do we have to make a choice on what we want to accept?

glenpike commented 5 years ago

I would also like to customise the exclusions from this as an empty alt tag: alt="" is recommended for accessibility compliance with some image types - https://www.w3.org/WAI/tutorials/images/decorative/

5mutawa commented 2 years ago

The issue is the space after the last attribute.

The following gets flagged:

<span
  class="..."
  id="..."
>
  Text ...
</span>

But this passes

<span
  class="..."
  id="...">
  Text ...
</span>
coder2000 commented 1 year ago

I would like to see additional characters supported. Some js libraries like alpine use special characters like @ and it causes issues.

CodeF53 commented 9 months ago

I also had to disable this rule due to use of Alpine's @ event syntax.