Replace jshint with eslint

Change-Id: I34d56f7e6c8efe4b9bb1efebd2e8bfce35d6afb7
This commit is contained in:
Ed Sanders 2018-12-05 17:02:53 -05:00
parent ea141a70fe
commit ccf77bdddb
4 changed files with 27 additions and 15 deletions

9
.eslintrc.json Normal file
View file

@ -0,0 +1,9 @@
{
"extends": [
"wikimedia/client",
"wikimedia/jquery"
],
"globals": {
"mw": false
}
}

View file

@ -1,13 +1,14 @@
/*jshint node:true */
/* eslint-env node, es6 */
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.initConfig( {
banana: conf.MessagesDirs,
jshint: {
eslint: {
all: [
'**/*.js',
'!node_modules/**',
@ -23,6 +24,6 @@ module.exports = function ( grunt ) {
}
} );
grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'jshint' ] );
grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'eslint' ] );
grunt.registerTask( 'default', 'test' );
};

View file

@ -1,7 +1,7 @@
/**
* @class mw.Api.plugin.titleblacklist
*/
( function ( mw, $ ) {
( function () {
$.extend( mw.Api.prototype, {
/**
@ -12,7 +12,8 @@
* @param {Function} [err] Error callback (deprecated)
* @return {jQuery.Promise}
* @return {Function} return.done
* @return {Object|boolean} return.done.result False if title wasn't blacklisted, an object with 'reason', 'line'
* @return {Object|boolean} return.done.result False if title wasn't blacklisted, an object
* with 'reason', 'line'
* and 'message' properties if title was blacklisted.
*/
isBlacklisted: function ( title, ok, err ) {
@ -22,10 +23,10 @@
d.fail( err );
this.get( {
action: 'titleblacklist',
tbaction: 'create',
tbtitle: title.toString()
} )
action: 'titleblacklist',
tbaction: 'create',
tbtitle: title.toString()
} )
.done( function ( data ) {
var result;
@ -64,4 +65,4 @@
* @mixins mw.Api.plugin.titleblacklist
*/
}( mediaWiki, jQuery ) );
}() );

View file

@ -4,9 +4,10 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.9.0",
"grunt": "1.0.3",
"grunt-eslint": "21.0.0",
"grunt-banana-checker": "0.6.0",
"grunt-contrib-jshint": "1.1.0",
"grunt-jsonlint": "1.1.0"
}
}