question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule proposal: spaces around equal signs in HTML attributes

See original GitHub issue

Please 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
michalsnikcommented, Aug 3, 2018

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 event with 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:

<div id= "something"></div>
<div id = "something"></div>
2reactions
michalsnikcommented, Aug 3, 2018

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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found