-
Notifications
You must be signed in to change notification settings - Fork 913
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
Add Stylelint to gulp and CI #4567
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"rules": { | ||
"color-no-invalid-hex": true, | ||
"font-family-no-duplicate-names": true, | ||
"font-family-name-quotes": ["always-where-recommended", { "severity": "warning" }], | ||
"function-name-case": "lower", | ||
"function-url-no-scheme-relative": true, | ||
"function-url-quotes": ["always", { "severity": "warning" }], | ||
"number-no-trailing-zeros": [true, { "severity": "warning" }], | ||
"length-zero-no-unit": [true, { "severity": "warning" }], | ||
"unit-case": "lower", | ||
"unit-no-unknown": true, | ||
"property-case": "lower", | ||
"property-no-unknown": true, | ||
"keyframe-declaration-no-important": true, | ||
"declaration-no-important": true, | ||
"declaration-block-no-ignored-properties": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering how this will play with workarounds for quirks in IE 9. Might illuminate some phony voodoo though. 😁 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, will delve into the errors it's throwing currently - might need to drop this to a warning perhaps, and add exceptions for where it's required. |
||
"declaration-block-no-shorthand-property-overrides": true, | ||
"declaration-block-single-line-max-declarations": [1, { "severity": "warning" }], | ||
"declaration-block-trailing-semicolon": ["always", { "severity": "warning" }], | ||
"block-no-empty": true, | ||
"selector-no-empty": true, | ||
"selector-pseudo-class-no-unknown": true, | ||
"selector-pseudo-element-no-unknown": true, | ||
"selector-pseudo-element-case": "lower", | ||
"selector-type-case": "lower", | ||
"selector-type-no-unknown": true, | ||
"selector-max-empty-lines": 0, | ||
"media-feature-name-case": "lower", | ||
"media-feature-name-no-unknown": [true, { | ||
ignoreMediaFeatureNames: ["min--moz-device-pixel-ratio"] | ||
}], | ||
"media-feature-no-missing-punctuation": true, | ||
"stylelint-disable-reason": "always-before", | ||
"comment-no-empty": true, | ||
"max-nesting-depth": [5, { "severity": "warning" }], | ||
"no-invalid-double-slash-comments": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the lack of related errors when running locally, this appears to be smart enough to ignore double slash comments in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this only applies to CSS files, where it can cause issues. It ignores both Sass and Less comments, so maybe this is actually redundant here... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we linting post-processed .css files as well, or only the pre-processed source? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, this would probably be a next step after this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm actually going to leave this rule in, as we do have some regular |
||
"no-unknown-animations": true, | ||
"no-extra-semicolons": true, | ||
"no-missing-end-of-source-newline": [true, { "severity": "warning" }], | ||
"no-eol-whitespace": [true, { "severity": "warning" }] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really hope we can do away with
!important
, but I have a hunch we'll need it, at least for a while...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I plan to make exceptions for it in the download button styles, but let it throw an error everywhere else...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might sometimes have to update the exceptions list (there are several
!important
s in the search stuff because Google) but hopefully that won't get out of hand.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exceptions are added directly around the effected areas of CSS, so adding one for the Google search thing is pretty easy. I'd prefer to do this and try and keep the rule a strict "no" by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense. I was envisioning some kind of separate "ignore" list we'd have to maintain, which sounds like a bad idea. But just some special comment at the point of instance is much nicer. So in that case I also vote for keeping this as a full-blown error;
!important
should only be allowed under very special circumstances.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some overrides to usages of
!important
where it's probably need it, so it's easier to see some practical examples.