mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-30 18:45:07 +00:00
bb1bd02bd6
* Load wikimedia/jsduck rules * Add inline disables for compat * Fix shadowed variables Change-Id: I42234ab74f5007c16ff3960309335e715da76c1c
87 lines
1.7 KiB
JavaScript
87 lines
1.7 KiB
JavaScript
/* eslint-env node, es6 */
|
||
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: {
|
||
cache: true,
|
||
fix: grunt.option( 'fix' )
|
||
},
|
||
all: [
|
||
'**/*.{js,json}',
|
||
'!{tests/externals,docs}/**',
|
||
'!{vendor,node_modules}/**'
|
||
]
|
||
},
|
||
// Lint – Styling
|
||
stylelint: {
|
||
options: {
|
||
syntax: 'less'
|
||
},
|
||
all: [
|
||
'modules/**/*.{css,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'
|
||
} ]
|
||
}
|
||
},
|
||
// eslint-disable-next-line es/no-object-assign, compat/compat
|
||
banana: Object.assign( {
|
||
options: { requireLowerCase: false }
|
||
}, 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' ] );
|
||
};
|