From 6966ff460d910c0304bad7656a6b1766be4f7b2d Mon Sep 17 00:00:00 2001 From: Dane Wilson Date: Mon, 23 Sep 2019 14:01:14 -0400 Subject: [PATCH 1/2] Moved react into a peer dependency --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8e70dfb..7f67243 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,14 @@ "url": "https://github.com/patw0929/react-smartbanner/issues" }, "main": "dist/main.js", + "peerDependencies": { + "react": "16.x", + "react-dom": "16.x" + }, "dependencies": { "cookie-cutter": "^0.1.1", "cookies-js": "^1.2.1", "prop-types": "^15.5.8", - "react": "^16.0.0", - "react-dom": "^16.0.0", "ua-parser-js": "^0.7.9" }, "devDependencies": { @@ -63,7 +65,9 @@ "postcss-safe-parser": "^4.0.1", "pre-commit": "^1.2.2", "prettier": "^1.14.2", + "react": "^16.9.0", "react-dev-utils": "^6.1.1", + "react-dom": "^16.9.0", "react-hot-loader": "^1.3.0", "recursive-readdir": "2.1.0", "rimraf": "2.5.4", From 59a5cab1bc7f7fc6383434e7aab15bdac0f9aa72 Mon Sep 17 00:00:00 2001 From: Dane Wilson Date: Mon, 23 Sep 2019 17:25:38 -0400 Subject: [PATCH 2/2] Updated lifecycle names --- .eslintrc.js | 9 +++++++ src/components/SmartBanner.js | 4 +-- yarn.lock | 49 ++++++++++++++--------------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1c71620..66fb031 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,6 +8,15 @@ module.exports = { jest: true, }, rules: { + 'camelcase': ["error", { allow: ["^UNSAFE_"]}], + 'react/sort-comp': [1, { + order: [ + 'static-methods', + 'lifecycle', + '/^UNSAFE_/', + 'everything-else' + ], + }], 'prefer-destructuring': 'off', 'jsx-a11y/click-events-have-key-events': 'off', 'jsx-a11y/no-noninteractive-element-interactions': 'off', diff --git a/src/components/SmartBanner.js b/src/components/SmartBanner.js index 2dae823..2087ac3 100644 --- a/src/components/SmartBanner.js +++ b/src/components/SmartBanner.js @@ -92,11 +92,11 @@ class SmartBanner extends Component { }; } - componentWillMount() { + UNSAFE_componentWillMount() { this.setType(this.props.force); } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.force !== this.props.force) { this.setType(nextProps.force); } diff --git a/yarn.lock b/yarn.lock index 8af8424..58cf3a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3871,18 +3871,6 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fbjs@^0.8.16: - version "0.8.16" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db" - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.9" - fbjs@^0.8.9: version "0.8.12" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04" @@ -7930,14 +7918,6 @@ prop-types@^15.5.8: dependencies: fbjs "^0.8.9" -prop-types@^15.6.0: - version "15.6.0" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856" - dependencies: - fbjs "^0.8.16" - loose-envify "^1.3.1" - object-assign "^4.1.1" - prop-types@^15.6.2: version "15.6.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" @@ -8148,14 +8128,15 @@ react-dev-utils@^6.1.1: strip-ansi "4.0.0" text-table "0.2.0" -react-dom@^16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.0.0.tgz#9cc3079c3dcd70d4c6e01b84aab2a7e34c303f58" +react-dom@^16.9.0: + version "16.9.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.9.0.tgz#5e65527a5e26f22ae3701131bcccaee9fb0d3962" + integrity sha512-YFT2rxO9hM70ewk9jq0y6sQk8cL02xm4+IzYBz75CQGlClQQ1Bxq0nhHF6OtSbit+AIahujJgb/CPRibFkMNJQ== dependencies: - fbjs "^0.8.16" loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.0" + prop-types "^15.6.2" + scheduler "^0.15.0" react-error-overlay@^5.1.0: version "5.1.0" @@ -8188,14 +8169,14 @@ react-test-renderer@^16.0.0-0: react-is "^16.6.3" scheduler "^0.11.2" -react@^16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/react/-/react-16.0.0.tgz#ce7df8f1941b036f02b2cca9dbd0cb1f0e855e2d" +react@^16.9.0: + version "16.9.0" + resolved "https://registry.yarnpkg.com/react/-/react-16.9.0.tgz#40ba2f9af13bc1a38d75dbf2f4359a5185c4f7aa" + integrity sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w== dependencies: - fbjs "^0.8.16" loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.0" + prop-types "^15.6.2" read-pkg-up@^1.0.1: version "1.0.1" @@ -8760,6 +8741,14 @@ scheduler@^0.11.2: loose-envify "^1.1.0" object-assign "^4.1.1" +scheduler@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.15.0.tgz#6bfcf80ff850b280fed4aeecc6513bc0b4f17f8e" + integrity sha512-xAefmSfN6jqAa7Kuq7LIJY0bwAPG3xlCj0HMEBQk1lxYiDKZscY2xJ5U/61ZTrYbmNQbXa+gc7czPkVo11tnCg== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + schema-utils@^0.4.4, schema-utils@^0.4.5: version "0.4.7" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"