build: Introduce stylelint
authorJames D. Forrester <jforrester@wikimedia.org>
Thu, 19 May 2016 14:41:15 +0000 (15:41 +0100)
committerJames D. Forrester <jforrester@wikimedia.org>
Thu, 19 May 2016 14:41:15 +0000 (15:41 +0100)
Initially, with just a single rule to make this a smaller change that we can
incrementally extend up to the full Wikimedia coding conventions preset; namely,
forcing hex references to colours to be in lower-case.

Note the odd src definition to avoid referring to mediawiki.less the directory in
the glob.

Change-Id: I34f0c8e3c8280e3fce0aa22d7537100b850cbb8d

.stylelintrc [new file with mode: 0644]
Gruntfile.js
mw-config/config-cc.css
package.json
resources/src/jquery/jquery.suggestions.css
resources/src/mediawiki.legacy/oldshared.css
resources/src/mediawiki.legacy/shared.css
resources/src/mediawiki.skinning/interface.css
resources/src/mediawiki.special/mediawiki.special.search.css
resources/src/mediawiki/mediawiki.debug.less
resources/src/mediawiki/mediawiki.notification.css

diff --git a/.stylelintrc b/.stylelintrc
new file mode 100644 (file)
index 0000000..bf74951
--- /dev/null
@@ -0,0 +1,5 @@
+{
+       "rules": {
+               "color-hex-case": [ "lower" ]
+       }
+}
index 354f048..5af2d9c 100644 (file)
@@ -2,6 +2,7 @@
 module.exports = function ( grunt ) {
        grunt.loadNpmTasks( 'grunt-contrib-copy' );
        grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+       grunt.loadNpmTasks( 'grunt-stylelint' );
        grunt.loadNpmTasks( 'grunt-contrib-watch' );
        grunt.loadNpmTasks( 'grunt-banana-checker' );
        grunt.loadNpmTasks( 'grunt-jscs' );
@@ -39,9 +40,15 @@ module.exports = function ( grunt ) {
                        api: 'includes/api/i18n/',
                        installer: 'includes/installer/i18n/'
                },
+               stylelint: {
+                       options: {
+                               syntax: 'less'
+                       },
+                       src: '{resources/src/*,{mw-config,tests}/**}/*.{css,less}'
+               },
                watch: {
                        files: [
-                               '.js*',
+                               '.{stylelintrc,jscsrc,jshintignore,jshintrc}',
                                '**/*',
                                '!{docs,extensions,node_modules,skins,vendor}/**'
                        ],
@@ -96,7 +103,7 @@ module.exports = function ( grunt ) {
                return !!( process.env.MW_SERVER && process.env.MW_SCRIPT_PATH );
        } );
 
-       grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] );
+       grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'jsonlint', 'banana', 'stylelint' ] );
        grunt.registerTask( 'qunit', [ 'assert-mw-env', 'karma:main' ] );
 
        grunt.registerTask( 'test', [ 'lint' ] );
index ecd10fa..6cc94ab 100644 (file)
@@ -10,7 +10,7 @@ body {
 }
 
 #main {
-       border: 1px solid #D0D0D0;
+       border: 1px solid #d0d0d0;
        background: #fff;
        margin: 0.5em;
 }
index 394f36e..085edc4 100644 (file)
     "grunt-jscs": "2.8.0",
     "grunt-jsonlint": "1.0.7",
     "grunt-karma": "0.12.2",
+    "grunt-stylelint": "0.2.0",
     "karma": "0.13.22",
     "karma-chrome-launcher": "0.2.2",
     "karma-firefox-launcher": "0.1.7",
     "karma-qunit": "0.1.9",
-    "qunitjs": "1.22.0"
+    "qunitjs": "1.22.0",
+    "stylelint-config-wikimedia": "0.1.0"
   }
 }
index 15cd926..d42df12 100644 (file)
@@ -47,7 +47,7 @@
 }
 
 .suggestions-result-current {
-       background-color: #4C59A6;
+       background-color: #4c59a6;
        color: white;
 }
 
index 9adfba1..ff60ce7 100644 (file)
@@ -295,7 +295,7 @@ span.unpatrolled {
 
 span.updatedmarker {
        color: black;
-       background-color: #00FF00;
+       background-color: #00ff00;
 }
 
 div.gallerybox {
index ec6cee4..95e19b1 100644 (file)
@@ -246,7 +246,7 @@ input#wpSummary {
 .catlinks li {
        display: inline-block;
        line-height: 1.25em;
-       border-left: 1px solid #AAA;
+       border-left: 1px solid #aaa;
        margin: 0.125em 0;
        padding: 0 0.5em;
        zoom: 1;
@@ -325,7 +325,7 @@ p.mw-delete-editreasons {
 div.mw-warning-with-logexcerpt {
        padding: 3px;
        margin-bottom: 3px;
-       border: 2px solid #2F6FAB;
+       border: 2px solid #2f6fab;
        clear: both;
 }
 
@@ -352,7 +352,7 @@ th.mw-revdel-checkbox {
 
 /* red links; see bug 36276 */
 a.new {
-       color: #BA0000;
+       color: #ba0000;
 }
 
 /* Plainlinks - this can be used to switch
index b57ee36..80a2ff4 100644 (file)
@@ -16,7 +16,7 @@
 }
 
 .editOptions {
-       background-color: #F0F0F0;
+       background-color: #f0f0f0;
        border: 1px solid silver;
        border-top: none;
        padding: 1em 1em 1.5em 1em;
index 1ce9569..1ce526d 100755 (executable)
@@ -121,7 +121,7 @@ fieldset#mw-searchoptions table td {
 }
 fieldset#mw-searchoptions div.divider {
        clear: both;
-       border-bottom: 1px solid #DDDDDD;
+       border-bottom: 1px solid #ddd;
        padding-top: 0.5em;
        margin-bottom: 0.5em;
 }
@@ -132,7 +132,7 @@ td#mw-search-menu {
 div#mw-search-interwiki {
        float: right;
        width: 18em;
-       border: 1px solid #AAAAAA;
+       border: 1px solid #aaa;
        margin-top: 2ex;
 }
 div#mw-search-interwiki li {
@@ -152,7 +152,7 @@ div#mw-search-interwiki-caption {
        text-align: left;
        padding: 0.15em 0.15em 0.2em 0.2em;
        background-color: #ececec;
-       border-top: 1px solid #BBBBBB;
+       border-top: 1px solid #bbb;
 }
 span.searchalttitle {
        font-size: 95%;
index 949c558..a4e3710 100644 (file)
@@ -115,7 +115,7 @@ a.mw-debug-panelabel:visited {
        th,
        td,
        table {
-               border: 1px solid #D0DBB3;
+               border: 1px solid #d0dbb3;
                border-collapse: collapse;
                margin: 0;
        }
@@ -127,7 +127,7 @@ a.mw-debug-panelabel:visited {
        }
 
        th {
-               background-color: #F1F7E2;
+               background-color: #f1f7e2;
                font-weight: bold;
        }
 
index 188af6a..5111d96 100644 (file)
 }
 
 .mw-notification-type-warn {
-       border-color: #F5BE00; /* yellow */
-       background-color: #FFFFE8;
+       border-color: #f5be00; /* yellow */
+       background-color: #ffffe8;
 }
 
 .mw-notification-type-error {
-       border-color: #EB3941; /* red */
-       background-color: #FFF8F8;
+       border-color: #eb3941; /* red */
+       background-color: #fff8f8;
 }