build: Install eslint

Change-Id: Ica9063361e24fb071dc19f3c895078f69ea550c4
This commit is contained in:
James D. Forrester 2019-05-06 16:25:17 -07:00
parent 092a9440d3
commit 6aaada1b93
4 changed files with 20 additions and 13 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 @@
/vendor/ /vendor/
.idea .idea
node_modules/ node_modules/
.eslintcache
# Editors # Editors
*.kate-swp *.kate-swp

View file

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

View file

@ -4,10 +4,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-jscs": "2.3.0",
"grunt-jsonlint": "1.1.0", "grunt-jsonlint": "1.1.0",
"grunt-stylelint": "0.10.1", "grunt-stylelint": "0.10.1",
"stylelint-config-wikimedia": "0.5.0" "stylelint-config-wikimedia": "0.5.0"