Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stylelint doesn't catch mistyped background-image value #121

Open
Volker-E opened this issue May 11, 2020 · 6 comments
Open

Stylelint doesn't catch mistyped background-image value #121

Volker-E opened this issue May 11, 2020 · 6 comments

Comments

@Volker-E
Copy link
Contributor

That's probably an upstream issue, but

.link-https {
	background-image: images/external-ltr.svg );

isn't caught locally.

@edg2s
Copy link
Member

edg2s commented May 11, 2020

It looks like stylelint doesn't do much syntax validation beyond that implemented in specific rules. None of this causes parser errors:

.foo {
  background: foo.jpg );
  display: hello?;
  water: wet;
  width: wide;
}

You get property-no-unknown for water, but that's a specific rule, not a parser error.

@edg2s
Copy link
Member

edg2s commented May 11, 2020

Could experiment with something like https://github.com/csstree/stylelint-validator

@edg2s
Copy link
Member

edg2s commented May 2, 2022

Also from #100:

background-image: ( 'images/tab-normal-fade.png' ) doesn't result in an error. Mind the missing url part.

@edg2s
Copy link
Member

edg2s commented May 27, 2022

This regression caused by an invalid value: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/800761

@edg2s
Copy link
Member

edg2s commented May 27, 2022

In the above example, commas were added to an animation property where just spaces should be used:
animation: rotate, 700ms, infinite, linear;

While this is clearly an error, it is not invalid code, it just reads as 4 animations with short definitions:

$0.style.animation='rotate, 700ms, infinite, linear'

console.log( $0.style.animation )
 '0s ease 0s 1 normal none running rotate, 700ms ease 0s 1 normal none running none, 0s ease 0s infinite normal none running none, 0s linear 0s 1 normal none running none'

@edg2s
Copy link
Member

edg2s commented May 27, 2022

https://github.com/csstree/stylelint-validator has some support for LESS values but produces false positives on mixins. We could enable the rule for CSS only, but that would make it considerably less useful in MediaWiki where many (most?) files are LESS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants