Rule proposal: spaces around equal signs in HTML attributes
See original GitHub issuePlease describe what the rule should do:
Ensure there are no spaces around equal signs in HTML attribute definitions.
What category of rule is this? (place an “X” next to just one item)
[X] Enforces code style [ ] Warns about a potential error [ ] Suggests an alternate way of doing something [ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
<link rel = "stylesheet" href = "styles.css">
<link rel= "stylesheet" href ="styles.css">
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Using spaces before and after the `=` sign of HTML element ...
Technically, you can use zero or more spaces on either side of your equal sign whether you use unquoted, single-quoted, or double-quoted ...
Read more >vue/no-spaces-around-equal-signs-in-attribute
This rule disallow spaces around equal signs in attribute. ... HTML5 allows spaces around equal signs. But space-less is easier to read, and ......
Read more >How whitespace is handled by HTML, CSS, and in the DOM
Whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, CRLF sequences, carriage returns or line...
Read more >[attribute] | CSS-Tricks
Value starts with: attribute value starts with the selected term. To use this selector, add a caret (^) before the equals sign.
Read more >When are spaces around the = sign forbidden?
If I want my config file to use colons or pipes instead of equal signs, then I will write my program to use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m not convinced with those arguments @mysticatea @chrisvfritz Why would we allow customizing it in a way that no one is probably using? I never saw anyone preferring to write HTML in this kind of way.
We can’t compare everything to JavaScript, it’s HTML after all.
So if someone wants to not have spaces around equal signs - he could turn this rule on. Otherwise he could not use it and align attributes vertically instead - no problem (Although aligning attributes itself is also not very good idea, if you think about case with an
eventwith two modifiers it would look super weird, but having this rule disabled you could still do that anyway)I try to be not too opinionated, but I just don’t see any real value in allowing this syntax:
I don’t see why people might want to use spaces here. And I personally think this rule should either forbid it totally or not so I think the current implementation is perfectly fine with no extra configuration 😃