eslint: Enforce no-prototype-builtins

Change-Id: I4244f0576e48c233d24533b45a28c07b2531d6da
This commit is contained in:
Ed Sanders 2019-08-05 13:38:14 +01:00 committed by Jforrester
parent 2687d12c52
commit cfa0b100ad
6 changed files with 6 additions and 6 deletions

View file

@ -18,7 +18,6 @@
"OO": "readonly" "OO": "readonly"
}, },
"rules": { "rules": {
"no-prototype-builtins": "off",
"no-use-before-define": "off", "no-use-before-define": "off",
"template-curly-spacing": "off" "template-curly-spacing": "off"
} }

Binary file not shown.

Binary file not shown.

View file

@ -41,7 +41,7 @@ export default function createContainer() {
* `false` * `false`
*/ */
has( name ) { has( name ) {
return factories.hasOwnProperty( name ); return Object.prototype.hasOwnProperty.call( factories, name );
}, },
/** /**
@ -82,7 +82,7 @@ export default function createContainer() {
return factory; return factory;
} }
if ( !cache.hasOwnProperty( name ) ) { if ( !Object.prototype.hasOwnProperty.call( cache, name ) ) {
cache[ name ] = factories[ name ]( this ); cache[ name ] = factories[ name ]( this );
} }

View file

@ -20,15 +20,16 @@
*/ */
export default function nextState( state, updates ) { export default function nextState( state, updates ) {
const result = {}; const result = {};
const hasOwn = Object.prototype.hasOwnProperty;
for ( const key in state ) { for ( const key in state ) {
if ( state.hasOwnProperty( key ) && !updates.hasOwnProperty( key ) ) { if ( hasOwn.call( state, key ) && !hasOwn.call( updates, key ) ) {
result[ key ] = state[ key ]; result[ key ] = state[ key ];
} }
} }
for ( const key in updates ) { for ( const key in updates ) {
if ( updates.hasOwnProperty( key ) ) { if ( hasOwn.call( updates, key ) ) {
result[ key ] = updates[ key ]; result[ key ] = updates[ key ];
} }
} }

View file

@ -54,7 +54,7 @@ export function getTitle( href, config ) {
} catch ( e ) { } catch ( e ) {
// Will return undefined below // Will return undefined below
} }
} else if ( queryLength === 1 && linkHref.query.hasOwnProperty( 'title' ) ) { } else if ( queryLength === 1 && 'title' in linkHref.query ) {
// URL is not pretty, but only has a `title` parameter // URL is not pretty, but only has a `title` parameter
title = linkHref.query.title; title = linkHref.query.title;
} }