X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=Gruntfile.js;h=55b7932f002b1e4bfab0e935457d9751094ff39b;hb=c67539341378a7bc3589f4199627d8e7f2717204;hp=8dbeb6bfc05e2a55f7b05e010c87644a42a86c7d;hpb=f1a890c34cebd8744bf3a6277734275fb975575a;p=lhc%2Fweb%2Fwiklou.git diff --git a/Gruntfile.js b/Gruntfile.js index 8dbeb6bfc0..55b7932f00 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,49 +1,65 @@ -/*jshint node:true */ +/* eslint-env node */ + module.exports = function ( grunt ) { - grunt.loadNpmTasks( 'grunt-contrib-copy' ); - grunt.loadNpmTasks( 'grunt-contrib-jshint' ); - grunt.loadNpmTasks( 'grunt-contrib-watch' ); - grunt.loadNpmTasks( 'grunt-banana-checker' ); - grunt.loadNpmTasks( 'grunt-jscs' ); - grunt.loadNpmTasks( 'grunt-jsonlint' ); - grunt.loadNpmTasks( 'grunt-karma' ); var wgServer = process.env.MW_SERVER, wgScriptPath = process.env.MW_SCRIPT_PATH, karmaProxy = {}; + grunt.loadNpmTasks( 'grunt-banana-checker' ); + grunt.loadNpmTasks( 'grunt-contrib-copy' ); + grunt.loadNpmTasks( 'grunt-contrib-watch' ); + grunt.loadNpmTasks( 'grunt-eslint' ); + grunt.loadNpmTasks( 'grunt-jsonlint' ); + grunt.loadNpmTasks( 'grunt-karma' ); + grunt.loadNpmTasks( 'grunt-stylelint' ); + karmaProxy[ wgScriptPath ] = wgServer + wgScriptPath; grunt.initConfig( { - jshint: { - options: { - jshintrc: true - }, - all: '.' - }, - jscs: { - all: '.' + eslint: { + all: [ + '**/*.js', + '!docs/**', + '!tests/**', + '!node_modules/**', + '!resources/lib/**', + '!resources/src/jquery.tipsy/**', + '!resources/src/jquery/jquery.farbtastic.js', + '!resources/src/mediawiki.libs/**', + '!vendor/**', + // Explicitly say "**/*.js" here in case of symlinks + '!extensions/**/*.js', + '!skins/**/*.js', + // Skip functions aren't even parseable + '!resources/src/dom-level2-skip.js', + '!resources/src/es5-skip.js', + '!resources/src/mediawiki.hidpi-skip.js' + ] }, jsonlint: { all: [ - '.jscsrc', '**/*.json', '!{docs/js,extensions,node_modules,skins,vendor}/**' ] }, banana: { options: { - disallowBlankTranslations: false, - disallowDuplicateTranslations: false, - disallowUnusedTranslations: false + disallowBlankTranslations: false }, core: 'languages/i18n/', api: 'includes/api/i18n/', installer: 'includes/installer/i18n/' }, + stylelint: { + options: { + syntax: 'less' + }, + src: '{resources/src/*,mw-config/**}/*.{css,less}' + }, watch: { files: [ - '.js*', + '.{stylelintrc,eslintrc.json}', '**/*', '!{docs,extensions,node_modules,skins,vendor}/**' ], @@ -58,8 +74,9 @@ module.exports = function ( grunt ) { included: true, served: false } ], + logLevel: 'DEBUG', frameworks: [ 'qunit' ], - reporters: [ 'dots' ], + reporters: [ 'progress' ], singleRun: true, autoWatch: false, // Some tests in extensions don't yield for more than the default 10s (T89075) @@ -97,7 +114,7 @@ module.exports = function ( grunt ) { return !!( process.env.MW_SERVER && process.env.MW_SCRIPT_PATH ); } ); - grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] ); + grunt.registerTask( 'lint', [ 'eslint', 'banana', 'stylelint' ] ); grunt.registerTask( 'qunit', [ 'assert-mw-env', 'karma:main' ] ); grunt.registerTask( 'test', [ 'lint' ] );