build: Replace jshint and jscs with eslint

Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7903
This commit is contained in:
James D. Forrester 2016-11-29 08:22:16 -08:00
parent 1f26153a5d
commit 9bd5ce5a1e
6 changed files with 18 additions and 45 deletions

7
.eslintrc.json Normal file
View file

@ -0,0 +1,7 @@
{
"extends": "wikimedia",
"env": {
"browser": true,
"jquery": true
}
}

View file

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

View file

@ -1 +0,0 @@
node_modules

View file

@ -1,24 +0,0 @@
{
// Enforcing
"bitwise": true,
"eqeqeq": true,
"freeze": true,
"latedef": true,
"noarg": true,
"nonew": true,
"undef": true,
"unused": true,
"strict": false,
// Relaxing
"es5": false,
// Environment
"browser": true,
"jquery": true,
"globals": {
"mediaWiki": false,
"OO": false
}
}

View file

@ -1,34 +1,28 @@
/*jshint node:true */ /* eslint-env node */
module.exports = function ( grunt ) { module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'skin.json' ); var conf = grunt.file.readJSON( 'skin.json' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' ); grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jsonlint' ); grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-banana-checker' ); grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jscs' );
grunt.initConfig( { grunt.initConfig( {
jshint: { eslint: {
options: {
jshintrc: true
},
all: [ all: [
'*.js', '*.js',
'**/*.js', '**/*.js',
'!node_modules/**' '!node_modules/**'
] ]
}, },
jscs: {
src: '<%= jshint.all %>'
},
banana: conf.MessagesDirs,
jsonlint: { jsonlint: {
all: [ all: [
'*.json',
'**/*.json', '**/*.json',
'!node_modules/**' '!node_modules/**'
] ]
} },
banana: conf.MessagesDirs
} ); } );
grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] ); grunt.registerTask( 'test', [ 'eslint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'default', 'test' ); grunt.registerTask( 'default', 'test' );
}; };

View file

@ -7,10 +7,10 @@
"devDependencies": { "devDependencies": {
"grunt": "0.4.5", "grunt": "0.4.5",
"grunt-cli": "0.1.13", "grunt-cli": "0.1.13",
"grunt-contrib-jshint": "1.0.0",
"grunt-eslint": "19.0.0",
"eslint-config-wikimedia": "0.3.0",
"grunt-banana-checker": "0.5.0", "grunt-banana-checker": "0.5.0",
"grunt-jscs": "2.8.0", "grunt-jsonlint": "1.0.7"
"grunt-jsonlint": "1.0.7",
"jscs-preset-wikimedia": "~1.0.0"
} }
} }