build: Install eslint

Change-Id: Ia34ce1a961d4b96c9467430576777223e9cda2ff
This commit is contained in:
James D. Forrester 2019-05-06 15:37:39 -07:00
parent 076b469525
commit 26d2866425
4 changed files with 42 additions and 5 deletions

23
.eslintrc.json Normal file
View file

@ -0,0 +1,23 @@
{
"root": true,
"extends": [
"wikimedia/client",
"wikimedia/jquery"
],
"globals": {
"ve": true,
"VisualEditorSupportCheck": false,
"OO": false,
"unicodeJS": false,
"RangeFix": false,
"Papa": false,
"mw": false,
"require": false
},
"rules": {
"no-jquery/no-hide": "error",
"no-jquery/no-show": "error",
"no-jquery/no-toggle": "error",
"max-len": "off"
}
}

1
.gitignore vendored
View file

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

View file

@ -4,16 +4,27 @@
* @package CiteThisPage
*/
/*jshint node:true */
/* eslint-env node, es6 */
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-jsonlint' );
var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.initConfig( {
banana: {
all: ["i18n/"]
eslint: {
options: {
reportUnusedDisableDirectives: true,
cache: true
},
all: [
'**/*.js',
'!{vendor,node_modules}/**'
]
},
banana: conf.MessagesDirs,
jsonlint: {
all: [
'**/*.json',
@ -30,6 +41,6 @@ module.exports = function ( grunt ) {
}
} );
grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'stylelint' ] );
grunt.registerTask( 'test', [ 'eslint', 'jsonlint', 'banana', 'stylelint' ] );
grunt.registerTask( 'default', 'test' );
};

View file

@ -7,9 +7,11 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.11.0",
"grunt": "1.0.3",
"grunt-banana-checker": "0.6.0",
"grunt-jsonlint": "1.1.0",
"grunt-eslint": "21.0.0",
"grunt-stylelint": "0.10.1",
"stylelint-config-wikimedia": "0.5.0"
}