build: Install eslint

Change-Id: Ie129e854469e276022bad488bfc813b550256542
This commit is contained in:
James D. Forrester 2019-05-07 10:10:30 -07:00
parent 017f544118
commit c1399a6d3d
4 changed files with 24 additions and 11 deletions

7
.eslintrc.json Normal file
View file

@ -0,0 +1,7 @@
{
"root": true,
"extends": [
"wikimedia/client",
"wikimedia/jquery"
]
}

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
/node_modules/ /node_modules/
/vendor/ /vendor/
/composer.lock /composer.lock
.eslintcache
# Editors # Editors
*.kate-swp *.kate-swp

View file

@ -4,20 +4,24 @@
* @package ParserFunctions * @package ParserFunctions
*/ */
/*jshint node:true */ /* eslint-env node, es6 */
module.exports = function ( grunt ) { 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' ); var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.initConfig( { grunt.initConfig( {
banana: conf.MessagesDirs, banana: conf.MessagesDirs,
jshint: { eslint: {
options: {
reportUnusedDisableDirectives: true,
cache: true
},
all: [ all: [
'**/*.js', '**/*.js',
'!node_modules/**', '!{vendor,node_modules}/**'
'!vendor/**'
] ]
}, },
jsonlint: { 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' ); grunt.registerTask( 'default', 'test' );
}; };

View file

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