postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
597 stars 77 forks source link

Question: What is the recommended linter? #153

Closed MKruschke closed 5 years ago

MKruschke commented 5 years ago

Hi, in the last major version (8.0.0) the noValueNotifications option where removed.

Changelog:

Removed: warnings and noValueNotifications options, as this should be the job of a linter tool.

We inject custom props through the importFrom option via webpack postcss-loader, but now we haven't any feedback when a property is missing. Which linter can make sure that all used props are available (especially when they are injected)?

Best Mirko

cheshrkat commented 5 years ago

Given the author of https://github.com/csstools/stylelint-value-no-unknown-custom-properties I am going to guess stylelint is the recommended option? ;)

FWIW - philosophically I see this more as a compiler error than a linter problem. That is, I really wanted to set this plugin to error out the same way SCSS errors on undefined variables, because it's so fundamental to what the plugin does.

jonathantneal commented 5 years ago

@MKruschke, yes, I recommend using csstools/stylelint-value-no-unknown-custom-properties.

@cheshrkat, I do not think they should error in the plugin, as you may intentionally have Custom Properties managed by another file or JavaScript. Off hand, I can think of an example where developers assign window.innerWidth and window.innerHeight to Custom Properties because they are more reliable than viewport units.

cheshrkat commented 5 years ago

shrug that's why these things should be options :) But thanks for giving your thoughts on it, it's great to understand where you're going with things (and thanks for the plugins! they've directly enabled us to go all-in on CSS vars :)).

danny-andrews-snap commented 5 years ago

Properties managed by another file or JavaScript

If you are able to manage custom properties via JavaScript, then you are developing for browsers which support the custom property spec, therefore you have no reason to use this plugin, no?

danny-andrews-snap commented 5 years ago

@jonathantneal Hey now, I made this comment first and then decided it would be better as its own issue. Not the other way around.

jonathantneal commented 5 years ago

Thank you for letting me know, and thank you for taking the time to explain. I misunderstood the timing between GitHub and Email. That’s on me. I am going to lock this conversation, but just to keep things focused. As a person, I’ll also try to be less anxious.