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

Rule is empty when defining root-only CSS variables #538

Open
eliperelman opened this issue Sep 4, 2014 · 14 comments
Open

Rule is empty when defining root-only CSS variables #538

eliperelman opened this issue Sep 4, 2014 · 14 comments

Comments

@eliperelman
Copy link

When using csslint with variables against the :root element, it throws the message of "rule is empty".

:root {
  --color-alpha: #fff;
}

This rule should not be considered empty against the :root element that only contains CSS variables as it is considered the de-facto way to create them globally.

@mikehenrty
Copy link

+1

@ismay
Copy link

ismay commented Sep 12, 2014

I agree. This style of variable definition is used in http://github.com/suitcss/suit, which is based on a future css spec. Maybe allow for the user to turn this off?

@Mottie
Copy link

Mottie commented Sep 18, 2016

+1 (two years later), also:

  • If you add more than one variable, a Expected RBRACE error pops up.
  • Using a variable in the css then shows these warnings:
    • Set color: Expected (<color> | inherit) but found 'var(--color-alpha)'.
    • Set border-color: Expected (<color>{1,4}) but found 'var(--color-alpha)'.

@gabriellecrawford
Copy link

caused by CSSLint/parser-lib#120?

@Mottie
Copy link

Mottie commented Dec 24, 2017

@tophf Has fixed this problem, and many others, in our heavily modified version of csslint in case anyone is interested.

@dcloutman
Copy link

Still broken.

@seanw
Copy link

seanw commented Feb 27, 2018

@Mottie @tophf Thanks for suggesting a workaround and your work on this. Can you confirm the license of your modified version? https://github.com/openstyles/stylus/tree/master/vendor-overwrites/csslint

@tophf
Copy link

tophf commented Feb 27, 2018

We didn't change the license:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

@seanw
Copy link

seanw commented Feb 27, 2018

@tophf Thanks, the repo is marked as GPL so I wanted to be 100% sure here that you're allowing others to use the modifications under the original non-GPL license.

@Arcanemagus
Copy link
Contributor

You could also just use a modern (and maintained) style code linter like stylelint 😉.

@Mottie
Copy link

Mottie commented Feb 27, 2018

Stylelint doesn't validate the css (ref). The authors are deferring the validation to csstree.

That and csslint is less than 100KB in size while Stylelint (without csstree) is over 3MB in size and does not work with browserify nor rollup – which is why we ended up creating the stylelint-bundle repository which removes some of the functionality to get stylelint to bundle and work properly.

@seanw
Copy link

seanw commented Feb 27, 2018

From a security perspective, one pro of csslint is that it doesn't use eval anywhere which isn't the case for csstree last time I checked.

@rtm
Copy link

rtm commented Sep 23, 2018

@seanw From a functionality perspective, one con of csslint is that it doesn't work on modern CSS including custom properties.

@Ademord
Copy link

Ademord commented Mar 4, 2020

What is the solution of this?

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

No branches or pull requests