MDL-55071 stylelint: Config & grunt task for scss
authorDan Poltawski <dan@moodle.com>
Wed, 21 Sep 2016 13:05:58 +0000 (14:05 +0100)
committerDan Poltawski <dan@moodle.com>
Fri, 23 Sep 2016 09:57:36 +0000 (10:57 +0100)
Part of MDL-55071

.stylelintignore
.stylelintrc
Gruntfile.js

index 155f30b..67fbec7 100644 (file)
@@ -1,5 +1,6 @@
 # Generated by "grunt ignorefiles"
 theme/bootstrapbase/style/
+theme/boost/scss/preset-*
 node_modules/
 vendor/
 auth/cas/CAS/
index acfa316..0b9d85c 100644 (file)
@@ -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",
index a6d59df..928eaf2 100644 (file)
@@ -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'));
     };