From 0b0265d7fd267382dbb96267fe28a12b06b0e103 Mon Sep 17 00:00:00 2001 From: Brody McKee Date: Sun, 30 May 2021 12:43:42 +0300 Subject: [PATCH] Use filter instead of if statement --- .../react-scripts/scripts/utils/verifyPackageTree.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/react-scripts/scripts/utils/verifyPackageTree.js b/packages/react-scripts/scripts/utils/verifyPackageTree.js index 0de4fab9cf7..df05ade61c0 100644 --- a/packages/react-scripts/scripts/utils/verifyPackageTree.js +++ b/packages/react-scripts/scripts/utils/verifyPackageTree.js @@ -19,7 +19,7 @@ const isESLintPluginEnabled = process.env.DISABLE_ESLINT_PLUGIN !== 'true'; // in the tree will likely break your setup. // This is a relatively low-effort way to find common issues. function verifyPackageTree() { - let depsToCheck = [ + const depsToCheck = [ // These are packages most likely to break in practice. // See https://github.com/facebook/create-react-app/issues/1795 for reasons why. // I have not included Babel here because plugins typically don't import Babel (so it's not affected). @@ -28,11 +28,8 @@ function verifyPackageTree() { 'jest', 'webpack', 'webpack-dev-server', - ]; - - if (isESLintPluginEnabled) { - depsToCheck = [...depsToCheck, 'babel-eslint', 'eslint']; - } + ...(isESLintPluginEnabled && ['babel-eslint', 'eslint']), + ].filter(Boolean); // Inlined from semver-regex, MIT license. // Don't want to make this a dependency after ejecting.