From 64ec757e386c36081eead57cff38d7168609feb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Fri, 26 Apr 2024 11:47:59 -0400 Subject: [PATCH] remove var usage --- packages/babel-cli/src/babel/options.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/babel-cli/src/babel/options.ts b/packages/babel-cli/src/babel/options.ts index 4c034aa7bee9..6961d09f625c 100644 --- a/packages/babel-cli/src/babel/options.ts +++ b/packages/babel-cli/src/babel/options.ts @@ -213,18 +213,14 @@ export default function parseArgv(args: Array): CmdOptions | null { const errors: string[] = []; let filenames = commander.args.reduce(function (globbed: string[], input) { - if (process.env.BABEL_8_BREAKING) { - // glob 9+ no longer sorts the result, here we maintain the glob 7 behaviour - // https://github.com/isaacs/node-glob/blob/c3cd57ae128faa0e9190492acc743bb779ac4054/common.js#L151 - // eslint-disable-next-line no-var - var files = globSync(input, { dotRelative: true }).sort( - function alphasort(a, b) { + let files = process.env.BABEL_8_BREAKING + ? // glob 9+ no longer sorts the result, here we maintain the glob 7 behaviour + // https://github.com/isaacs/node-glob/blob/c3cd57ae128faa0e9190492acc743bb779ac4054/common.js#L151 + // eslint-disable-next-line no-var + globSync(input, { dotRelative: true }).sort(function alphasort(a, b) { return a.localeCompare(b, "en"); - }, - ); - } else { - files = globSync(input); - } + }) + : globSync(input); if (!files.length) files = [input]; globbed.push(...files); return globbed;