mediawiki-extensions-Popups/Gruntfile.js
Stephen Niedzielski 2a854f7649 Hygiene: forbid unused lint directives
Prevent outdated ESLint error waivers from littering the code by
enabling `--report-unused-disable-directives`.

Change-Id: I3b9c39131f030cf2c4113ecd947c3f4a8679bdfe
2018-07-02 14:59:40 -05:00

85 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,
reportUnusedDisableDirectives: true
},
// 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: [
'src/**/*.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' ] );
};