Change from jshint to eslint

Change-Id: I9d8a31c8048f9d80e8395a637573272ca5f9fea5
This commit is contained in:
Fomafix 2017-04-30 10:15:57 +02:00
parent a04950b638
commit 19d698b422
5 changed files with 21 additions and 35 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,25 +0,0 @@
{
// Enforcing
"bitwise": true,
"eqeqeq": true,
"es3": true,
"freeze": true,
"latedef": true,
"noarg": true,
"nonew": true,
"undef": true,
"unused": true,
"strict": false,
// Relaxing
"laxbreak": true,
"multistr": true,
// Environment
"browser": true,
"globals": {
"mediaWiki": true,
"jQuery": false
}
}

View file

@ -4,10 +4,10 @@
* @package CategoryTree
*/
/*jshint node:true */
/* eslint-env node */
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-stylelint' );
@ -15,11 +15,10 @@ module.exports = function ( grunt ) {
banana: {
all: [ 'i18n/' ]
},
jshint: {
eslint: {
all: [
'**/*.js',
'!node_modules/**',
'!vendor/**'
'!node_modules/**'
]
},
jsonlint: {
@ -37,6 +36,6 @@ module.exports = function ( grunt ) {
}
} );
grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'jshint', 'stylelint' ] );
grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'eslint', 'stylelint' ] );
grunt.registerTask( 'default', 'test' );
};

View file

@ -8,6 +8,8 @@
* @licence GNU General Public Licence 2.0 or later
*/
/* eslint no-use-before-define: ["error", { "functions": false }] */
( function ( $, mw ) {
mw.hook( 'wikipage.content' ).add( function ( $content ) {
@ -23,9 +25,8 @@
* Handles clicks on the expand buttons, and calls the appropriate function
*
* @context {Element} CategoryTreeToggle
* @param e {jQuery.Event}
*/
function handleNode( /*e*/ ) {
function handleNode() {
var $link = $( this );
if ( $link.data( 'ct-state' ) === 'collapsed' ) {
expandNode( $link );

View file

@ -4,9 +4,10 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.3.0",
"grunt": "1.0.1",
"grunt-banana-checker": "0.4.0",
"grunt-contrib-jshint": "1.1.0",
"grunt-eslint": "19.0.0",
"grunt-jsonlint": "1.0.7",
"grunt-stylelint": "0.6.0",
"stylelint-config-wikimedia": "0.4.1"