From c1399a6d3da3b99d1737a8a376caa179935ee84f Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 7 May 2019 10:10:30 -0700 Subject: [PATCH] build: Install eslint Change-Id: Ie129e854469e276022bad488bfc813b550256542 --- .eslintrc.json | 7 +++++++ .gitignore | 1 + Gruntfile.js | 22 +++++++++++++--------- package.json | 5 +++-- 4 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..1a97f6e1 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,7 @@ +{ + "root": true, + "extends": [ + "wikimedia/client", + "wikimedia/jquery" + ] +} diff --git a/.gitignore b/.gitignore index 22174561..28213b67 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /node_modules/ /vendor/ /composer.lock +.eslintcache # Editors *.kate-swp diff --git a/Gruntfile.js b/Gruntfile.js index af2402e4..f61f0f54 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,20 +4,24 @@ * @package ParserFunctions */ -/*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: { + options: { + reportUnusedDisableDirectives: true, + cache: true + }, all: [ '**/*.js', - '!node_modules/**', - '!vendor/**' + '!{vendor,node_modules}/**' ] }, jsonlint: { @@ -29,6 +33,6 @@ module.exports = function ( grunt ) { } } ); - grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'jshint' ] ); + grunt.registerTask( 'test', [ 'eslint', 'jsonlint', 'banana' ] ); grunt.registerTask( 'default', 'test' ); }; diff --git a/package.json b/package.json index 4ce4e524..36521afd 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,10 @@ "test": "grunt test" }, "devDependencies": { - "grunt": "1.0.3", + "eslint-config-wikimedia": "0.11.0", + "grunt": "1.0.4", "grunt-banana-checker": "0.6.0", - "grunt-contrib-jshint": "1.1.0", + "grunt-eslint": "21.0.0", "grunt-jsonlint": "1.1.0" } }