diff --git a/packages/react-reconciler/src/ReactFiber.js b/packages/react-reconciler/src/ReactFiber.js index 64e230a891d6..4f0af6fe331e 100644 --- a/packages/react-reconciler/src/ReactFiber.js +++ b/packages/react-reconciler/src/ReactFiber.js @@ -101,13 +101,10 @@ if (__DEV__) { hasBadMapPolyfill = false; try { const nonExtensibleObject = Object.preventExtensions({}); - const testMap = new Map([[nonExtensibleObject, null]]); - const testSet = new Set([nonExtensibleObject]); - // This is necessary for Rollup to not consider these unused. - // https://github.com/rollup/rollup/issues/1771 - // TODO: we can remove these if Rollup fixes the bug. - testMap.set(0, 0); - testSet.add(0); + /* eslint-disable no-new */ + new Map([[nonExtensibleObject, null]]); + new Set([nonExtensibleObject]); + /* eslint-enable no-new */ } catch (e) { // TODO: Consider warning about bad polyfills hasBadMapPolyfill = true; diff --git a/packages/react/src/BadMapPolyfill.js b/packages/react/src/BadMapPolyfill.js index 7ceb9ca65f9a..9cad26144490 100644 --- a/packages/react/src/BadMapPolyfill.js +++ b/packages/react/src/BadMapPolyfill.js @@ -12,13 +12,10 @@ if (__DEV__) { hasBadMapPolyfill = false; try { const frozenObject = Object.freeze({}); - const testMap = new Map([[frozenObject, null]]); - const testSet = new Set([frozenObject]); - // This is necessary for Rollup to not consider these unused. - // https://github.com/rollup/rollup/issues/1771 - // TODO: we can remove these if Rollup fixes the bug. - testMap.set(0, 0); - testSet.add(0); + /* eslint-disable no-new */ + new Map([[frozenObject, null]]); + new Set([frozenObject]); + /* eslint-enable no-new */ } catch (e) { // TODO: Consider warning about bad polyfills hasBadMapPolyfill = true;