From 54930b19d447638b83c0810af0fbfcbfd2a1fd13 Mon Sep 17 00:00:00 2001 From: pcvonz Date: Thu, 2 Aug 2018 08:04:49 -0700 Subject: [PATCH 1/2] Switch back to default pragma - Switched import { Component, createElement } from 'react';) to import React from 'react', { Component }; - Switched import { Fragment, createElement } from 'react';) to import React from 'react', { Fragment }; - Switched import { createElement } from 'react';) to import React from 'react'; - Added `eslint-plugin-react` and updated eslint configuration accordingly Update eslintrc and remove react imports from components which have no jsx Add Component import back to ContainerChild.js chore: Update .babelrc and rm redundant files Switch to correct React import prettify! :heart: chore: update eslint-config with pcvonz fisx --- package-lock.json | 351 ++++++++++++------ package.json | 2 +- packages/peregrine/.babelrc | 4 +- .../src/ContainerChild/ContainerChild.js | 2 +- .../__stories__/ContainerChild.js | 2 +- .../__tests__/ContainerChild.test.js | 2 +- .../peregrine/src/List/__stories__/item.js | 2 +- .../peregrine/src/List/__stories__/items.js | 2 +- .../peregrine/src/List/__stories__/list.js | 2 +- .../peregrine/src/List/__tests__/item.spec.js | 2 +- .../src/List/__tests__/items.spec.js | 2 +- .../peregrine/src/List/__tests__/list.spec.js | 2 +- packages/peregrine/src/List/item.js | 2 +- packages/peregrine/src/List/items.js | 2 +- packages/peregrine/src/List/list.js | 2 +- packages/peregrine/src/Peregrine/Peregrine.js | 2 +- .../src/Peregrine/__tests__/Peregrine.test.js | 2 +- packages/peregrine/src/Price/Price.js | 2 +- .../peregrine/src/Price/__stories__/Price.js | 2 +- .../src/Price/__tests__/Price.spec.js | 2 +- .../src/Router/MagentoRouteHandler.js | 2 +- packages/peregrine/src/Router/Router.js | 2 +- .../__tests__/MagentoRouteHandler.test.js | 2 +- .../src/Router/__tests__/Router.test.js | 2 +- .../src/util/__tests__/fromRenderProp.spec.js | 2 +- packages/peregrine/src/util/fromRenderProp.js | 7 +- packages/venia-concept/.babelrc | 7 +- packages/venia-concept/babel.config.js | 2 +- .../src/RootComponents/CMS/CMS.js | 2 +- .../src/RootComponents/Category/category.js | 2 +- .../src/RootComponents/Product/Product.js | 2 +- packages/venia-concept/src/classify.js | 2 +- .../src/components/Button/button.js | 2 +- .../components/CategoryList/categoryList.js | 2 +- .../src/components/Checkout/checkoutButton.js | 2 +- .../src/components/Checkout/entrance.js | 2 +- .../src/components/Checkout/exit.js | 2 +- .../src/components/Checkout/flow.js | 2 +- .../src/components/Checkout/form.js | 2 +- .../src/components/Checkout/resetButton.js | 2 +- .../src/components/Checkout/section.js | 2 +- .../src/components/Checkout/submitButton.js | 2 +- .../src/components/Checkout/wrapper.js | 2 +- .../src/components/Footer/footer.js | 2 +- .../Gallery/__tests__/gallery.spec.js | 2 +- .../components/Gallery/__tests__/item.spec.js | 2 +- .../Gallery/__tests__/items.spec.js | 2 +- .../src/components/Gallery/gallery.js | 2 +- .../src/components/Gallery/item.js | 2 +- .../src/components/Gallery/items.js | 2 +- .../src/components/Header/cartTrigger.js | 2 +- .../src/components/Header/header.js | 2 +- .../src/components/Header/navTrigger.js | 2 +- .../venia-concept/src/components/Home/home.js | 2 +- .../venia-concept/src/components/Icon/icon.js | 2 +- .../venia-concept/src/components/Main/main.js | 2 +- .../src/components/MiniCart/miniCart.js | 2 +- .../src/components/MiniCart/product.js | 2 +- .../src/components/MiniCart/productList.js | 2 +- .../src/components/MiniCart/trigger.js | 2 +- .../src/components/Navigation/navigation.js | 2 +- .../src/components/Navigation/tile.js | 2 +- .../src/components/Navigation/trigger.js | 2 +- .../src/components/NotFound/notFound.js | 2 +- .../venia-concept/src/components/Page/mask.js | 2 +- .../venia-concept/src/components/Page/page.js | 2 +- .../ProductFullDetail/ProductFullDetail.js | 2 +- .../ProductImageCarousel/carousel.js | 2 +- .../ProductImageCarousel/thumbnail.js | 2 +- .../ProductImageCarousel/thumbnailList.js | 2 +- .../src/components/ProductOptions/option.js | 2 +- .../src/components/ProductOptions/options.js | 2 +- .../src/components/ProductOptions/swatch.js | 2 +- .../components/ProductOptions/swatchList.js | 2 +- .../src/components/ProductOptions/tile.js | 2 +- .../src/components/ProductOptions/tileList.js | 2 +- .../components/ProductQuantity/quantity.js | 2 +- .../src/components/RichText/richText.js | 2 +- .../src/components/Select/option.js | 2 +- .../src/components/Select/select.js | 2 +- packages/venia-concept/src/index.js | 2 +- .../src/util/__tests__/fromRenderProp.spec.js | 55 --- .../venia-concept/src/util/fromRenderProp.js | 40 -- 83 files changed, 319 insertions(+), 299 deletions(-) delete mode 100644 packages/venia-concept/src/util/__tests__/fromRenderProp.spec.js delete mode 100644 packages/venia-concept/src/util/fromRenderProp.js diff --git a/package-lock.json b/package-lock.json index 063433838b..4d20ca2d69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10345,21 +10345,25 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "resolved": false, + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "aproba": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "bundled": true, + "resolved": false, + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "optional": true, "requires": { "delegates": "^1.0.0", @@ -10368,11 +10372,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "resolved": false, + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "brace-expansion": { "version": "1.1.11", - "bundled": true, + "resolved": false, + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -10380,29 +10386,35 @@ }, "chownr": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true + "resolved": false, + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "concat-map": { "version": "0.0.1", - "bundled": true + "resolved": false, + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "resolved": false, + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "optional": true }, "debug": { "version": "2.6.9", - "bundled": true, + "resolved": false, + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "optional": true, "requires": { "ms": "2.0.0" @@ -10410,22 +10422,26 @@ }, "deep-extend": { "version": "0.5.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "optional": true }, "fs-minipass": { "version": "1.2.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -10433,12 +10449,14 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": false, + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "optional": true, "requires": { "aproba": "^1.0.3", @@ -10453,7 +10471,8 @@ }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "optional": true, "requires": { "fs.realpath": "^1.0.0", @@ -10466,12 +10485,14 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "optional": true }, "iconv-lite": { "version": "0.4.21", - "bundled": true, + "resolved": false, + "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", "optional": true, "requires": { "safer-buffer": "^2.1.0" @@ -10479,7 +10500,8 @@ }, "ignore-walk": { "version": "3.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "optional": true, "requires": { "minimatch": "^3.0.4" @@ -10487,7 +10509,8 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": false, + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "optional": true, "requires": { "once": "^1.3.0", @@ -10496,39 +10519,46 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "resolved": false, + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "requires": { "number-is-nan": "^1.0.0" } }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "optional": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "resolved": false, + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minipass": { "version": "2.2.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -10536,7 +10566,8 @@ }, "minizlib": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -10544,19 +10575,22 @@ }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" } }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "optional": true }, "needle": { "version": "2.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", "optional": true, "requires": { "debug": "^2.1.2", @@ -10566,7 +10600,8 @@ }, "node-pre-gyp": { "version": "0.10.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", "optional": true, "requires": { "detect-libc": "^1.0.2", @@ -10583,7 +10618,8 @@ }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "optional": true, "requires": { "abbrev": "1", @@ -10592,12 +10628,14 @@ }, "npm-bundled": { "version": "1.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", "optional": true }, "npm-packlist": { "version": "1.1.10", - "bundled": true, + "resolved": false, + "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", "optional": true, "requires": { "ignore-walk": "^3.0.1", @@ -10606,7 +10644,8 @@ }, "npmlog": { "version": "4.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "optional": true, "requires": { "are-we-there-yet": "~1.1.2", @@ -10617,33 +10656,39 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "resolved": false, + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { "wrappy": "1" } }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "optional": true }, "osenv": { "version": "0.1.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "optional": true, "requires": { "os-homedir": "^1.0.0", @@ -10652,17 +10697,20 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "optional": true }, "process-nextick-args": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "optional": true }, "rc": { "version": "1.2.7", - "bundled": true, + "resolved": false, + "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", "optional": true, "requires": { "deep-extend": "^0.5.1", @@ -10673,14 +10721,16 @@ "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "optional": true } } }, "readable-stream": { "version": "2.3.6", - "bundled": true, + "resolved": false, + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "optional": true, "requires": { "core-util-is": "~1.0.0", @@ -10694,7 +10744,8 @@ }, "rimraf": { "version": "2.6.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "optional": true, "requires": { "glob": "^7.0.5" @@ -10702,36 +10753,43 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "resolved": false, + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "safer-buffer": { "version": "2.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "optional": true }, "sax": { "version": "1.2.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "optional": true }, "semver": { "version": "5.5.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "optional": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -10740,7 +10798,8 @@ }, "string_decoder": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "optional": true, "requires": { "safe-buffer": "~5.1.0" @@ -10748,19 +10807,22 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" } }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "optional": true }, "tar": { "version": "4.4.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", "optional": true, "requires": { "chownr": "^1.0.1", @@ -10774,12 +10836,14 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "optional": true }, "wide-align": { "version": "1.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "optional": true, "requires": { "string-width": "^1.0.2" @@ -10787,11 +10851,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "resolved": false, + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "yallist": { "version": "3.0.2", - "bundled": true + "resolved": false, + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" } } }, @@ -17013,17 +17079,20 @@ "dependencies": { "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "cross-spawn": { "version": "5.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { "lru-cache": "^4.0.1", @@ -17033,12 +17102,14 @@ }, "decamelize": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "execa": { "version": "0.7.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { "cross-spawn": "^5.0.1", @@ -17052,7 +17123,8 @@ }, "find-up": { "version": "2.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { "locate-path": "^2.0.0" @@ -17060,22 +17132,26 @@ }, "get-caller-file": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", "dev": true }, "get-stream": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "invert-kv": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { "number-is-nan": "^1.0.0" @@ -17083,17 +17159,20 @@ }, "is-stream": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "isexe": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "lcid": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { "invert-kv": "^1.0.0" @@ -17101,7 +17180,8 @@ }, "locate-path": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { "p-locate": "^2.0.0", @@ -17110,7 +17190,8 @@ }, "lru-cache": { "version": "4.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { "pseudomap": "^1.0.2", @@ -17119,7 +17200,8 @@ }, "mem": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { "mimic-fn": "^1.0.0" @@ -17127,17 +17209,20 @@ }, "mimic-fn": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": false, + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" @@ -17145,7 +17230,8 @@ }, "npm-run-path": { "version": "2.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { "path-key": "^2.0.0" @@ -17153,12 +17239,14 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "os-locale": { "version": "2.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { "execa": "^0.7.0", @@ -17168,17 +17256,20 @@ }, "p-finally": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-limit": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", "dev": true }, "p-locate": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { "p-limit": "^1.1.0" @@ -17186,37 +17277,44 @@ }, "path-exists": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "path-key": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "pseudomap": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, "require-directory": { "version": "2.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "shebang-command": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { "shebang-regex": "^1.0.0" @@ -17224,17 +17322,20 @@ }, "shebang-regex": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "^1.0.0", @@ -17244,7 +17345,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { "ansi-regex": "^2.0.0" @@ -17252,12 +17354,14 @@ }, "strip-eof": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "which": { "version": "1.3.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -17265,12 +17369,14 @@ }, "which-module": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "wrap-ansi": { "version": "2.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { "string-width": "^1.0.1", @@ -17279,17 +17385,20 @@ }, "y18n": { "version": "3.2.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, "yallist": { "version": "2.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs": { "version": "10.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", "dev": true, "requires": { "cliui": "^3.2.0", @@ -17308,12 +17417,14 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "cliui": { "version": "3.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { "string-width": "^1.0.1", @@ -17323,7 +17434,8 @@ "dependencies": { "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "^1.0.0", @@ -17335,7 +17447,8 @@ }, "string-width": { "version": "2.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", @@ -17344,12 +17457,14 @@ "dependencies": { "is-fullwidth-code-point": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "strip-ansi": { "version": "4.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { "ansi-regex": "^3.0.0" @@ -17361,7 +17476,8 @@ }, "yargs-parser": { "version": "8.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", "dev": true, "requires": { "camelcase": "^4.1.0" @@ -17369,7 +17485,8 @@ "dependencies": { "camelcase": { "version": "4.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true } } diff --git a/package.json b/package.json index 1d3a8a106e..57ea00a1e7 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "watch:venia-dev-server": "cd packages/venia-concept && nodemon --watch ../pwa-buildpack/dist --watch webpack.config.js --delay 1 --ext js,json --exec npm run-script watch; cd - >/dev/null" }, "devDependencies": { - "@magento/eslint-config": "^1.0.0", + "@magento/eslint-config": "^1.1.0", "@storybook/addon-actions": "^3.4.2", "@storybook/addons": "^3.4.6", "@storybook/react": "^3.4.2", diff --git a/packages/peregrine/.babelrc b/packages/peregrine/.babelrc index 9929868140..13864d0360 100644 --- a/packages/peregrine/.babelrc +++ b/packages/peregrine/.babelrc @@ -2,7 +2,7 @@ "plugins": [ "transform-object-rest-spread", "transform-class-properties", - ["transform-react-jsx", { "pragma": "createElement" }], + ["transform-react-jsx"], ["transform-runtime", { "helpers": true, "polyfill": false, // polyfills will be handled by preset-env @@ -23,7 +23,7 @@ "transform-es2015-modules-commonjs", "transform-object-rest-spread", "transform-class-properties", - ["transform-react-jsx", { "pragma": "createElement" }] + ["transform-react-jsx"] ] } } diff --git a/packages/peregrine/src/ContainerChild/ContainerChild.js b/packages/peregrine/src/ContainerChild/ContainerChild.js index cfde7459c2..edc2624d6b 100644 --- a/packages/peregrine/src/ContainerChild/ContainerChild.js +++ b/packages/peregrine/src/ContainerChild/ContainerChild.js @@ -1,4 +1,4 @@ -import { createElement, Component } from 'react'; +import { Component } from 'react'; import { func, string } from 'prop-types'; export default class ContainerChild extends Component { diff --git a/packages/peregrine/src/ContainerChild/__stories__/ContainerChild.js b/packages/peregrine/src/ContainerChild/__stories__/ContainerChild.js index 655fcc6ea1..eadfa90b30 100644 --- a/packages/peregrine/src/ContainerChild/__stories__/ContainerChild.js +++ b/packages/peregrine/src/ContainerChild/__stories__/ContainerChild.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import ContainerChild from '..'; import docs from '../__docs__/ContainerChild.md'; diff --git a/packages/peregrine/src/ContainerChild/__tests__/ContainerChild.test.js b/packages/peregrine/src/ContainerChild/__tests__/ContainerChild.test.js index e69bc8f150..ecb632034e 100644 --- a/packages/peregrine/src/ContainerChild/__tests__/ContainerChild.test.js +++ b/packages/peregrine/src/ContainerChild/__tests__/ContainerChild.test.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import ContainerChild from '..'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/peregrine/src/List/__stories__/item.js b/packages/peregrine/src/List/__stories__/item.js index 3085abcc4f..f08568edde 100644 --- a/packages/peregrine/src/List/__stories__/item.js +++ b/packages/peregrine/src/List/__stories__/item.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import { withReadme } from 'storybook-readme'; diff --git a/packages/peregrine/src/List/__stories__/items.js b/packages/peregrine/src/List/__stories__/items.js index ce8ddee178..43ee95621b 100644 --- a/packages/peregrine/src/List/__stories__/items.js +++ b/packages/peregrine/src/List/__stories__/items.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import { withReadme } from 'storybook-readme'; diff --git a/packages/peregrine/src/List/__stories__/list.js b/packages/peregrine/src/List/__stories__/list.js index c3aec256c4..f422cbf6c3 100644 --- a/packages/peregrine/src/List/__stories__/list.js +++ b/packages/peregrine/src/List/__stories__/list.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import { withReadme } from 'storybook-readme'; diff --git a/packages/peregrine/src/List/__tests__/item.spec.js b/packages/peregrine/src/List/__tests__/item.spec.js index 0f6ee0a7ca..6799e162eb 100644 --- a/packages/peregrine/src/List/__tests__/item.spec.js +++ b/packages/peregrine/src/List/__tests__/item.spec.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/peregrine/src/List/__tests__/items.spec.js b/packages/peregrine/src/List/__tests__/items.spec.js index 2e590e3e6a..785623ea82 100644 --- a/packages/peregrine/src/List/__tests__/items.spec.js +++ b/packages/peregrine/src/List/__tests__/items.spec.js @@ -1,4 +1,4 @@ -import { Fragment, createElement } from 'react'; +import React, { Fragment } from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/peregrine/src/List/__tests__/list.spec.js b/packages/peregrine/src/List/__tests__/list.spec.js index a551ebcda4..aadfc68e4e 100644 --- a/packages/peregrine/src/List/__tests__/list.spec.js +++ b/packages/peregrine/src/List/__tests__/list.spec.js @@ -1,4 +1,4 @@ -import { Fragment, createElement } from 'react'; +import React, { Fragment } from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/peregrine/src/List/item.js b/packages/peregrine/src/List/item.js index bdaaadb824..3ee3bfd9e7 100644 --- a/packages/peregrine/src/List/item.js +++ b/packages/peregrine/src/List/item.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import fromRenderProp from '../util/fromRenderProp'; diff --git a/packages/peregrine/src/List/items.js b/packages/peregrine/src/List/items.js index cc3dafece6..656c4aa50e 100644 --- a/packages/peregrine/src/List/items.js +++ b/packages/peregrine/src/List/items.js @@ -1,4 +1,4 @@ -import { Component, Fragment, createElement } from 'react'; +import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import memoize from '../util/unaryMemoize'; diff --git a/packages/peregrine/src/List/list.js b/packages/peregrine/src/List/list.js index 45535c09ae..8aa738d2e3 100644 --- a/packages/peregrine/src/List/list.js +++ b/packages/peregrine/src/List/list.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import fromRenderProp from '../util/fromRenderProp'; diff --git a/packages/peregrine/src/Peregrine/Peregrine.js b/packages/peregrine/src/Peregrine/Peregrine.js index dbe0957777..70e6ad6a3b 100644 --- a/packages/peregrine/src/Peregrine/Peregrine.js +++ b/packages/peregrine/src/Peregrine/Peregrine.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { Provider as ReduxProvider } from 'react-redux'; import createStore from '../store'; import MagentoRouter from '../Router'; diff --git a/packages/peregrine/src/Peregrine/__tests__/Peregrine.test.js b/packages/peregrine/src/Peregrine/__tests__/Peregrine.test.js index 271325549a..d844616a9f 100644 --- a/packages/peregrine/src/Peregrine/__tests__/Peregrine.test.js +++ b/packages/peregrine/src/Peregrine/__tests__/Peregrine.test.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import { Provider as ReduxProvider } from 'react-redux'; diff --git a/packages/peregrine/src/Price/Price.js b/packages/peregrine/src/Price/Price.js index 5e32b0799c..3fc713d59e 100644 --- a/packages/peregrine/src/Price/Price.js +++ b/packages/peregrine/src/Price/Price.js @@ -1,4 +1,4 @@ -import { createElement, PureComponent, Fragment } from 'react'; +import React, { PureComponent, Fragment } from 'react'; import { number, string, shape } from 'prop-types'; export default class Price extends PureComponent { diff --git a/packages/peregrine/src/Price/__stories__/Price.js b/packages/peregrine/src/Price/__stories__/Price.js index d91e230105..bc35215e38 100644 --- a/packages/peregrine/src/Price/__stories__/Price.js +++ b/packages/peregrine/src/Price/__stories__/Price.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import { withReadme } from 'storybook-readme'; import Price from '../Price'; diff --git a/packages/peregrine/src/Price/__tests__/Price.spec.js b/packages/peregrine/src/Price/__tests__/Price.spec.js index a4c82c4a0e..01354e2318 100644 --- a/packages/peregrine/src/Price/__tests__/Price.spec.js +++ b/packages/peregrine/src/Price/__tests__/Price.spec.js @@ -1,4 +1,4 @@ -import { createElement, Fragment } from 'react'; +import React, { Fragment } from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import Price from '../Price'; diff --git a/packages/peregrine/src/Router/MagentoRouteHandler.js b/packages/peregrine/src/Router/MagentoRouteHandler.js index 0e4eea56a9..4818e9c845 100644 --- a/packages/peregrine/src/Router/MagentoRouteHandler.js +++ b/packages/peregrine/src/Router/MagentoRouteHandler.js @@ -1,4 +1,4 @@ -import { createElement, Component } from 'react'; +import React, { Component } from 'react'; import { string, shape } from 'prop-types'; import resolveUnknownRoute from './resolveUnknownRoute'; import fetchRootComponent from './fetchRootComponent'; diff --git a/packages/peregrine/src/Router/Router.js b/packages/peregrine/src/Router/Router.js index 223e46a311..109295ff11 100644 --- a/packages/peregrine/src/Router/Router.js +++ b/packages/peregrine/src/Router/Router.js @@ -1,4 +1,4 @@ -import { createElement, Component } from 'react'; +import React, { Component } from 'react'; import { BrowserRouter, Route } from 'react-router-dom'; import { string, func, object } from 'prop-types'; import MagentoRouteHandler from './MagentoRouteHandler'; diff --git a/packages/peregrine/src/Router/__tests__/MagentoRouteHandler.test.js b/packages/peregrine/src/Router/__tests__/MagentoRouteHandler.test.js index e4605364ae..c9e3562a39 100644 --- a/packages/peregrine/src/Router/__tests__/MagentoRouteHandler.test.js +++ b/packages/peregrine/src/Router/__tests__/MagentoRouteHandler.test.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import MagentoRouteHandler from '../MagentoRouteHandler'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/peregrine/src/Router/__tests__/Router.test.js b/packages/peregrine/src/Router/__tests__/Router.test.js index bb3b95455c..09fdfa846f 100644 --- a/packages/peregrine/src/Router/__tests__/Router.test.js +++ b/packages/peregrine/src/Router/__tests__/Router.test.js @@ -1,5 +1,5 @@ import MagentoRouter from '../Router'; -import { createElement } from 'react'; +import React from 'react'; import { configure, mount, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import { MemoryRouter } from 'react-router-dom'; diff --git a/packages/peregrine/src/util/__tests__/fromRenderProp.spec.js b/packages/peregrine/src/util/__tests__/fromRenderProp.spec.js index a050c12594..8b5e849bc5 100644 --- a/packages/peregrine/src/util/__tests__/fromRenderProp.spec.js +++ b/packages/peregrine/src/util/__tests__/fromRenderProp.spec.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/peregrine/src/util/fromRenderProp.js b/packages/peregrine/src/util/fromRenderProp.js index 368aaeae30..9fba317b75 100644 --- a/packages/peregrine/src/util/fromRenderProp.js +++ b/packages/peregrine/src/util/fromRenderProp.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; // memoization cache const cache = new Map(); @@ -31,7 +31,10 @@ const fromRenderProp = (elementType, customProps = []) => { // create an SFC that renders a node of type `elementType` // and filter any props that shouldn't be written to the DOM const Component = props => - createElement(elementType, filterProps(props, uniqueCustomProps)); + React.createElement( + elementType, + filterProps(props, uniqueCustomProps) + ); Component.displayName = `fromRenderProp(${elementType})`; cache.set(key, Component); diff --git a/packages/venia-concept/.babelrc b/packages/venia-concept/.babelrc index 74c9d8be61..6ca049e72f 100644 --- a/packages/venia-concept/.babelrc +++ b/packages/venia-concept/.babelrc @@ -6,12 +6,7 @@ "transform-class-properties", "transform-es2015-modules-commonjs", "transform-object-rest-spread", - [ - "transform-react-jsx", - { - "pragma": "createElement" - } - ] + "transform-react-jsx" ] } } diff --git a/packages/venia-concept/babel.config.js b/packages/venia-concept/babel.config.js index 18639b291e..53883be8c3 100644 --- a/packages/venia-concept/babel.config.js +++ b/packages/venia-concept/babel.config.js @@ -7,7 +7,7 @@ const plugins = [ 'syntax-jsx', 'transform-class-properties', 'transform-object-rest-spread', - ['transform-react-jsx', { pragma: 'createElement' }], + ['transform-react-jsx'], 'graphql-tag' ]; diff --git a/packages/venia-concept/src/RootComponents/CMS/CMS.js b/packages/venia-concept/src/RootComponents/CMS/CMS.js index f6b9947939..d5491cf004 100644 --- a/packages/venia-concept/src/RootComponents/CMS/CMS.js +++ b/packages/venia-concept/src/RootComponents/CMS/CMS.js @@ -1,4 +1,4 @@ -import { createElement, Component } from 'react'; +import React, { Component } from 'react'; import Page from 'src/components/Page'; import CategoryList from 'src/components/CategoryList'; diff --git a/packages/venia-concept/src/RootComponents/Category/category.js b/packages/venia-concept/src/RootComponents/Category/category.js index e78c1f9b85..0c8426bdd5 100644 --- a/packages/venia-concept/src/RootComponents/Category/category.js +++ b/packages/venia-concept/src/RootComponents/Category/category.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { string, number, shape } from 'prop-types'; import { Query } from 'react-apollo'; import gql from 'graphql-tag'; diff --git a/packages/venia-concept/src/RootComponents/Product/Product.js b/packages/venia-concept/src/RootComponents/Product/Product.js index ff29a792a1..ac4a08054a 100644 --- a/packages/venia-concept/src/RootComponents/Product/Product.js +++ b/packages/venia-concept/src/RootComponents/Product/Product.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Query } from 'react-apollo'; import gql from 'graphql-tag'; diff --git a/packages/venia-concept/src/classify.js b/packages/venia-concept/src/classify.js index ed16267ba5..68f29b7851 100644 --- a/packages/venia-concept/src/classify.js +++ b/packages/venia-concept/src/classify.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; const merge = (...args) => Object.assign({}, ...args); diff --git a/packages/venia-concept/src/components/Button/button.js b/packages/venia-concept/src/components/Button/button.js index 2817256e92..ec4e7ecbdd 100644 --- a/packages/venia-concept/src/components/Button/button.js +++ b/packages/venia-concept/src/components/Button/button.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { oneOf, shape, string } from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/CategoryList/categoryList.js b/packages/venia-concept/src/components/CategoryList/categoryList.js index 19dd3494a8..f6a0ff0189 100644 --- a/packages/venia-concept/src/components/CategoryList/categoryList.js +++ b/packages/venia-concept/src/components/CategoryList/categoryList.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { string, number, shape } from 'prop-types'; import { Link } from 'react-router-dom'; import { Query } from 'react-apollo'; diff --git a/packages/venia-concept/src/components/Checkout/checkoutButton.js b/packages/venia-concept/src/components/Checkout/checkoutButton.js index ca7a43820e..3baa9b2724 100644 --- a/packages/venia-concept/src/components/Checkout/checkoutButton.js +++ b/packages/venia-concept/src/components/Checkout/checkoutButton.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { func, string } from 'prop-types'; import Button from 'src/components/Button'; diff --git a/packages/venia-concept/src/components/Checkout/entrance.js b/packages/venia-concept/src/components/Checkout/entrance.js index f49963ecc1..14b3865292 100644 --- a/packages/venia-concept/src/components/Checkout/entrance.js +++ b/packages/venia-concept/src/components/Checkout/entrance.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { func, shape, string } from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Checkout/exit.js b/packages/venia-concept/src/components/Checkout/exit.js index d7979b4971..5f88cefa89 100644 --- a/packages/venia-concept/src/components/Checkout/exit.js +++ b/packages/venia-concept/src/components/Checkout/exit.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { func, shape, string } from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Checkout/flow.js b/packages/venia-concept/src/components/Checkout/flow.js index 256de8e589..ce3f458204 100644 --- a/packages/venia-concept/src/components/Checkout/flow.js +++ b/packages/venia-concept/src/components/Checkout/flow.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { bool, func, oneOf, shape, string } from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Checkout/form.js b/packages/venia-concept/src/components/Checkout/form.js index 034c9b8ebd..5c4e154fe9 100644 --- a/packages/venia-concept/src/components/Checkout/form.js +++ b/packages/venia-concept/src/components/Checkout/form.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { bool, func, shape, string } from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Checkout/resetButton.js b/packages/venia-concept/src/components/Checkout/resetButton.js index b154093729..c4e90fbede 100644 --- a/packages/venia-concept/src/components/Checkout/resetButton.js +++ b/packages/venia-concept/src/components/Checkout/resetButton.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { func } from 'prop-types'; import Button from 'src/components/Button'; diff --git a/packages/venia-concept/src/components/Checkout/section.js b/packages/venia-concept/src/components/Checkout/section.js index 8cdc92cdbc..d0d817495d 100644 --- a/packages/venia-concept/src/components/Checkout/section.js +++ b/packages/venia-concept/src/components/Checkout/section.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { node, shape, string } from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Checkout/submitButton.js b/packages/venia-concept/src/components/Checkout/submitButton.js index 9b998b270e..c6e983583b 100644 --- a/packages/venia-concept/src/components/Checkout/submitButton.js +++ b/packages/venia-concept/src/components/Checkout/submitButton.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { bool, func, string } from 'prop-types'; import Button from 'src/components/Button'; diff --git a/packages/venia-concept/src/components/Checkout/wrapper.js b/packages/venia-concept/src/components/Checkout/wrapper.js index cdcee4d81c..184b5699a1 100644 --- a/packages/venia-concept/src/components/Checkout/wrapper.js +++ b/packages/venia-concept/src/components/Checkout/wrapper.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bool, func, shape, string } from 'prop-types'; diff --git a/packages/venia-concept/src/components/Footer/footer.js b/packages/venia-concept/src/components/Footer/footer.js index d54e0f4bd1..b73d345271 100644 --- a/packages/venia-concept/src/components/Footer/footer.js +++ b/packages/venia-concept/src/components/Footer/footer.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Gallery/__tests__/gallery.spec.js b/packages/venia-concept/src/components/Gallery/__tests__/gallery.spec.js index 7ea8d48384..e6c7100d7d 100644 --- a/packages/venia-concept/src/components/Gallery/__tests__/gallery.spec.js +++ b/packages/venia-concept/src/components/Gallery/__tests__/gallery.spec.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/venia-concept/src/components/Gallery/__tests__/item.spec.js b/packages/venia-concept/src/components/Gallery/__tests__/item.spec.js index 9fb6c72e70..0e133ebbb9 100644 --- a/packages/venia-concept/src/components/Gallery/__tests__/item.spec.js +++ b/packages/venia-concept/src/components/Gallery/__tests__/item.spec.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { configure, mount, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import { BrowserRouter } from 'react-router-dom'; diff --git a/packages/venia-concept/src/components/Gallery/__tests__/items.spec.js b/packages/venia-concept/src/components/Gallery/__tests__/items.spec.js index ada39aaee3..16d2674616 100644 --- a/packages/venia-concept/src/components/Gallery/__tests__/items.spec.js +++ b/packages/venia-concept/src/components/Gallery/__tests__/items.spec.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; diff --git a/packages/venia-concept/src/components/Gallery/gallery.js b/packages/venia-concept/src/components/Gallery/gallery.js index 4952a3255a..d8900cccd9 100644 --- a/packages/venia-concept/src/components/Gallery/gallery.js +++ b/packages/venia-concept/src/components/Gallery/gallery.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { string, shape, arrayOf, number } from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Gallery/item.js b/packages/venia-concept/src/components/Gallery/item.js index 6a7b9cba08..bd88acd589 100644 --- a/packages/venia-concept/src/components/Gallery/item.js +++ b/packages/venia-concept/src/components/Gallery/item.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { string, number, shape, func, bool } from 'prop-types'; import { Price } from '@magento/peregrine'; import { Link } from 'react-router-dom'; diff --git a/packages/venia-concept/src/components/Gallery/items.js b/packages/venia-concept/src/components/Gallery/items.js index c9ed68ea98..e7201310c1 100644 --- a/packages/venia-concept/src/components/Gallery/items.js +++ b/packages/venia-concept/src/components/Gallery/items.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { arrayOf, string, number, shape } from 'prop-types'; import fixedObserver from 'src/util/fixedObserver'; import initObserver from 'src/util/initObserver'; diff --git a/packages/venia-concept/src/components/Header/cartTrigger.js b/packages/venia-concept/src/components/Header/cartTrigger.js index 4a2fdb9487..1dc857e76a 100644 --- a/packages/venia-concept/src/components/Header/cartTrigger.js +++ b/packages/venia-concept/src/components/Header/cartTrigger.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { compose } from 'redux'; import PropTypes from 'prop-types'; diff --git a/packages/venia-concept/src/components/Header/header.js b/packages/venia-concept/src/components/Header/header.js index 98240612c7..f807dc4fdd 100644 --- a/packages/venia-concept/src/components/Header/header.js +++ b/packages/venia-concept/src/components/Header/header.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; diff --git a/packages/venia-concept/src/components/Header/navTrigger.js b/packages/venia-concept/src/components/Header/navTrigger.js index 3f79cd3580..efb5823ee4 100644 --- a/packages/venia-concept/src/components/Header/navTrigger.js +++ b/packages/venia-concept/src/components/Header/navTrigger.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { compose } from 'redux'; import PropTypes from 'prop-types'; diff --git a/packages/venia-concept/src/components/Home/home.js b/packages/venia-concept/src/components/Home/home.js index 3604dadeab..5c2f621693 100644 --- a/packages/venia-concept/src/components/Home/home.js +++ b/packages/venia-concept/src/components/Home/home.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import './home.css'; diff --git a/packages/venia-concept/src/components/Icon/icon.js b/packages/venia-concept/src/components/Icon/icon.js index 6b9ffc27a0..00e250aaea 100644 --- a/packages/venia-concept/src/components/Icon/icon.js +++ b/packages/venia-concept/src/components/Icon/icon.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import Feather from 'feather-icons'; import PropTypes from 'prop-types'; diff --git a/packages/venia-concept/src/components/Main/main.js b/packages/venia-concept/src/components/Main/main.js index 75d2e7664d..ea85de1ee9 100644 --- a/packages/venia-concept/src/components/Main/main.js +++ b/packages/venia-concept/src/components/Main/main.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/MiniCart/miniCart.js b/packages/venia-concept/src/components/MiniCart/miniCart.js index a464c46941..a7f3c6acfd 100644 --- a/packages/venia-concept/src/components/MiniCart/miniCart.js +++ b/packages/venia-concept/src/components/MiniCart/miniCart.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { compose } from 'redux'; import { connect } from 'react-redux'; import { shape, string } from 'prop-types'; diff --git a/packages/venia-concept/src/components/MiniCart/product.js b/packages/venia-concept/src/components/MiniCart/product.js index c32b845963..65907d5ca5 100644 --- a/packages/venia-concept/src/components/MiniCart/product.js +++ b/packages/venia-concept/src/components/MiniCart/product.js @@ -1,4 +1,4 @@ -import { Component, Fragment, createElement } from 'react'; +import React, { Component, Fragment } from 'react'; import { number, shape, string } from 'prop-types'; import { Price } from '@magento/peregrine'; diff --git a/packages/venia-concept/src/components/MiniCart/productList.js b/packages/venia-concept/src/components/MiniCart/productList.js index 8b615fac53..85176b498b 100644 --- a/packages/venia-concept/src/components/MiniCart/productList.js +++ b/packages/venia-concept/src/components/MiniCart/productList.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { arrayOf, number, shape, string } from 'prop-types'; import { List } from '@magento/peregrine'; diff --git a/packages/venia-concept/src/components/MiniCart/trigger.js b/packages/venia-concept/src/components/MiniCart/trigger.js index b173f200a2..1859eeeee0 100644 --- a/packages/venia-concept/src/components/MiniCart/trigger.js +++ b/packages/venia-concept/src/components/MiniCart/trigger.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { compose } from 'redux'; import PropTypes from 'prop-types'; diff --git a/packages/venia-concept/src/components/Navigation/navigation.js b/packages/venia-concept/src/components/Navigation/navigation.js index a759c3f638..52644c11f8 100644 --- a/packages/venia-concept/src/components/Navigation/navigation.js +++ b/packages/venia-concept/src/components/Navigation/navigation.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Navigation/tile.js b/packages/venia-concept/src/components/Navigation/tile.js index 9866f069ea..1269ca153e 100644 --- a/packages/venia-concept/src/components/Navigation/tile.js +++ b/packages/venia-concept/src/components/Navigation/tile.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Navigation/trigger.js b/packages/venia-concept/src/components/Navigation/trigger.js index e1e70449a7..d63097711d 100644 --- a/packages/venia-concept/src/components/Navigation/trigger.js +++ b/packages/venia-concept/src/components/Navigation/trigger.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { compose } from 'redux'; import PropTypes from 'prop-types'; diff --git a/packages/venia-concept/src/components/NotFound/notFound.js b/packages/venia-concept/src/components/NotFound/notFound.js index 78c0554d07..c132887a58 100644 --- a/packages/venia-concept/src/components/NotFound/notFound.js +++ b/packages/venia-concept/src/components/NotFound/notFound.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import './notFound.css'; diff --git a/packages/venia-concept/src/components/Page/mask.js b/packages/venia-concept/src/components/Page/mask.js index 6e75062190..efd38a5f1e 100644 --- a/packages/venia-concept/src/components/Page/mask.js +++ b/packages/venia-concept/src/components/Page/mask.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/Page/page.js b/packages/venia-concept/src/components/Page/page.js index bf6134aa46..b7bf8971ce 100644 --- a/packages/venia-concept/src/components/Page/page.js +++ b/packages/venia-concept/src/components/Page/page.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { compose } from 'redux'; import PropTypes from 'prop-types'; diff --git a/packages/venia-concept/src/components/ProductFullDetail/ProductFullDetail.js b/packages/venia-concept/src/components/ProductFullDetail/ProductFullDetail.js index 28b9381b96..cdee6c285b 100644 --- a/packages/venia-concept/src/components/ProductFullDetail/ProductFullDetail.js +++ b/packages/venia-concept/src/components/ProductFullDetail/ProductFullDetail.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import { arrayOf, bool, func, number, shape, string } from 'prop-types'; import { Price } from '@magento/peregrine'; diff --git a/packages/venia-concept/src/components/ProductImageCarousel/carousel.js b/packages/venia-concept/src/components/ProductImageCarousel/carousel.js index 2f48f01435..ad713f3862 100644 --- a/packages/venia-concept/src/components/ProductImageCarousel/carousel.js +++ b/packages/venia-concept/src/components/ProductImageCarousel/carousel.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import memoize from 'memoize-one'; diff --git a/packages/venia-concept/src/components/ProductImageCarousel/thumbnail.js b/packages/venia-concept/src/components/ProductImageCarousel/thumbnail.js index a7cc20f8d0..3800c98c39 100644 --- a/packages/venia-concept/src/components/ProductImageCarousel/thumbnail.js +++ b/packages/venia-concept/src/components/ProductImageCarousel/thumbnail.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/ProductImageCarousel/thumbnailList.js b/packages/venia-concept/src/components/ProductImageCarousel/thumbnailList.js index 55da7f3393..78f4d09d90 100644 --- a/packages/venia-concept/src/components/ProductImageCarousel/thumbnailList.js +++ b/packages/venia-concept/src/components/ProductImageCarousel/thumbnailList.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { List } from '@magento/peregrine'; diff --git a/packages/venia-concept/src/components/ProductOptions/option.js b/packages/venia-concept/src/components/ProductOptions/option.js index d283d57ae2..56a3da9d4b 100644 --- a/packages/venia-concept/src/components/ProductOptions/option.js +++ b/packages/venia-concept/src/components/ProductOptions/option.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/ProductOptions/options.js b/packages/venia-concept/src/components/ProductOptions/options.js index 4488f826b8..7a22c0f54a 100644 --- a/packages/venia-concept/src/components/ProductOptions/options.js +++ b/packages/venia-concept/src/components/ProductOptions/options.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Option from './option'; diff --git a/packages/venia-concept/src/components/ProductOptions/swatch.js b/packages/venia-concept/src/components/ProductOptions/swatch.js index 765c38d0ee..d7382cde3c 100644 --- a/packages/venia-concept/src/components/ProductOptions/swatch.js +++ b/packages/venia-concept/src/components/ProductOptions/swatch.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/ProductOptions/swatchList.js b/packages/venia-concept/src/components/ProductOptions/swatchList.js index a3172b588b..c25c8a62e2 100644 --- a/packages/venia-concept/src/components/ProductOptions/swatchList.js +++ b/packages/venia-concept/src/components/ProductOptions/swatchList.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { List } from '@magento/peregrine'; diff --git a/packages/venia-concept/src/components/ProductOptions/tile.js b/packages/venia-concept/src/components/ProductOptions/tile.js index 8897e3c4fe..000cdc0486 100644 --- a/packages/venia-concept/src/components/ProductOptions/tile.js +++ b/packages/venia-concept/src/components/ProductOptions/tile.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/ProductOptions/tileList.js b/packages/venia-concept/src/components/ProductOptions/tileList.js index 3ad4a6cb35..8fd1bc9c77 100644 --- a/packages/venia-concept/src/components/ProductOptions/tileList.js +++ b/packages/venia-concept/src/components/ProductOptions/tileList.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { List } from '@magento/peregrine'; diff --git a/packages/venia-concept/src/components/ProductQuantity/quantity.js b/packages/venia-concept/src/components/ProductQuantity/quantity.js index 4a8ccd480e..78abc088e4 100644 --- a/packages/venia-concept/src/components/ProductQuantity/quantity.js +++ b/packages/venia-concept/src/components/ProductQuantity/quantity.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classify from 'src/classify'; diff --git a/packages/venia-concept/src/components/RichText/richText.js b/packages/venia-concept/src/components/RichText/richText.js index 573c1d2759..73449eaaec 100644 --- a/packages/venia-concept/src/components/RichText/richText.js +++ b/packages/venia-concept/src/components/RichText/richText.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import classify from 'src/classify'; import defaultClasses from './richText.css'; diff --git a/packages/venia-concept/src/components/Select/option.js b/packages/venia-concept/src/components/Select/option.js index 363e839a72..74bc5928c5 100644 --- a/packages/venia-concept/src/components/Select/option.js +++ b/packages/venia-concept/src/components/Select/option.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; class Option extends Component { diff --git a/packages/venia-concept/src/components/Select/select.js b/packages/venia-concept/src/components/Select/select.js index 64b9a7f210..c83ea191dc 100644 --- a/packages/venia-concept/src/components/Select/select.js +++ b/packages/venia-concept/src/components/Select/select.js @@ -1,4 +1,4 @@ -import { Component, createElement } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { List } from '@magento/peregrine'; diff --git a/packages/venia-concept/src/index.js b/packages/venia-concept/src/index.js index 57455a3e00..060bfc38e1 100644 --- a/packages/venia-concept/src/index.js +++ b/packages/venia-concept/src/index.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; import ReactDOM from 'react-dom'; import bootstrap from '@magento/peregrine'; import ApolloClient from 'apollo-boost'; diff --git a/packages/venia-concept/src/util/__tests__/fromRenderProp.spec.js b/packages/venia-concept/src/util/__tests__/fromRenderProp.spec.js deleted file mode 100644 index a050c12594..0000000000 --- a/packages/venia-concept/src/util/__tests__/fromRenderProp.spec.js +++ /dev/null @@ -1,55 +0,0 @@ -import { createElement } from 'react'; -import { configure, shallow } from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - -import fromRenderProp, { filterProps } from '../fromRenderProp'; - -configure({ adapter: new Adapter() }); - -test('returns a component', () => { - const Div = fromRenderProp('div'); - - expect(Div).toBeInstanceOf(Function); -}); - -test('returns a basic component that renders', () => { - const Div = fromRenderProp('div'); - const wrapper = shallow(
foo
); - - expect(wrapper.prop('children')).toBe('foo'); -}); - -test('returns a composite component that renders', () => { - const Foo = props =>
; - const WrappedFoo = fromRenderProp(Foo); - const wrapper = shallow(foo); - - expect(wrapper.prop('children')).toBe('foo'); -}); - -test('excludes custom props for a basic component', () => { - const Div = fromRenderProp('div', ['foo']); - const wrapper = shallow(
); - - expect(wrapper.prop('foo')).toBeUndefined(); -}); - -test('includes custom props for a composite component', () => { - const Foo = props =>
; - const WrappedFoo = fromRenderProp(Foo, ['foo']); - const wrapper = shallow(); - - expect(wrapper.prop('foo')).toBe('bar'); -}); - -test('`filterProps` returns an object', () => { - expect(filterProps()).toEqual({}); -}); - -test('`filterProps` filters properties from an object', () => { - const input = { a: 0, b: 1 }; - const output = { b: 1 }; - const excludedProps = ['a']; - - expect(filterProps(input, excludedProps)).toEqual(output); -}); diff --git a/packages/venia-concept/src/util/fromRenderProp.js b/packages/venia-concept/src/util/fromRenderProp.js deleted file mode 100644 index 3f2d3fc8ed..0000000000 --- a/packages/venia-concept/src/util/fromRenderProp.js +++ /dev/null @@ -1,40 +0,0 @@ -import { createElement } from 'react'; - -// memoization cache -const cache = new Map(); - -export const filterProps = (props = {}, blacklist = []) => - Object.entries(props).reduce((r, [k, v]) => { - if (!blacklist.includes(k)) { - r[k] = v; - } - return r; - }, {}); - -const fromRenderProp = (elementType, customProps = []) => { - const isComposite = typeof elementType === 'function'; - - // if `elementType` is a function, it can be a component - if (isComposite) { - return elementType; - } - - // hash arguments for memoization - const key = `${elementType}//${customProps.join(',')}`; - - // only create a new component if not cached - // otherwise React will unmount on every render - if (!cache.has(key)) { - // create an SFC that renders a node of `elementType` - // and filter any props that shouldn't be written to the DOM - const Factory = props => - createElement(elementType, filterProps(props, customProps)); - - Factory.displayName = `${elementType}FromRenderProp`; - cache.set(key, Factory); - } - - return cache.get(key); -}; - -export default fromRenderProp; From 4cc5876ed576a6ddf099b7195c49a1ec837c814f Mon Sep 17 00:00:00 2001 From: zetlen Date: Tue, 18 Sep 2018 18:17:00 -0500 Subject: [PATCH 2/2] fix: update eslint-config and stray createElement --- package-lock.json | 6 +++--- package.json | 2 +- packages/venia-concept/src/__mocks__/@magento/peregrine.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4d20ca2d69..3523a775fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1426,9 +1426,9 @@ } }, "@magento/eslint-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@magento/eslint-config/-/eslint-config-1.1.0.tgz", - "integrity": "sha512-zZNCjUBBZpHoMOhtin9bEEUGMhCxARdBQpCSEPynob1JrKOfUljCMYIVsj3qCnDathcAdK2LT0O1shizEw+U4w==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@magento/eslint-config/-/eslint-config-1.2.3.tgz", + "integrity": "sha512-egRUBjQ/5MErc5dqI5r5c5S6QcbbEB1nSERtTlZusyxgW5gOxRUfCMcNIQkZygY45wjRO+Smf3DWTGe9AvWZgQ==", "dev": true }, "@magento/peregrine": { diff --git a/package.json b/package.json index 57ea00a1e7..039e58be12 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "watch:venia-dev-server": "cd packages/venia-concept && nodemon --watch ../pwa-buildpack/dist --watch webpack.config.js --delay 1 --ext js,json --exec npm run-script watch; cd - >/dev/null" }, "devDependencies": { - "@magento/eslint-config": "^1.1.0", + "@magento/eslint-config": "^1.2.3", "@storybook/addon-actions": "^3.4.2", "@storybook/addons": "^3.4.6", "@storybook/react": "^3.4.2", diff --git a/packages/venia-concept/src/__mocks__/@magento/peregrine.js b/packages/venia-concept/src/__mocks__/@magento/peregrine.js index a9c6b0f3c1..c33778d3f3 100644 --- a/packages/venia-concept/src/__mocks__/@magento/peregrine.js +++ b/packages/venia-concept/src/__mocks__/@magento/peregrine.js @@ -1,4 +1,4 @@ -import { createElement } from 'react'; +import React from 'react'; /** * the Price component from @magento/peregrine