Skip to content

Commit

Permalink
MDL-55071 stylelint: Config & grunt task for scss
Browse files Browse the repository at this point in the history
Part of MDL-55071
  • Loading branch information
danpoltawski committed Sep 23, 2016
1 parent 8a40bc3 commit 773e68b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by "grunt ignorefiles"
theme/bootstrapbase/style/
theme/boost/scss/preset-*
node_modules/
vendor/
auth/cas/CAS/
Expand Down
8 changes: 4 additions & 4 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"rules": {
"at-rule-empty-line-before": [ "always",
{"except": [ "blockless-group", "all-nested" ], ignore: ["after-comment"]}
{"except": [ "blockless-group"], ignore: ["after-comment", "all-nested"]}
],
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-no-unknown": [true, ignoreAtRules: ["extend", "include"]],
"at-rule-no-unknown": null, # Enabled for non-scss in grunt.
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always-multi-line",
Expand Down Expand Up @@ -57,7 +57,7 @@
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-browser-hacks": [true, { "severity": "warning" }],
"no-browser-hacks": null, # Enabled for non-scss in grunt.
"no-empty-source": true,
"no-eol-whitespace": true,
"no-extra-semicolons": [true, { "severity": "warning" }],
Expand Down Expand Up @@ -87,7 +87,7 @@
"unit-blacklist": ["pt", "rem"],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": ["lower", {"ignoreKeywords": ["/@/"]}],
"value-keyword-case": ["lower", {"ignoreKeywords": ["/(@|$)/"]}],
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
Expand Down
28 changes: 26 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,31 @@ module.exports = function(grunt) {
"selector-type-no-unknown": null,
"length-zero-no-unit": null,
"color-hex-case": null,
"color-hex-length": null
"color-hex-length": null,
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
"no-browser-hacks": [true, {"severity": "warning"}]
}
}
},
src: ['theme/**/*.less']
},
scss: {
options: {
syntax: 'scss',
configOverrides: {
rules: {
"unit-blacklist": null, // TODO: alter based on outcome of MDL-56061.
"declaration-no-important": null, // TODO: to be addressed by MDL-56063.
// TODO: MDL-55165 - Enable the following rules once we make output-changing changes to scss.
"declaration-block-no-duplicate-properties": null,
"declaration-block-no-ignored-properties": null,
"declaration-block-no-shorthand-property-overrides": null,
"property-no-unknown": null,
}
},
},
src: ['*/**/*.scss']
}
}
});
Expand All @@ -211,7 +231,11 @@ module.exports = function(grunt) {
var eslintIgnores = ['# Generated by "grunt ignorefiles"', '*/**/yui/src/*/meta/', '*/**/build/'].concat(thirdPartyPaths);
grunt.file.write('.eslintignore', eslintIgnores.join('\n'));
// Generate .stylelintignore.
var stylelintIgnores = ['# Generated by "grunt ignorefiles"', 'theme/bootstrapbase/style/'].concat(thirdPartyPaths);
var stylelintIgnores = [
'# Generated by "grunt ignorefiles"',
'theme/bootstrapbase/style/',
'theme/boost/scss/preset-*'
].concat(thirdPartyPaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n'));
};

Expand Down

0 comments on commit 773e68b

Please sign in to comment.