mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 11:46:55 +00:00
4eb9c0efa8
- Add SVG Inline Loader for Webpack. This allows SVG files to be imported. - Update the Webpack and test configurations to use the new loader. - Scope the ESLint rules down to just JavaScript files so that linting isn't attempted on the SVG. Bug: T165036 Change-Id: I00bccff4c3167975c19d577be6343dcaca7ddb2d
73 lines
1.4 KiB
JavaScript
73 lines
1.4 KiB
JavaScript
/* eslint-evn 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-jsonlint' );
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
|
|
|
grunt.initConfig( {
|
|
banana: conf.MessagesDirs,
|
|
eslint: {
|
|
// 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: [
|
|
'src/**/*.js',
|
|
'tests/node-qunit/**/*.js',
|
|
'!resources/dist/index.js',
|
|
'!docs/**',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
}
|
|
},
|
|
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( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana', 'eslint:build' ] );
|
|
grunt.registerTask( 'default', [ 'lint' ] );
|
|
};
|