Merge "build: Add csshint, jshint and jscs to math extension"
This commit is contained in:
commit
f99b77c98e
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"adjoining-classes": false,
|
||||
"box-model": false,
|
||||
"box-sizing": false,
|
||||
"fallback-colors": false,
|
||||
"important": false,
|
||||
"outline-none": false,
|
||||
"qualified-headings": false,
|
||||
"unique-headings": false,
|
||||
"universal-selector": false,
|
||||
"unqualified-attributes": false,
|
||||
"gradients": false
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"preset": "wikimedia",
|
||||
|
||||
"jsDoc": {
|
||||
"checkAnnotations": {
|
||||
"preset": "jsduck5",
|
||||
"extra": {
|
||||
"this": true,
|
||||
"source": true,
|
||||
"see": true
|
||||
}
|
||||
},
|
||||
"checkTypes": "strictNativeCase",
|
||||
"checkParamNames": true,
|
||||
"checkRedundantAccess": true,
|
||||
"checkRedundantReturns": true,
|
||||
"requireNewlineAfterDescription": true,
|
||||
"requireParamTypes": true,
|
||||
"requireReturnTypes": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
// Enforcing
|
||||
"bitwise": true,
|
||||
"eqeqeq": true,
|
||||
"freeze": true,
|
||||
"latedef": true,
|
||||
"noarg": true,
|
||||
"nonew": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": false,
|
||||
|
||||
// Relaxing
|
||||
"es5": false,
|
||||
|
||||
// Environment
|
||||
"browser": true,
|
||||
"jquery": true,
|
||||
|
||||
"globals": {
|
||||
"mediaWiki": false,
|
||||
"OO": false,
|
||||
"ve": false
|
||||
}
|
||||
}
|
40
Gruntfile.js
40
Gruntfile.js
|
@ -2,6 +2,10 @@
|
|||
module.exports = function ( grunt ) {
|
||||
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
||||
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-csslint' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
||||
grunt.loadNpmTasks( 'grunt-jscs' );
|
||||
|
||||
grunt.initConfig( {
|
||||
banana: {
|
||||
|
@ -12,9 +16,43 @@ module.exports = function ( grunt ) {
|
|||
'**/*.json',
|
||||
'!node_modules/**'
|
||||
]
|
||||
},
|
||||
csslint: {
|
||||
options: {
|
||||
csslintrc: '.csslintrc'
|
||||
},
|
||||
all: 'modules/VisualEditor/*.css'
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: true
|
||||
},
|
||||
all: [
|
||||
'*.js',
|
||||
'modules/**/*.js'
|
||||
]
|
||||
},
|
||||
watch: {
|
||||
files: [
|
||||
'.{csslintrc,jscsrc,jshintignore,jshintrc}',
|
||||
'<%= jshint.all %>',
|
||||
'<%= csslint.all %>'
|
||||
],
|
||||
tasks: 'test'
|
||||
},
|
||||
jscs: {
|
||||
fix: {
|
||||
options: {
|
||||
fix: true
|
||||
},
|
||||
src: '<%= jshint.all %>'
|
||||
},
|
||||
main: {
|
||||
src: '<%= jshint.all %>'
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] );
|
||||
grunt.registerTask( 'test', [ 'jshint', 'jscs:main', 'csslint', 'jsonlint', 'banana' ] );
|
||||
grunt.registerTask( 'default', 'test' );
|
||||
};
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"predef": [
|
||||
"mediaWiki",
|
||||
"jQuery"
|
||||
],
|
||||
|
||||
"bitwise": true,
|
||||
"camelcase": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"forin": false,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"quotmark": "single",
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": false,
|
||||
"trailing": true,
|
||||
|
||||
"smarttabs": true,
|
||||
|
||||
"browser": true,
|
||||
|
||||
"nomen": true,
|
||||
"onevar": true
|
||||
}
|
|
@ -45,6 +45,8 @@ ve.ui.MWMathInspector.static.dir = 'ltr';
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWMathInspector.prototype.initialize = function () {
|
||||
var inputField, displayField, idField;
|
||||
|
||||
// Parent method
|
||||
ve.ui.MWMathInspector.super.prototype.initialize.call( this );
|
||||
|
||||
|
@ -71,14 +73,14 @@ ve.ui.MWMathInspector.prototype.initialize = function () {
|
|||
|
||||
this.idInput = new OO.ui.TextInputWidget();
|
||||
|
||||
var inputField = new OO.ui.FieldLayout( this.input, {
|
||||
inputField = new OO.ui.FieldLayout( this.input, {
|
||||
align: 'top',
|
||||
label: ve.msg( 'math-visualeditor-mwmathinspector-title' )
|
||||
} ),
|
||||
} );
|
||||
displayField = new OO.ui.FieldLayout( this.displaySelect, {
|
||||
align: 'top',
|
||||
label: ve.msg( 'math-visualeditor-mwmathinspector-display' )
|
||||
} ),
|
||||
} );
|
||||
idField = new OO.ui.FieldLayout( this.idInput, {
|
||||
align: 'top',
|
||||
label: ve.msg( 'math-visualeditor-mwmathinspector-id' )
|
||||
|
@ -115,10 +117,12 @@ ve.ui.MWMathInspector.prototype.getTeardownProcess = function ( data ) {
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWMathInspector.prototype.updateMwData = function ( mwData ) {
|
||||
var display, id;
|
||||
|
||||
// Parent method
|
||||
ve.ui.MWMathInspector.super.prototype.updateMwData.call( this, mwData );
|
||||
|
||||
var display = this.displaySelect.getSelectedItem().getData(),
|
||||
display = this.displaySelect.getSelectedItem().getData();
|
||||
id = this.idInput.getValue();
|
||||
|
||||
mwData.attrs.display = display !== 'default' ? display : undefined;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
( function ( mw ) {
|
||||
var iconPath;
|
||||
if ( mw.toolbar ) {
|
||||
var iconPath = mw.config.get( 'wgExtensionAssetsPath' ) + '/Math/images/';
|
||||
iconPath = mw.config.get( 'wgExtensionAssetsPath' ) + '/Math/images/';
|
||||
mw.toolbar.addButton( {
|
||||
imageFile: iconPath + 'button_math.png',
|
||||
speedTip: mw.msg( 'math_tip' ),
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
"grunt": "0.4.5",
|
||||
"grunt-cli": "0.1.13",
|
||||
"grunt-banana-checker": "0.2.2",
|
||||
"grunt-jsonlint": "1.0.4"
|
||||
"grunt-jsonlint": "1.0.4",
|
||||
"grunt-contrib-csslint": "0.5.0",
|
||||
"grunt-contrib-jshint": "0.11.3",
|
||||
"grunt-contrib-watch": "0.6.1",
|
||||
"grunt-jscs": "2.1.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue