mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-01 02:36:35 +00:00
4ca333e577
...with the wikimedia presets. For automatically fixing most of the JS lint problems run grunt eslint:fix Some rules of stylelint were disabled given they cause problems with existing popups code (like no id selectors for example). Change-Id: I2153047c3ddbea50572dd329989088bb20787515
88 lines
1.8 KiB
JavaScript
88 lines
1.8 KiB
JavaScript
/* eslint-evn node */
|
|
|
|
module.exports = function ( grunt ) {
|
|
var QUNIT_URL_BASE = 'http://localhost:8080/wiki/Special:JavaScriptTest/qunit/plain';
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
|
|
|
grunt.initConfig( {
|
|
banana: {
|
|
all: 'i18n/'
|
|
},
|
|
eslint: {
|
|
fix: {
|
|
options: {
|
|
fix: true
|
|
},
|
|
src: [
|
|
'<%= eslint.all %>'
|
|
]
|
|
},
|
|
all: [
|
|
'resources/ext.popups/*.js',
|
|
'resources/ext.popups/**/*.js',
|
|
'!docs/**',
|
|
'!node_modules/**'
|
|
]
|
|
},
|
|
jsonlint: {
|
|
all: [
|
|
'*.json',
|
|
'**/*.json',
|
|
'!docs/**',
|
|
'!node_modules/**'
|
|
]
|
|
},
|
|
qunit: {
|
|
all: {
|
|
options: {
|
|
timeout: 10000, // Using the filter query param takes longer
|
|
summaryOnly: true,
|
|
urls: [
|
|
// Execute any QUnit test in those module whose names begin with
|
|
// "ext.popups".
|
|
QUNIT_URL_BASE + '?filter=ext.popups'
|
|
]
|
|
}
|
|
}
|
|
},
|
|
stylelint: {
|
|
options: {
|
|
syntax: 'less'
|
|
},
|
|
all: [
|
|
'resources/ext.popups/**/*.less'
|
|
]
|
|
},
|
|
watch: {
|
|
options: {
|
|
interrupt: true,
|
|
debounceDelay: 1000
|
|
},
|
|
lint: {
|
|
files: [ 'resources/ext.popups/**/*.less', 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
|
tasks: [ 'lint' ]
|
|
},
|
|
scripts: {
|
|
files: [ 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
|
tasks: [ 'test' ]
|
|
},
|
|
configFiles: {
|
|
files: [ 'Gruntfile.js' ],
|
|
options: {
|
|
reload: true
|
|
}
|
|
}
|
|
}
|
|
} );
|
|
|
|
grunt.registerTask( 'lint', [ 'eslint:all', 'stylelint', 'jsonlint', 'banana' ] );
|
|
grunt.registerTask( 'test', [ 'qunit' ] );
|
|
grunt.registerTask( 'default', [ 'lint', 'test' ] );
|
|
};
|