Skip to content

Commit

Permalink
Use filter instead of if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb committed May 30, 2021
1 parent 1608298 commit 96fa29f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/react-scripts/scripts/utils/verifyPackageTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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.
Expand Down

0 comments on commit 96fa29f

Please sign in to comment.