From 4e128239d14817275b447f6b2a1a522f8e2c6ce7 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 18 Nov 2019 09:10:36 -0800 Subject: [PATCH] Support optional chaining --- .babelrc | 1 + js/selectors.ts | 3 +-- package.json | 3 ++- yarn.lock | 48 ++++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/.babelrc b/.babelrc index e1a07ba2..ce4b793b 100644 --- a/.babelrc +++ b/.babelrc @@ -23,6 +23,7 @@ ], "plugins": [ "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-optional-chaining", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-proposal-class-properties" ], diff --git a/js/selectors.ts b/js/selectors.ts index 70787524..df0b7515 100644 --- a/js/selectors.ts +++ b/js/selectors.ts @@ -66,8 +66,7 @@ export const getTracksMatchingFilter = createSelector(getTracks, tracks => { export const getTrackUrl = (state: AppState) => { return (id: number): string | null => { - const track = state.tracks[id]; - return track == null ? null : track.url; + return state.tracks[id]?.url; }; }; export const getTrackOrder = (state: AppState) => state.playlist.trackOrder; diff --git a/package.json b/package.json index 2507cafa..621c0fec 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@babel/plugin-proposal-class-properties": "^7.0.0", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "^7.6.0", "@babel/plugin-syntax-dynamic-import": "^7.0.0", "@babel/plugin-transform-modules-commonjs": "^7.0.0", "@babel/plugin-transform-runtime": "^7.0.0", @@ -80,7 +81,7 @@ "@types/react-redux": "^7.1.1", "@types/webaudioapi": "^0.0.27", "@typescript-eslint/eslint-plugin": "^2.6.1", - "@typescript-eslint/parser": "^2.6.1", + "@typescript-eslint/parser": "^2.7.0", "babel-core": "7.0.0-bridge.0", "babel-eslint": "^9.0.0-beta.3", "babel-jest": "^23.4.2", diff --git a/yarn.lock b/yarn.lock index fca36f5b..8d9ad91e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -516,6 +516,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" +"@babel/plugin-proposal-optional-chaining@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.6.0.tgz#e9bf1f9b9ba10c77c033082da75f068389041af8" + integrity sha512-kj4gkZ6qUggkprRq3Uh5KP8XnE1MdIO0J7MhdDX8+rAbB6dJ2UrensGIS+0NPZAaaJ1Vr0PN6oLUgXMU1uMcSg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-chaining" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.0.tgz#549fe1717a1bd0a2a7e63163841cb37e78179d5d" @@ -574,6 +582,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-syntax-top-level-await@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.0.tgz#f5699549f50bbe8d12b1843a4e82f0a37bb65f4d" @@ -1528,14 +1543,23 @@ "@typescript-eslint/typescript-estree" "2.6.1" eslint-scope "^5.0.0" -"@typescript-eslint/parser@^2.6.1": - version "2.6.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.6.1.tgz#3c00116baa0d696bc334ca18ac5286b34793993c" - integrity sha512-PDPkUkZ4c7yA+FWqigjwf3ngPUgoLaGjMlFh6TRtbjhqxFBnkElDfckSjm98q9cMr4xRzZ15VrS/xKm6QHYf0w== +"@typescript-eslint/experimental-utils@2.7.0": + version "2.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.7.0.tgz#58d790a3884df3041b5a5e08f9e5e6b7c41864b5" + integrity sha512-9/L/OJh2a5G2ltgBWJpHRfGnt61AgDeH6rsdg59BH0naQseSwR7abwHq3D5/op0KYD/zFT4LS5gGvWcMmegTEg== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.7.0" + eslint-scope "^5.0.0" + +"@typescript-eslint/parser@^2.7.0": + version "2.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.7.0.tgz#b5e6a4944e2b68dba1e7fbfd5242e09ff552fd12" + integrity sha512-ctC0g0ZvYclxMh/xI+tyqP0EC2fAo6KicN9Wm2EIao+8OppLfxji7KAGJosQHSGBj3TcqUrA96AjgXuKa5ob2g== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.6.1" - "@typescript-eslint/typescript-estree" "2.6.1" + "@typescript-eslint/experimental-utils" "2.7.0" + "@typescript-eslint/typescript-estree" "2.7.0" eslint-visitor-keys "^1.1.0" "@typescript-eslint/typescript-estree@2.6.1": @@ -1550,6 +1574,18 @@ semver "^6.3.0" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@2.7.0": + version "2.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.7.0.tgz#34fd98c77a07b40d04d5b4203eddd3abeab909f4" + integrity sha512-vVCE/DY72N4RiJ/2f10PTyYekX2OLaltuSIBqeHYI44GQ940VCYioInIb8jKMrK9u855OEJdFC+HmWAZTnC+Ag== + dependencies: + debug "^4.1.1" + glob "^7.1.4" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + tsutils "^3.17.1" + "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359"