mediawiki-extensions-Popups/Gruntfile.js
jdlrobson 90fbd093c8 Run eslint on compiled assets to ensure code is es5 compatible
It doesn't feel great but it does the trick.

Bug: T174570
Change-Id: I76d1b81625a77df0d926c2da714bcab606a28b8d
2017-09-07 12:30:33 +02:00

71 lines
1.4 KiB
JavaScript

/* eslint-evn node */
module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.initConfig( {
banana: conf.MessagesDirs,
eslint: {
// Lint the built artifacts with ES5 so that no ES6 slips to production
build: {
options: {
configFile: '.eslintrc.es5.json'
},
src: [
'resources/dist/*.js'
]
},
sources: {
src: [
'src/**',
'tests/node-qunit/**/*.js',
'!resources/dist/index.js',
'!docs/**',
'!node_modules/**'
]
}
},
jsonlint: {
all: [
'*.json',
'**/*.json',
'!docs/**',
'!node_modules/**'
]
},
stylelint: {
options: {
syntax: 'less'
},
all: [
'resources/ext.popups/**/*.less'
]
},
watch: {
options: {
interrupt: true,
debounceDelay: 1000
},
lint: {
files: [ 'resources/ext.popups/**/*.less', 'resources/**/*.js' ],
tasks: [ 'lint' ]
},
configFiles: {
files: [ 'Gruntfile.js' ],
options: {
reload: true
}
}
}
} );
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana', 'eslint:build' ] );
grunt.registerTask( 'default', [ 'lint' ] );
};