From 6aaada1b9399ee99eee00318e24c36f4eef81a00 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Mon, 6 May 2019 16:25:17 -0700 Subject: [PATCH] build: Install eslint Change-Id: Ica9063361e24fb071dc19f3c895078f69ea550c4 --- .eslintrc.json | 7 +++++++ .gitignore | 1 + Gruntfile.js | 19 +++++++++---------- package.json | 6 +++--- 4 files changed, 20 insertions(+), 13 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 5ef4d9ae..a8bc303f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /vendor/ .idea node_modules/ +.eslintcache # Editors *.kate-swp diff --git a/Gruntfile.js b/Gruntfile.js index 8e17c27d..04a51f5c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,24 +1,23 @@ -/*jshint node:true */ +/* eslint-env node, es6 */ module.exports = function ( grunt ) { var conf = grunt.file.readJSON( 'extension.json' ); - grunt.loadNpmTasks( 'grunt-contrib-jshint' ); + grunt.loadNpmTasks( 'grunt-jsonlint' ); grunt.loadNpmTasks( 'grunt-banana-checker' ); - grunt.loadNpmTasks( 'grunt-jscs' ); + grunt.loadNpmTasks( 'grunt-eslint' ); grunt.loadNpmTasks( 'grunt-stylelint' ); grunt.initConfig( { - jshint: { + eslint: { options: { - jshintrc: true + reportUnusedDisableDirectives: true, + cache: true }, all: [ - '*.js' + '**/*.js', + '!{vendor,node_modules}/**' ] }, - jscs: { - src: '<%= jshint.all %>' - }, banana: conf.MessagesDirs, jsonlint: { all: [ @@ -37,6 +36,6 @@ module.exports = function ( grunt ) { } } ); - grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana', 'stylelint' ] ); + grunt.registerTask( 'test', [ 'eslint', 'jsonlint', 'banana', 'stylelint' ] ); grunt.registerTask( 'default', 'test' ); }; diff --git a/package.json b/package.json index e98ee1a3..3ca727f1 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,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-jscs": "2.3.0", + "grunt-eslint": "21.0.0", "grunt-jsonlint": "1.1.0", "grunt-stylelint": "0.10.1", "stylelint-config-wikimedia": "0.5.0"