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.