mediawiki-extensions-Popups/Gruntfile.js
Stephen Niedzielski 367b12a278 Hygiene: bump ESLint to ES6 and lint more files
- Bump the ESLint configuration ECMAScript 2015 given that we use Babel
  and have a safeguard to verify build products are ES5.

- Lint more files including all tests and the Webpack and Grunt configs.

Change-Id: I099cbe009eda2349ddc051976ace0d9f6c55fa30
2018-05-01 14:47:51 -05:00

84 lines
1.6 KiB
JavaScript

/* eslint-evn node */
module.exports = function ( grunt ) {
const 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: {
options: {
maxWarnings: 0
},
// 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: [
'*.js',
'src/**/*.js',
'tests/**/*.js'
]
},
sourcesfix: {
options: {
fix: true
},
src: [
'*.js',
'src/**/*.js',
'tests/**/*.js'
]
}
},
jsonlint: {
all: [
'*.json',
'**/*.json',
'!docs/**',
'!node_modules/**',
'!vendor/**'
]
},
stylelint: {
options: {
syntax: 'less'
},
all: [
'resources/ext.popups.main/**/*.less'
]
},
watch: {
options: {
interrupt: true,
debounceDelay: 1000
},
lint: {
files: [ 'resources/ext.popups.main/**/*.less', 'resources/**/*.js' ],
tasks: [ 'lint' ]
},
configFiles: {
files: [ 'Gruntfile.js' ],
options: {
reload: true
}
}
}
} );
grunt.registerTask( 'fix', [ 'eslint:sourcesfix' ] );
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana', 'eslint:build' ] );
grunt.registerTask( 'default', [ 'lint' ] );
};