From 535d51c058eb08f04b6348a72ea91f4e158ece63 Mon Sep 17 00:00:00 2001 From: Jaap Frolich Date: Wed, 8 Jan 2020 02:17:34 +0800 Subject: [PATCH] chore(gatsby): Utilize optional accessors for cleaner syntax (#20448) --- packages/babel-plugin-remove-graphql-queries/src/index.js | 2 +- packages/gatsby/src/query/file-parser.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-plugin-remove-graphql-queries/src/index.js b/packages/babel-plugin-remove-graphql-queries/src/index.js index ba0c2f8b78a60..337ebfa4dfd60 100644 --- a/packages/babel-plugin-remove-graphql-queries/src/index.js +++ b/packages/babel-plugin-remove-graphql-queries/src/index.js @@ -359,7 +359,7 @@ export default function({ types: t }) { }) function followVariableDeclarations(binding) { - const node = binding.path ? binding.path.node : undefined + const node = binding.path?.node if ( node && node.type === `VariableDeclarator` && diff --git a/packages/gatsby/src/query/file-parser.js b/packages/gatsby/src/query/file-parser.js index b0f40f58e7661..a4ed989e9b7ef 100644 --- a/packages/gatsby/src/query/file-parser.js +++ b/packages/gatsby/src/query/file-parser.js @@ -349,7 +349,7 @@ async function findGraphQLTags( } function followVariableDeclarations(binding) { - const node = binding.path ? binding.path.node : undefined + const node = binding.path?.node if ( node && node.type === `VariableDeclarator` &&