mediawiki-extensions-Popups/Gruntfile.js
Ed Sanders 85fc18d38d eslint: Cleanup linting of /dist
* Move eslintrc.es5.json to /dist to avoid extra Grunt config
* Upgrade clean-webpack-plugin and exclude dist/.eslintrc.js
  from cleaning
* Set root:true and just enable wikimedia/language/not-es5 instead
  of disabling dozens of rules
* Remove getOwnPropertySymbols rule as webpack uses this.

Change-Id: I802138a8a591dd4c3cb0cc637112e383570286df
2020-04-27 20:45:42 +01:00

76 lines
1.5 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-stylelint' );
grunt.loadNpmTasks( 'grunt-svgmin' );
grunt.initConfig( {
banana: conf.MessagesDirs,
eslint: {
options: {
cache: true,
maxWarnings: 0,
extensions: [ '.js', '.json' ],
fix: grunt.option( 'fix' )
},
all: {
src: [
'*.{js,json}',
'src/**/*.{js,json}',
'tests/**/*.{js,json}',
// Lint the built artifacts with ES5 so that no ES6 slips to production
'resources/dist/*.js'
]
}
},
stylelint: {
options: {
syntax: 'less',
fix: grunt.option( 'fix' )
},
all: [
'src/**/*.less'
]
},
// SVG Optimization
svgmin: {
options: grunt.file.readJSON( '.svgo.json' ),
all: {
files: [ {
expand: true,
cwd: 'resources/ext.popups.images',
src: [
'**/*.svg'
],
dest: 'resources/ext.popups.images/',
ext: '.svg'
} ]
}
},
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( 'lint', [ 'eslint', 'stylelint', 'banana', 'svgmin' ] );
grunt.registerTask( 'default', [ 'lint' ] );
};