mediawiki-extensions-Echo/Gruntfile.js
James D. Forrester 94658a80c2 build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint
Bug: T220036
Change-Id: Iedc0e92345eeaa7400c87a2d29f67bff5ba38f4a
2019-05-07 20:44:20 +00:00

86 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-env 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-stylelint' );
grunt.loadNpmTasks( 'grunt-svgmin' );
grunt.initConfig( {
eslint: {
options: {
reportUnusedDisableDirectives: true,
extensions: [ '.js', '.json' ],
cache: true
},
all: [
'**/*.js{,on}',
'!{tests/externals,docs}/**',
'!{vendor,node_modules}/**'
]
},
// Lint Styling
stylelint: {
options: {
syntax: 'less'
},
all: [
'modules/**/*.css',
'modules/**/*.less'
]
},
// SVG Optimization
svgmin: {
options: {
js2svg: {
indent: '\t',
pretty: true
},
multipass: true,
plugins: [ {
cleanupIDs: false
}, {
removeDesc: false
}, {
removeRasterImages: true
}, {
removeTitle: false
}, {
removeViewBox: false
}, {
removeXMLProcInst: false
}, {
sortAttrs: true
} ]
},
all: {
files: [ {
expand: true,
cwd: 'modules/icons',
src: [
'**/*.svg'
],
dest: 'modules/icons/',
ext: '.svg'
} ]
}
},
banana: conf.MessagesDirs,
watch: {
files: [
'.{stylelintrc,eslintrc}.json',
'<%= eslint.all %>',
'<%= stylelint.all %>'
],
tasks: 'test'
}
} );
grunt.registerTask( 'minify', 'svgmin' );
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'banana' ] );
grunt.registerTask( 'test', 'lint' );
grunt.registerTask( 'default', [ 'minify', 'test' ] );
};