build: Introduce stylelint

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
changes/60/289660/1
James D. Forrester 9 years ago
parent 5fd224c00b
commit 3bf6f42929

@ -0,0 +1,5 @@
{
"rules": {
"color-hex-case": [ "lower" ]
}
}

@ -2,6 +2,7 @@
module.exports = function ( grunt ) { module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-copy' ); grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' ); grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-contrib-watch' ); grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-banana-checker' ); grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jscs' ); grunt.loadNpmTasks( 'grunt-jscs' );
@ -39,9 +40,15 @@ module.exports = function ( grunt ) {
api: 'includes/api/i18n/', api: 'includes/api/i18n/',
installer: 'includes/installer/i18n/' installer: 'includes/installer/i18n/'
}, },
stylelint: {
options: {
syntax: 'less'
},
src: '{resources/src/*,{mw-config,tests}/**}/*.{css,less}'
},
watch: { watch: {
files: [ files: [
'.js*', '.{stylelintrc,jscsrc,jshintignore,jshintrc}',
'**/*', '**/*',
'!{docs,extensions,node_modules,skins,vendor}/**' '!{docs,extensions,node_modules,skins,vendor}/**'
], ],
@ -96,7 +103,7 @@ module.exports = function ( grunt ) {
return !!( process.env.MW_SERVER && process.env.MW_SCRIPT_PATH ); 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( 'qunit', [ 'assert-mw-env', 'karma:main' ] );
grunt.registerTask( 'test', [ 'lint' ] ); grunt.registerTask( 'test', [ 'lint' ] );

@ -10,7 +10,7 @@ body {
} }
#main { #main {
border: 1px solid #D0D0D0; border: 1px solid #d0d0d0;
background: #fff; background: #fff;
margin: 0.5em; margin: 0.5em;
} }

@ -14,10 +14,12 @@
"grunt-jscs": "2.8.0", "grunt-jscs": "2.8.0",
"grunt-jsonlint": "1.0.7", "grunt-jsonlint": "1.0.7",
"grunt-karma": "0.12.2", "grunt-karma": "0.12.2",
"grunt-stylelint": "0.2.0",
"karma": "0.13.22", "karma": "0.13.22",
"karma-chrome-launcher": "0.2.2", "karma-chrome-launcher": "0.2.2",
"karma-firefox-launcher": "0.1.7", "karma-firefox-launcher": "0.1.7",
"karma-qunit": "0.1.9", "karma-qunit": "0.1.9",
"qunitjs": "1.22.0" "qunitjs": "1.22.0",
"stylelint-config-wikimedia": "0.1.0"
} }
} }

@ -47,7 +47,7 @@
} }
.suggestions-result-current { .suggestions-result-current {
background-color: #4C59A6; background-color: #4c59a6;
color: white; color: white;
} }

@ -295,7 +295,7 @@ span.unpatrolled {
span.updatedmarker { span.updatedmarker {
color: black; color: black;
background-color: #00FF00; background-color: #00ff00;
} }
div.gallerybox { div.gallerybox {

@ -246,7 +246,7 @@ input#wpSummary {
.catlinks li { .catlinks li {
display: inline-block; display: inline-block;
line-height: 1.25em; line-height: 1.25em;
border-left: 1px solid #AAA; border-left: 1px solid #aaa;
margin: 0.125em 0; margin: 0.125em 0;
padding: 0 0.5em; padding: 0 0.5em;
zoom: 1; zoom: 1;
@ -325,7 +325,7 @@ p.mw-delete-editreasons {
div.mw-warning-with-logexcerpt { div.mw-warning-with-logexcerpt {
padding: 3px; padding: 3px;
margin-bottom: 3px; margin-bottom: 3px;
border: 2px solid #2F6FAB; border: 2px solid #2f6fab;
clear: both; clear: both;
} }
@ -352,7 +352,7 @@ th.mw-revdel-checkbox {
/* red links; see bug 36276 */ /* red links; see bug 36276 */
a.new { a.new {
color: #BA0000; color: #ba0000;
} }
/* Plainlinks - this can be used to switch /* Plainlinks - this can be used to switch

@ -16,7 +16,7 @@
} }
.editOptions { .editOptions {
background-color: #F0F0F0; background-color: #f0f0f0;
border: 1px solid silver; border: 1px solid silver;
border-top: none; border-top: none;
padding: 1em 1em 1.5em 1em; padding: 1em 1em 1.5em 1em;

@ -121,7 +121,7 @@ fieldset#mw-searchoptions table td {
} }
fieldset#mw-searchoptions div.divider { fieldset#mw-searchoptions div.divider {
clear: both; clear: both;
border-bottom: 1px solid #DDDDDD; border-bottom: 1px solid #ddd;
padding-top: 0.5em; padding-top: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
@ -132,7 +132,7 @@ td#mw-search-menu {
div#mw-search-interwiki { div#mw-search-interwiki {
float: right; float: right;
width: 18em; width: 18em;
border: 1px solid #AAAAAA; border: 1px solid #aaa;
margin-top: 2ex; margin-top: 2ex;
} }
div#mw-search-interwiki li { div#mw-search-interwiki li {
@ -152,7 +152,7 @@ div#mw-search-interwiki-caption {
text-align: left; text-align: left;
padding: 0.15em 0.15em 0.2em 0.2em; padding: 0.15em 0.15em 0.2em 0.2em;
background-color: #ececec; background-color: #ececec;
border-top: 1px solid #BBBBBB; border-top: 1px solid #bbb;
} }
span.searchalttitle { span.searchalttitle {
font-size: 95%; font-size: 95%;

@ -115,7 +115,7 @@ a.mw-debug-panelabel:visited {
th, th,
td, td,
table { table {
border: 1px solid #D0DBB3; border: 1px solid #d0dbb3;
border-collapse: collapse; border-collapse: collapse;
margin: 0; margin: 0;
} }
@ -127,7 +127,7 @@ a.mw-debug-panelabel:visited {
} }
th { th {
background-color: #F1F7E2; background-color: #f1f7e2;
font-weight: bold; font-weight: bold;
} }

@ -42,11 +42,11 @@
} }
.mw-notification-type-warn { .mw-notification-type-warn {
border-color: #F5BE00; /* yellow */ border-color: #f5be00; /* yellow */
background-color: #FFFFE8; background-color: #ffffe8;
} }
.mw-notification-type-error { .mw-notification-type-error {
border-color: #EB3941; /* red */ border-color: #eb3941; /* red */
background-color: #FFF8F8; background-color: #fff8f8;
} }

Loading…
Cancel
Save