mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
25d00cc777
jshint: * Update to grunt-contrib-jshint v0.10.0 (jshint v2.5.0). * Remove coding style options covered by jscs. * Enable new option "freeze" (prohibits changing native prototypes). http://www.jshint.com/blog/new-in-jshint-oct-2013/#option-freeze * Re-order to match http://www.jshint.com/docs/options/ jscs: * Update to grunt-jscs-checker v0.4.4 (jscs v1.4.5). * Format .jscsrc file in a more spacious way and order the properties less arbitrarily (using the jscs's readme order). * Enforce more details of our coding style * Get rid of the unsable "sticky" operator rules which have been deprecated in favour of using other rules instead that are able to enforce this more accurately. - disallowLeftStickedOperators: Remove deprecated rule. * Ternary covered by requireSpacesInConditionalExpression. * Rest covered by requireSpace{Before,After}BinaryOperators. - requireLeftStickedOperators: Remove deprecated rule. * Comma covered by disallowSpaceBeforeBinaryOperators. - requireRightStickedOperators: Remove deprecated rule. * Logical not (!) covered by disallowSpaceAfterPrefixUnaryOperators. See also If46b94ce1, Ib731f11b1 and I0b0cadbc5 in oojs/core. Also: * Update grunt-contrib-watch to latest upstream version. Change log at https://github.com/gruntjs/grunt-contrib-watch/blob/v0.6.1/CHANGELOG#L1-L17 Change-Id: I6c5a34afea8b05a3dca617897c192594df06ca90
94 lines
1.9 KiB
JavaScript
94 lines
1.9 KiB
JavaScript
/*!
|
|
* Grunt file
|
|
*
|
|
* @package VisualEditor
|
|
*/
|
|
|
|
/*jshint node:true */
|
|
module.exports = function ( grunt ) {
|
|
var modules = grunt.file.readJSON( 'lib/ve/build/modules.json' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-csslint' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-jscs-checker' );
|
|
grunt.loadTasks( 'lib/ve/build/tasks' );
|
|
grunt.loadTasks( 'build/tasks' );
|
|
|
|
grunt.initConfig( {
|
|
pkg: grunt.file.readJSON( 'package.json' ),
|
|
jsduckcatconfig: {
|
|
main: {
|
|
target: '.docs/categories.json',
|
|
from: [
|
|
'.docs/mw-categories.json',
|
|
{
|
|
file: 'lib/ve/.docs/categories.json',
|
|
aggregate: {
|
|
'VisualEditor (core)': [
|
|
'General',
|
|
'Initialization',
|
|
'DataModel',
|
|
'ContentEditable',
|
|
'User Interface',
|
|
'Tests'
|
|
]
|
|
},
|
|
include: [ 'UnicodeJS', 'OOJS UI', 'Upstream' ]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
buildloader: {
|
|
egiframe: {
|
|
targetFile: '.docs/eg-iframe.html',
|
|
template: '.docs/eg-iframe.html.template',
|
|
modules: modules,
|
|
load: [ 'visualEditor.desktop' ],
|
|
pathPrefix: 'lib/ve/',
|
|
indent: '\t\t'
|
|
}
|
|
},
|
|
jshint: {
|
|
options: {
|
|
jshintrc: '.jshintrc'
|
|
},
|
|
all: [
|
|
'*.js',
|
|
'{.docs,build}/**/*.js',
|
|
'modules/**/*.js'
|
|
]
|
|
},
|
|
jscs: {
|
|
src: [
|
|
'<%= jshint.all %>'
|
|
]
|
|
},
|
|
csslint: {
|
|
options: {
|
|
csslintrc: '.csslintrc'
|
|
},
|
|
all: [
|
|
'modules/*/**/*.css'
|
|
]
|
|
},
|
|
banana: {
|
|
all: 'modules/ve-{mw,wmf}/i18n/'
|
|
},
|
|
watch: {
|
|
files: [
|
|
'.{csslintrc,jscsrc,jshintignore,jshintrc}',
|
|
'<%= jshint.all %>',
|
|
'<%= csslint.all %>'
|
|
],
|
|
tasks: 'test'
|
|
}
|
|
} );
|
|
|
|
grunt.registerTask( 'build', [ 'jsduckcatconfig', 'buildloader' ] );
|
|
grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'csslint', 'banana' ] );
|
|
grunt.registerTask( 'test', [ 'build', 'lint' ] );
|
|
grunt.registerTask( 'default', 'test' );
|
|
};
|