From 400a3ad210c51299c41eb6338d12843d4bf243f7 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Mon, 17 Apr 2017 19:19:52 +0200 Subject: [PATCH] Add stylelint for css files Fixed the following rules: color-hex-case declaration-colon-space-after indentation Change-Id: I417137916607a25bab6a3c85a95b4c489fb8a8a5 --- .stylelintrc | 7 +++++++ Gruntfile.js | 11 ++++++++++- modules/ext.categoryTree.css | 16 ++++++++-------- package.json | 7 ++++--- 4 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 .stylelintrc diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 00000000..449f45bd --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,7 @@ +{ + "extends": "stylelint-config-wikimedia", + "rules": { + "selector-no-id": null, + "no-descending-specificity": null + } +} diff --git a/Gruntfile.js b/Gruntfile.js index 8d7afa41..b1905ed8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,6 +8,8 @@ module.exports = function ( grunt ) { grunt.loadNpmTasks( 'grunt-jsonlint' ); grunt.loadNpmTasks( 'grunt-banana-checker' ); + grunt.loadNpmTasks( 'grunt-stylelint' ); + grunt.initConfig( { banana: { all: ['i18n/'] @@ -15,11 +17,18 @@ module.exports = function ( grunt ) { jsonlint: { all: [ '**/*.json', + '.stylelintrc', + '!node_modules/**' + ] + }, + stylelint: { + all: [ + '**/*.css', '!node_modules/**' ] } } ); - grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] ); + grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'stylelint' ] ); grunt.registerTask( 'default', 'test' ); }; diff --git a/modules/ext.categoryTree.css b/modules/ext.categoryTree.css index 21192ee6..4534123e 100644 --- a/modules/ext.categoryTree.css +++ b/modules/ext.categoryTree.css @@ -14,13 +14,13 @@ } #mw-panel div.portal div.body .CategoryTreeTag { - margin: 0; - font-size: 0.75em; - line-height: 1.125em; + margin: 0; + font-size: 0.75em; + line-height: 1.125em; } #mw-panel div.portal div.body .CategoryTreeItem { - padding: 0.25em 0; + padding: 0.25em 0; } .CategoryTreeChildren { @@ -33,7 +33,7 @@ .CategoryTreeEmptyBullet { cursor: default; - color: #C0C0C0; + color: #c0c0c0; } .CategoryTreeBullet a, @@ -46,7 +46,7 @@ } .CategoryTreeToggle { - color: #0645AD; + color: #0645ad; } .CategoryTreeLabelPage { @@ -77,11 +77,11 @@ display: inline-block; /* why is the -0.5ex needed? */ margin: -0.5ex 0 0 1ex; - padding:0; + padding: 0; vertical-align: top; /* IE6-7 Hack for display: inline-block */ zoom: 1; - *display: inline; + *display: inline; /* stylelint-disable-line declaration-block-no-duplicate-properties */ } .CategoryTreeSection { diff --git a/package.json b/package.json index 7c3b0bc1..054f4109 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,10 @@ "test": "grunt test" }, "devDependencies": { - "grunt": "0.4.5", - "grunt-cli": "0.1.13", + "grunt": "1.0.1", "grunt-banana-checker": "0.4.0", - "grunt-jsonlint": "1.0.7" + "grunt-jsonlint": "1.0.7", + "grunt-stylelint": "0.6.0", + "stylelint-config-wikimedia": "0.4.1" } }