.eslintrc: Enable and fix "max-statements-per-line": 1

I am surprised this was disabled. I investigated this after reviewing
some code by a new contributor which I was certain should have failed
the lint check, but passed.

Change-Id: I5b3c837b8ca3292f6e268b3922443bd9587eadbe
This commit is contained in:
Bartosz Dziewoński 2018-10-30 00:19:16 +01:00
parent 4e539c8e3d
commit e7fd1ac847
5 changed files with 26 additions and 9 deletions

View file

@ -16,6 +16,7 @@
},
"rules": {
"dot-notation": [ "error", { "allowKeywords": true } ],
"max-statements-per-line": [ "error", { "max": 1 } ],
"max-len": 0,
"valid-jsdoc": 0
}

View file

@ -359,10 +359,20 @@ ve.dm.MWLanguageVariantNode.prototype.getRuleType = function () {
* @return {string}
*/
ve.dm.MWLanguageVariantNode.static.getRuleType = function ( variantInfo ) {
if ( variantInfo.disabled ) { return 'disabled'; }
if ( variantInfo.filter ) { return 'filter'; }
if ( variantInfo.name ) { return 'name'; }
if ( variantInfo.twoway ) { return 'twoway'; }
if ( variantInfo.oneway ) { return 'oneway'; }
if ( variantInfo.disabled ) {
return 'disabled';
}
if ( variantInfo.filter ) {
return 'filter';
}
if ( variantInfo.name ) {
return 'name';
}
if ( variantInfo.twoway ) {
return 'twoway';
}
if ( variantInfo.oneway ) {
return 'oneway';
}
return 'unknown'; // should never happen
};

View file

@ -60,7 +60,9 @@ QUnit.test( 'handleLinearDelete', function ( assert ) {
} );
} );
promise.finally( function () { done(); } );
promise.finally( function () {
done();
} );
} );
QUnit.test( 'beforePaste/afterPaste', function ( assert ) {

View file

@ -25,7 +25,9 @@
this.imageInfoCache = null;
}
OO.inheritClass( MWDummyPlatform, ve.init.mw.Platform );
MWDummyPlatform.prototype.getMessage = function () { return Array.prototype.join.call( arguments, ',' ); };
MWDummyPlatform.prototype.getMessage = function () {
return Array.prototype.join.call( arguments, ',' );
};
MWDummyPlatform.prototype.getHtmlMessage = function () {
var $wrapper = $( '<div>' );
Array.prototype.forEach.call( arguments, function ( arg, i, args ) {

View file

@ -595,7 +595,8 @@ ve.ui.MWLanguageVariantTwoWayInspector.prototype.getDefaultVariantInfo = functio
ve.ui.MWLanguageVariantTwoWayInspector.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWLanguageVariantTwoWayInspector.super.prototype.getSetupProcess.call( this, data ).next( function () {
var variantInfo = this.variantNode.getVariantInfo();
this.layout.clearItems(); this.items = [];
this.layout.clearItems();
this.items = [];
variantInfo.twoway.forEach( function ( tw, idx ) {
this.items[ idx ] = this.createItem( tw.l, tw.t );
this.layout.addItems( [ this.items[ idx ].layout ] );
@ -745,7 +746,8 @@ ve.ui.MWLanguageVariantOneWayInspector.prototype.getDefaultVariantInfo = functio
ve.ui.MWLanguageVariantOneWayInspector.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWLanguageVariantOneWayInspector.super.prototype.getSetupProcess.call( this, data ).next( function () {
var variantInfo = this.variantNode.getVariantInfo();
this.layout.clearItems(); this.items = [];
this.layout.clearItems();
this.items = [];
variantInfo.oneway.forEach( function ( ow, idx ) {
this.items[ idx ] = this.createItem( ow.f, ow.l, ow.t );
this.layout.addItems( [ this.items[ idx ].layout ] );