Replace jshint/jscs with eslint and add stylelint

Change-Id: I9c33c65c913d891739b913d5363abba66c2cd0dd
This commit is contained in:
Ed Sanders 2017-01-18 12:52:44 +00:00 committed by James D. Forrester
parent d0722cfa5e
commit ae85f2ac6b
11 changed files with 44 additions and 39 deletions

10
.eslintrc.json Normal file
View file

@ -0,0 +1,10 @@
{
"extends": "wikimedia",
"env": {
"browser": true,
"jquery": true
},
"globals": {
"mediaWiki": false
}
}

View file

@ -1,3 +0,0 @@
{
"preset": "wikimedia"
}

View file

@ -1,2 +0,0 @@
node_modules/**
vendor/**

View file

@ -1,7 +0,0 @@
{
"globals": {
"mediaWiki": true,
"jQuery": true
}
}

3
.stylelintrc Normal file
View file

@ -0,0 +1,3 @@
{
"extends": "stylelint-config-wikimedia"
}

View file

@ -1,6 +1,6 @@
.fancycaptcha-wrapper { .fancycaptcha-wrapper {
display: table; display: table;
background-color: #FFF; background-color: #fff;
} }
/* Prevents the size of the container from changing, affecting page /* Prevents the size of the container from changing, affecting page
@ -11,27 +11,28 @@ layout, for normal CAPTCHA sizes. */
display: inline-block; display: inline-block;
} }
.client-nojs .fancycaptcha-reload {
display: none;
}
.fancycaptcha-reload { .fancycaptcha-reload {
/* @embed */ /* @embed */
background: url(images/fancycaptcha-reload-icon.png) no-repeat scroll left center transparent; background: url( images/fancycaptcha-reload-icon.png ) no-repeat scroll left center transparent;
margin: 0 0 0 3px; margin: 0 0 0 3px;
padding: 1px 2px 1px 12px; padding: 1px 2px 1px 12px;
color: #0645AD; color: #0645ad;
cursor: pointer; cursor: pointer;
cursor: hand; cursor: hand;
} }
.client-nojs .fancycaptcha-reload {
display: none;
}
.fancycaptcha-reload:hover { .fancycaptcha-reload:hover {
text-decoration: underline; text-decoration: underline;
} }
.fancycaptcha-reload-loading { .fancycaptcha-reload-loading {
/* @embed */ /* @embed */
background: url(images/ajax-loader-10x10.gif) no-repeat scroll left center transparent; background: url( images/ajax-loader-10x10.gif ) no-repeat scroll left center transparent;
} }
.fancycaptcha-image-container .fancycaptcha-reload { .fancycaptcha-image-container .fancycaptcha-reload {

View file

@ -42,4 +42,4 @@
return false; return false;
} ); } );
} )( jQuery, mediaWiki ); }( jQuery, mediaWiki ) );

View file

@ -1,19 +1,22 @@
/*jshint node:true */ /* eslint-env node */
module.exports = function ( grunt ) { module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-banana-checker' ); grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jscs' ); grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.initConfig( { grunt.initConfig( {
jshint: { eslint: {
all: [ all: [
'**/*.js', '**/*.js',
'!node_modules/**' '!node_modules/**'
] ]
}, },
jscs: { stylelint: {
src: '<%= jshint.all %>' all: [
'**/*.css',
'!node_modules/**'
]
}, },
banana: { banana: {
all: [ all: [
@ -30,6 +33,6 @@ module.exports = function ( grunt ) {
} }
} ); } );
grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] ); grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'default', 'test' ); grunt.registerTask( 'default', 'test' );
}; };

View file

@ -27,7 +27,7 @@ if ( getenv( 'MW_INSTALL_PATH' ) ) {
$IP = __DIR__.'/../../..'; $IP = __DIR__.'/../../..';
} }
require_once ( "$IP/maintenance/Maintenance.php" ); require_once ( "$IP/core/maintenance/Maintenance.php" );
/** /**
* Maintenance script to change the password of a given user. * Maintenance script to change the password of a given user.

View file

@ -4,12 +4,12 @@
"test": "grunt test" "test": "grunt test"
}, },
"devDependencies": { "devDependencies": {
"grunt": "0.4.5", "eslint-config-wikimedia": "0.3.0",
"grunt-cli": "0.1.13", "grunt": "1.0.1",
"grunt-contrib-jshint": "0.11.3", "grunt-eslint": "19.0.0",
"grunt-banana-checker": "0.4.0", "grunt-banana-checker": "0.5.0",
"grunt-jscs": "2.3.0", "grunt-jsonlint": "1.1.0",
"jscs-preset-wikimedia": "~1.0.0", "grunt-stylelint": "0.6.0",
"grunt-jsonlint": "1.0.7" "stylelint-config-wikimedia": "0.3.0"
} }
} }

View file

@ -1,7 +1,7 @@
.mw-confirmedit-ip-notvalid { .mw-confirmedit-ip-notvalid {
background-color: #FF6C6C; background-color: #ff6c6c;
} }
.mw-confirmedit-ip-valid { .mw-confirmedit-ip-valid {
background-color: #90EE90; background-color: #90ee90;
} }