Skip to content

Commit

Permalink
remove var usage
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Apr 26, 2024
1 parent eec30b0 commit 64ec757
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/babel-cli/src/babel/options.ts
Expand Up @@ -213,18 +213,14 @@ export default function parseArgv(args: Array<string>): 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;
Expand Down

0 comments on commit 64ec757

Please sign in to comment.