From c9ecec82191f1d1790fcec56efbcf6df2d4eaebc Mon Sep 17 00:00:00 2001 From: Mike Cousins Date: Tue, 12 Mar 2019 13:18:30 -0400 Subject: [PATCH] build(babel): Add optional chaining proposal to babel config --- .flowconfig | 1 + .../AppSettings/AdvancedSettingsCard.js | 5 +---- babel.config.js | 1 + package.json | 1 + yarn.lock | 15 +++++++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.flowconfig b/.flowconfig index b3157c5529d..fac7f6c720a 100644 --- a/.flowconfig +++ b/.flowconfig @@ -20,5 +20,6 @@ shared-data/definitions2/.* [options] module.name_mapper.extension='css' -> '@opentrons/components/interfaces/CSSModule.js' merge_timeout=300 +esproposal.optional_chaining=enable [strict] diff --git a/app/src/components/AppSettings/AdvancedSettingsCard.js b/app/src/components/AppSettings/AdvancedSettingsCard.js index 836a2fb9103..efb42483881 100644 --- a/app/src/components/AppSettings/AdvancedSettingsCard.js +++ b/app/src/components/AppSettings/AdvancedSettingsCard.js @@ -100,14 +100,11 @@ function AdvancedSettingsCard (props: Props) { function mapStateToProps (state: State): SP { const config = getConfig(state) - const __ffShowManualIp = config.devInternal - ? !!config.devInternal.manualIp - : false return { devToolsOn: config.devtools, channel: config.update.channel, - __ffShowManualIp: __ffShowManualIp, + __ffShowManualIp: Boolean(config.devInternal?.manualIp), } } diff --git a/babel.config.js b/babel.config.js index 7fbf33af119..d230b660a40 100644 --- a/babel.config.js +++ b/babel.config.js @@ -18,6 +18,7 @@ module.exports = { plugins: [ '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-class-properties', + '@babel/plugin-proposal-optional-chaining', ], presets: ['@babel/preset-flow', '@babel/preset-react', PRESET_ENV_NO_MODULES], overrides: [ diff --git a/package.json b/package.json index 5a89c183d49..9c36c342ea3 100755 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@babel/core": "^7.2.0", "@babel/plugin-proposal-class-properties": "^7.2.1", "@babel/plugin-proposal-object-rest-spread": "^7.2.0", + "@babel/plugin-proposal-optional-chaining": "^7.2.0", "@babel/plugin-transform-modules-commonjs": "^7.2.0", "@babel/preset-env": "^7.2.0", "@babel/preset-flow": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index e945c5ae4b6..821960a6340 100644 --- a/yarn.lock +++ b/yarn.lock @@ -328,6 +328,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" +"@babel/plugin-proposal-optional-chaining@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.2.0.tgz#ae454f4c21c6c2ce8cb2397dc332ae8b420c5441" + integrity sha512-ea3Q6edZC/55wEBVZAEz42v528VulyO0eir+7uky/sT4XRcdkWJcFi1aPtitTlwUzGnECWJNExWww1SStt+yWw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-chaining" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.2.0.tgz#abe7281fe46c95ddc143a65e5358647792039520" @@ -372,6 +380,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-optional-chaining@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.2.0.tgz#a59d6ae8c167e7608eaa443fda9fa8fa6bf21dff" + integrity sha512-HtGCtvp5Uq/jH/WNUPkK6b7rufnCPLLlDAFN7cmACoIjaOOiXxUt3SswU5loHqrhtqTsa/WoLQ1OQ1AGuZqaWA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-arrow-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550"