stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Fix `no-irregular-whitespace` false positives for strings

Open yukulele opened this issue 11 months ago • 1 comments

What is the problem you're trying to solve?

I get a [no-irregular-whitespace] error with this code:

example:

.foo:after {
  content: ' '; // a non-breaking space.
}

What solution would you like to see?

irregular whitespace should be allowed in string

Workaround

As workaround we can use unicode escape: content: '\a0'

yukulele avatar Apr 29 '25 21:04 yukulele

@yukulele Thank you for the report. I can reproduce the issue on the online demo.

I've labelled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

It'll likely involve ignoring strings in at-rules params, rule selectors and declaration values. It may involve reaching for the value parser, if regex doesn't provide enough robustness.

jeddy3 avatar Apr 30 '25 08:04 jeddy3