Skip to content

Commit 322b8aa

Browse files
committed
remove redundant initial of hasOwnProperty part 2
1 parent 00ee80d commit 322b8aa

File tree

8 files changed

+11
-9
lines changed

8 files changed

+11
-9
lines changed

packages/react-dom/src/__tests__/ReactCompositeComponent-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
*
77
* @emails react-core
88
*/
9-
109
'use strict';
1110

11+
import hasOwnProperty from 'shared/hasOwnProperty'
12+
1213
let ChildUpdates;
1314
let MorphingComponent;
1415
let React;
@@ -19,7 +20,6 @@ let ReactTestUtils;
1920
let PropTypes;
2021

2122
describe('ReactCompositeComponent', () => {
22-
const hasOwnProperty = Object.prototype.hasOwnProperty;
2323

2424
/**
2525
* Performs equality by iterating through keys on an object and returning false

packages/react-dom/src/client/ReactDOMComponent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '../events/EventRegistry';
1414

1515
import {canUseDOM} from 'shared/ExecutionEnvironment';
16+
import hasOwnProperty from 'shared/hasOwnProperty';
1617

1718
import {
1819
getValueForAttribute,
@@ -443,7 +444,7 @@ export function createElement(
443444
!isCustomComponentTag &&
444445
Object.prototype.toString.call(domElement) ===
445446
'[object HTMLUnknownElement]' &&
446-
!Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)
447+
!hasOwnProperty.call(warnedUnknownTags, type)
447448
) {
448449
warnedUnknownTags[type] = true;
449450
console.error(

packages/react-dom/src/server/ReactPartialRenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ import warnValidStyle from '../shared/warnValidStyle';
7777
import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook';
7878
import {validateProperties as validateInputProperties} from '../shared/ReactDOMNullInputValuePropHook';
7979
import {validateProperties as validateUnknownProperties} from '../shared/ReactDOMUnknownPropertyHook';
80-
import hasOwnProperty from '../../../shared/hasOwnProperty';
80+
import hasOwnProperty from 'shared/hasOwnProperty';
8181

8282
export type ServerOptions = {
8383
identifierPrefix?: string,

packages/react-dom/src/shared/ReactDOMInvalidARIAHook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import {ATTRIBUTE_NAME_CHAR} from './DOMProperty';
99
import isCustomComponent from './isCustomComponent';
1010
import validAriaProperties from './validAriaProperties';
11-
import hasOwnProperty from '../../../shared/hasOwnProperty';
11+
import hasOwnProperty from 'shared/hasOwnProperty';
1212

1313
const warnedProperties = {};
1414
const rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');

packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from './DOMProperty';
1515
import isCustomComponent from './isCustomComponent';
1616
import possibleStandardNames from './possibleStandardNames';
17-
import hasOwnProperty from '../../../shared/hasOwnProperty';
17+
import hasOwnProperty from 'shared/hasOwnProperty';
1818

1919
let validateProperty = () => {};
2020

packages/react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {Request, ReactModel} from 'react-server/src/ReactFlightServer';
1313

1414
import JSResourceReference from 'JSResourceReference';
1515

16-
import hasOwnProperty from '../../shared/hasOwnProperty';
16+
import hasOwnProperty from 'shared/hasOwnProperty';
1717

1818
export type ModuleReference<T> = JSResourceReference<T>;
1919

packages/react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import type {RowEncoding, JSONValue} from './ReactFlightNativeRelayProtocol';
1111

1212
import type {Request, ReactModel} from 'react-server/src/ReactFlightServer';
13-
import hasOwnProperty from '../../shared/hasOwnProperty';
13+
import hasOwnProperty from 'shared/hasOwnProperty';
1414
import JSResourceReferenceImpl from 'JSResourceReferenceImpl';
1515

1616
export type ModuleReference<T> = JSResourceReferenceImpl<T>;

packages/shared/checkPropTypes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const loggedTypeFailures = {};
1212
import {describeUnknownElementTypeFrameInDEV} from 'shared/ReactComponentStackFrame';
1313

1414
import ReactSharedInternals from 'shared/ReactSharedInternals';
15+
import hasOwnProperty from 'shared/hasOwnProperty';
1516

1617
const ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
1718

@@ -40,7 +41,7 @@ export default function checkPropTypes(
4041
): void {
4142
if (__DEV__) {
4243
// $FlowFixMe This is okay but Flow doesn't know it.
43-
const has = Function.call.bind(Object.prototype.hasOwnProperty);
44+
const has = Function.call.bind(hasOwnProperty);
4445
for (const typeSpecName in typeSpecs) {
4546
if (has(typeSpecs, typeSpecName)) {
4647
let error;

0 commit comments

Comments
 (0)