Make JSHint enforce ES3 compatibility

Also fix ES3 compatibility errors.
Upstreamed issue with sinon.stub().throws():
https://github.com/cjohansen/Sinon.JS/issues/488

Change-Id: I93b0d575484089b293d94ea860d245def4646cb4
This commit is contained in:
Gergő Tisza 2014-05-28 22:43:35 +00:00
parent 91e0a176ba
commit f9d06141f4
10 changed files with 15 additions and 14 deletions

View file

@ -22,6 +22,7 @@
// Enforcing
"bitwise": true,
"es3": true,
// Relaxing
"laxbreak": true,
"smarttabs": true,

View file

@ -115,7 +115,7 @@
* @returns {number} Sampling factor
*/
L.getActionFactor = function ( action ) {
return this.samplingFactorMap[ action ] || this.samplingFactorMap.default;
return this.samplingFactorMap[ action ] || this.samplingFactorMap['default'];
};
/**

View file

@ -66,7 +66,7 @@
this.tabs = {
share: new mw.mmv.ui.reuse.Share( this.$reuseDialog ),
download: new mw.mmv.ui.reuse.Download( this.$reuseDialog ),
embed: new mw.mmv.ui.reuse.Embed( this.$reuseDialog ),
embed: new mw.mmv.ui.reuse.Embed( this.$reuseDialog )
};
shareTab = new oo.ui.MenuItemWidget(

View file

@ -13,7 +13,7 @@
this.sandbox.stub( logger, 'loadDependencies' ).returns( $.Deferred().resolve() );
this.sandbox.stub( mw, 'log' );
logger.samplingFactorMap = { default : 1 };
logger.samplingFactorMap = { 'default' : 1 };
logger.setEventLog( fakeEventLog );
logger.logActions = {};
logger.logActions[ action1key ] = action1value;

View file

@ -118,7 +118,7 @@
this.sandbox.stub( mw.loader, 'using' );
mw.loader.using.withArgs( [ 'ext.eventLogging', 'schema.MultimediaViewerDuration' ] ).throws( 'EventLogging is missing' );
mw.loader.using.withArgs( [ 'ext.eventLogging', 'schema.MultimediaViewerDuration' ] )['throws']( 'EventLogging is missing' );
promise = durationLogger.loadDependencies();
@ -128,7 +128,7 @@
mw.loader.using.restore();
this.sandbox.stub( mw.loader, 'using' );
mw.loader.using.withArgs( [ 'ext.eventLogging', 'schema.MultimediaViewerDuration' ] ).throws( 'EventLogging is missing' );
mw.loader.using.withArgs( [ 'ext.eventLogging', 'schema.MultimediaViewerDuration' ] )['throws']( 'EventLogging is missing' );
promise = durationLogger.loadDependencies();

View file

@ -372,7 +372,7 @@
animateTo : this.sandbox.stub(),
jumpTo : this.sandbox.stub()
},
empty: $.noop,
empty: $.noop
},
open : $.noop,
empty: $.noop };

View file

@ -156,7 +156,7 @@
} );
QUnit.asyncTest( 'GlobalUsage useApi test', 3, function ( assert ) {
var api = { get: this.sandbox.stub().throws( 'API was invoked' ) },
var api = { get: this.sandbox.stub()['throws']( 'API was invoked' ) },
options = { useApi: false },
file = new mw.Title( 'File:Stuff.jpg' ),
globalUsageProvider = new mw.mmv.provider.GlobalUsage( api, options );

View file

@ -150,7 +150,7 @@
} );
QUnit.asyncTest( 'UserInfo fake test', 4, function ( assert ) {
var api = { get: this.sandbox.stub().throws( 'API was invoked' ) },
var api = { get: this.sandbox.stub()['throws']( 'API was invoked' ) },
username = 'Catrope',
repoInfo = {},
userInfoProvider = new mw.mmv.provider.UserInfo( api, { useApi: false } );

View file

@ -119,7 +119,7 @@
canvas = new mw.mmv.ui.Canvas( $qf );
imageRawMetadata.filePageTitle = {
getExtension: function() { return 'svg'; },
getExtension: function() { return 'svg'; }
};
canvas.imageRawMetadata = imageRawMetadata;
@ -149,7 +149,7 @@
canvas = new mw.mmv.ui.Canvas( $qf );
imageRawMetadata.filePageTitle = {
getExtension: function() { return 'png'; },
getExtension: function() { return 'png'; }
};
canvas.imageRawMetadata = imageRawMetadata;
@ -179,7 +179,7 @@
canvas = new mw.mmv.ui.Canvas( $qf );
imageRawMetadata.filePageTitle = {
getExtension: function() { return 'png'; },
getExtension: function() { return 'png'; }
};
canvas.imageRawMetadata = imageRawMetadata;
@ -209,7 +209,7 @@
canvas = new mw.mmv.ui.Canvas( $qf );
imageRawMetadata.filePageTitle = {
getExtension: function() { return 'png'; },
getExtension: function() { return 'png'; }
};
canvas.imageRawMetadata = imageRawMetadata;
@ -239,7 +239,7 @@
canvas = new mw.mmv.ui.Canvas( $qf );
imageRawMetadata.filePageTitle = {
getExtension: function() { return 'png'; },
getExtension: function() { return 'png'; }
};
canvas.imageRawMetadata = imageRawMetadata;

View file

@ -15,7 +15,7 @@
'$usernameLi',
'$locationLi',
'$repoLi',
'$datetimeLi',
'$datetimeLi'
];
QUnit.module( 'mmv.ui.metadataPanel', QUnit.newMwEnvironment() );