From 773e68b0f80a91e83ff4f2fb0f3581a3f262fd93 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Wed, 21 Sep 2016 14:05:58 +0100 Subject: [PATCH] MDL-55071 stylelint: Config & grunt task for scss Part of MDL-55071 --- .stylelintignore | 1 + .stylelintrc | 8 ++++---- Gruntfile.js | 28 ++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.stylelintignore b/.stylelintignore index 155f30b498d..67fbec76757 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -1,5 +1,6 @@ # Generated by "grunt ignorefiles" theme/bootstrapbase/style/ +theme/boost/scss/preset-* node_modules/ vendor/ auth/cas/CAS/ diff --git a/.stylelintrc b/.stylelintrc index acfa316a1d8..0b9d85c310b 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -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", @@ -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" }], @@ -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", diff --git a/Gruntfile.js b/Gruntfile.js index a6d59df1bd4..928eaf28fdc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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'] } } }); @@ -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')); }; -- 2.43.0