From 7bd2a6174ecfe3b51c997dc34ab723203fa2bacd Mon Sep 17 00:00:00 2001 From: Mohammad Aziz Date: Sun, 28 Jul 2019 00:34:48 +0530 Subject: [PATCH] Remove unnecessary lines for `hasBadMapPolyfill` issue for rollup --- packages/react-reconciler/src/ReactFiber.js | 11 ++++------- packages/react/src/BadMapPolyfill.js | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) 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;