From: James D. Forrester Date: Fri, 6 Jul 2018 00:36:01 +0000 (-0700) Subject: build: Enable and make pass no-prototype-builtins X-Git-Tag: 1.34.0-rc.0~4858^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/One?a=commitdiff_plain;h=70fe08d2df8240ee01e8eb3d692efc2a61570c15;p=lhc%2Fweb%2Fwiklou.git build: Enable and make pass no-prototype-builtins Change-Id: I26a98be16c005c1c864ec592e1a41b44943f8f29 --- diff --git a/.eslintrc.json b/.eslintrc.json index e369640751..844895d12c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,7 +12,6 @@ }, "rules": { "dot-notation": 0, - "max-len": 0, - "no-prototype-builtins": 0 + "max-len": 0 } } diff --git a/resources/src/jquery.tablesorter/jquery.tablesorter.js b/resources/src/jquery.tablesorter/jquery.tablesorter.js index 552c0c394f..9417669dde 100644 --- a/resources/src/jquery.tablesorter/jquery.tablesorter.js +++ b/resources/src/jquery.tablesorter/jquery.tablesorter.js @@ -724,7 +724,7 @@ // Build array of key names for ( key in ts.collationTable ) { // Check hasOwn to be safe - if ( ts.collationTable.hasOwnProperty( key ) ) { + if ( Object.prototype.hasOwnProperty.call( ts.collationTable, key ) ) { keys.push( mw.RegExp.escape( key ) ); } } diff --git a/resources/src/mediawiki.Title/Title.js b/resources/src/mediawiki.Title/Title.js index 2b76187359..c02af984d8 100644 --- a/resources/src/mediawiki.Title/Title.js +++ b/resources/src/mediawiki.Title/Title.js @@ -748,7 +748,7 @@ tiff: 'tif', ogv: 'ogg' }; - if ( squish.hasOwnProperty( lower ) ) { + if ( Object.prototype.hasOwnProperty.call( squish, lower ) ) { return squish[ lower ]; } else if ( /^[0-9a-z]+$/.test( lower ) ) { return lower; diff --git a/resources/src/mediawiki.Uri/Uri.js b/resources/src/mediawiki.Uri/Uri.js index 7467d50816..eb7cff0c66 100644 --- a/resources/src/mediawiki.Uri/Uri.js +++ b/resources/src/mediawiki.Uri/Uri.js @@ -195,7 +195,7 @@ // Copy data over from existing URI object for ( prop in uri ) { // Only copy direct properties, not inherited ones - if ( uri.hasOwnProperty( prop ) ) { + if ( Object.prototype.hasOwnProperty.call( uri, prop ) ) { // Deep copy object properties if ( Array.isArray( uri[ prop ] ) || $.isPlainObject( uri[ prop ] ) ) { this[ prop ] = $.extend( true, {}, uri[ prop ] ); diff --git a/resources/src/mediawiki.api/upload.js b/resources/src/mediawiki.api/upload.js index 29bd59aed9..a6451ac851 100644 --- a/resources/src/mediawiki.api/upload.js +++ b/resources/src/mediawiki.api/upload.js @@ -40,7 +40,7 @@ function getFirstKey( obj ) { var key; for ( key in obj ) { - if ( obj.hasOwnProperty( key ) ) { + if ( Object.prototype.hasOwnProperty.call( obj, key ) ) { return key; } } diff --git a/resources/src/mediawiki.debug/debug.js b/resources/src/mediawiki.debug/debug.js index 3f5a5dba7a..dfb6967958 100644 --- a/resources/src/mediawiki.debug/debug.js +++ b/resources/src/mediawiki.debug/debug.js @@ -221,7 +221,7 @@ }; for ( id in panes ) { - if ( !panes.hasOwnProperty( id ) ) { + if ( !Object.prototype.hasOwnProperty.call( panes, id ) ) { continue; } @@ -350,7 +350,7 @@ .appendTo( $table ); for ( key in data ) { - if ( !data.hasOwnProperty( key ) ) { + if ( !Object.prototype.hasOwnProperty.call( data, key ) ) { continue; } diff --git a/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js b/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js index 4f9e43a4cc..437800a047 100644 --- a/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js +++ b/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js @@ -311,7 +311,7 @@ getAst: function ( key ) { var wikiText; - if ( !this.astCache.hasOwnProperty( key ) ) { + if ( !Object.prototype.hasOwnProperty.call( this.astCache, key ) ) { wikiText = this.settings.messages.get( key ); if ( typeof wikiText !== 'string' ) { wikiText = '⧼' + key + '⧽'; @@ -1358,7 +1358,7 @@ return oldParser.apply( this ); } - if ( !this.map.hasOwnProperty( this.format ) ) { + if ( !Object.prototype.hasOwnProperty.call( this.map, this.format ) ) { this.map[ this.format ] = mw.jqueryMsg.getMessageFunction( { messages: this.map, // For format 'escaped', escaping part is handled by mediawiki.js diff --git a/resources/src/mediawiki.language/mediawiki.language.numbers.js b/resources/src/mediawiki.language/mediawiki.language.numbers.js index 267210c658..4360adc0cc 100644 --- a/resources/src/mediawiki.language/mediawiki.language.numbers.js +++ b/resources/src/mediawiki.language/mediawiki.language.numbers.js @@ -179,7 +179,7 @@ for ( i = 0; i < arguments.length; i++ ) { table = arguments[ i ]; for ( key in table ) { - if ( table.hasOwnProperty( key ) ) { + if ( Object.prototype.hasOwnProperty.call( table, key ) ) { // The thousand separator should be deleted flipped[ table[ key ] ] = key === ',' ? '' : key; } @@ -234,7 +234,7 @@ if ( transformTable ) { convertedNumber = ''; for ( i = 0; i < numberString.length; i++ ) { - if ( transformTable.hasOwnProperty( numberString[ i ] ) ) { + if ( Object.prototype.hasOwnProperty.call( transformTable, numberString[ i ] ) ) { convertedNumber += transformTable[ numberString[ i ] ]; } else { convertedNumber += numberString[ i ]; diff --git a/resources/src/mediawiki.page.watch.ajax.js b/resources/src/mediawiki.page.watch.ajax.js index 5b41876dbd..097653d1cb 100644 --- a/resources/src/mediawiki.page.watch.ajax.js +++ b/resources/src/mediawiki.page.watch.ajax.js @@ -90,7 +90,7 @@ actionPaths = mw.config.get( 'wgActionPaths' ); for ( key in actionPaths ) { - if ( actionPaths.hasOwnProperty( key ) ) { + if ( Object.prototype.hasOwnProperty.call( actionPaths, key ) ) { parts = actionPaths[ key ].split( '$1' ); parts = parts.map( mw.RegExp.escape ); m = new RegExp( parts.join( '(.+)' ) ).exec( url ); diff --git a/resources/src/mediawiki.special.apisandbox/apisandbox.js b/resources/src/mediawiki.special.apisandbox/apisandbox.js index f936658ff3..7c0d2324ab 100644 --- a/resources/src/mediawiki.special.apisandbox/apisandbox.js +++ b/resources/src/mediawiki.special.apisandbox/apisandbox.js @@ -318,7 +318,7 @@ var apiPromise, deferred = $.Deferred(); - if ( moduleInfoCache.hasOwnProperty( module ) ) { + if ( Object.prototype.hasOwnProperty.call( moduleInfoCache, module ) ) { return deferred .resolve( moduleInfoCache[ module ] ) .promise( { abort: function () {} } ); @@ -373,7 +373,7 @@ subpages = page.getSubpages(); for ( i = 0; i < subpages.length; i++ ) { - if ( pages.hasOwnProperty( subpages[ i ].key ) ) { + if ( Object.prototype.hasOwnProperty.call( pages, subpages[ i ].key ) ) { checkPages.push( pages[ subpages[ i ].key ] ); } } @@ -917,7 +917,7 @@ if ( page.getSubpages ) { subpages = page.getSubpages(); for ( j = 0; j < subpages.length; j++ ) { - if ( !pages.hasOwnProperty( subpages[ j ].key ) ) { + if ( !Object.prototype.hasOwnProperty.call( pages, subpages[ j ].key ) ) { subpages[ j ].indentLevel = page.indentLevel + 1; pages[ subpages[ j ].key ] = new ApiSandbox.PageLayout( subpages[ j ] ); } @@ -993,7 +993,7 @@ page.getQueryParams( params, displayParams ); subpages = page.getSubpages(); for ( i = 0; i < subpages.length; i++ ) { - if ( pages.hasOwnProperty( subpages[ i ].key ) ) { + if ( Object.prototype.hasOwnProperty.call( pages, subpages[ i ].key ) ) { checkPages.push( pages[ subpages[ i ].key ] ); } } @@ -1069,7 +1069,7 @@ // Force a 'fm' format with wrappedhtml=1, if available if ( params.format !== undefined ) { - if ( availableFormats.hasOwnProperty( params.format + 'fm' ) ) { + if ( Object.prototype.hasOwnProperty.call( availableFormats, params.format + 'fm' ) ) { params.format = params.format + 'fm'; } if ( params.format.substr( -2 ) === 'fm' ) { @@ -1300,7 +1300,7 @@ subpages = page.getSubpages(); for ( i = 0; i < subpages.length; i++ ) { - if ( pages.hasOwnProperty( subpages[ i ].key ) ) { + if ( Object.prototype.hasOwnProperty.call( pages, subpages[ i ].key ) ) { checkPages.push( pages[ subpages[ i ].key ] ); } } @@ -1321,7 +1321,7 @@ page.apiCheckValid(); subpages = page.getSubpages(); for ( i = 0; i < subpages.length; i++ ) { - if ( pages.hasOwnProperty( subpages[ i ].key ) ) { + if ( Object.prototype.hasOwnProperty.call( pages, subpages[ i ].key ) ) { checkPages.push( pages[ subpages[ i ].key ] ); } } @@ -1678,7 +1678,7 @@ } } if ( params ) { - tmp.widget.setApiValue( params.hasOwnProperty( name ) ? params[ name ] : undefined ); + tmp.widget.setApiValue( Object.prototype.hasOwnProperty.call( params, name ) ? params[ name ] : undefined ); } } else { newVars = {}; @@ -1785,7 +1785,7 @@ buttons = [], filterFmModules = function ( v ) { return v.substr( -2 ) !== 'fm' || - !availableFormats.hasOwnProperty( v.substr( 0, v.length - 2 ) ); + !Object.prototype.hasOwnProperty.call( availableFormats, v.substr( 0, v.length - 2 ) ); }; // This is something of a hack. We always want the 'format' and @@ -2017,7 +2017,7 @@ this.loadFromQueryParams = params; } else { $.each( this.widgets, function ( name, widget ) { - var v = params.hasOwnProperty( name ) ? params[ name ] : undefined; + var v = Object.prototype.hasOwnProperty.call( params, name ) ? params[ name ] : undefined; widget.setApiValue( v ); } ); this.updateTemplatedParameters( params ); diff --git a/resources/src/mediawiki.special.upload/upload.js b/resources/src/mediawiki.special.upload/upload.js index 144659a7fb..da54ad2795 100644 --- a/resources/src/mediawiki.special.upload/upload.js +++ b/resources/src/mediawiki.special.upload/upload.js @@ -37,7 +37,7 @@ clearTimeout( this.timeoutID ); } // Check response cache - if ( this.responseCache.hasOwnProperty( this.nameToCheck ) ) { + if ( Object.prototype.hasOwnProperty.call( this.responseCache, this.nameToCheck ) ) { this.setWarning( this.responseCache[ this.nameToCheck ] ); return; } @@ -126,7 +126,7 @@ var template = $element.val(), $spinner; - if ( this.responseCache.hasOwnProperty( template ) ) { + if ( Object.prototype.hasOwnProperty.call( this.responseCache, template ) ) { this.showPreview( this.responseCache[ template ], $previewContainer ); return; } diff --git a/resources/src/mediawiki.visibleTimeout.js b/resources/src/mediawiki.visibleTimeout.js index e2bbd6832d..bac06746d0 100644 --- a/resources/src/mediawiki.visibleTimeout.js +++ b/resources/src/mediawiki.visibleTimeout.js @@ -101,7 +101,7 @@ * corresponding call to set(). */ clear: function ( visibleTimeoutId ) { - if ( activeTimeouts.hasOwnProperty( visibleTimeoutId ) ) { + if ( Object.prototype.hasOwnProperty.call( activeTimeouts, visibleTimeoutId ) ) { activeTimeouts[ visibleTimeoutId ](); } } diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js index 2340f9cfe5..6ee9595fce 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js @@ -102,7 +102,7 @@ var api = this.getApi(), cache = this.constructor.static.interwikiPrefixesPromiseCache, key = api.defaults.ajax.url; - if ( !cache.hasOwnProperty( key ) ) { + if ( !Object.prototype.hasOwnProperty.call( cache, key ) ) { cache[ key ] = api.get( { action: 'query', meta: 'siteinfo',