Skip to content

Commit

Permalink
Add missing flow type to babel-cli for consistency (#10692)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYSzys authored and nicolo-ribaudo committed Nov 13, 2019
1 parent 67ea7f4 commit 1d1101e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/babel-cli/src/babel/dir.js
Expand Up @@ -145,7 +145,7 @@ export default async function({
if (cliOptions.watch) {
const chokidar = util.requireChokidar();

filenames.forEach(function(filenameOrDir) {
filenames.forEach(function(filenameOrDir: string): void {
const watcher = chokidar.watch(filenameOrDir, {
persistent: true,
ignoreInitial: true,
Expand All @@ -155,8 +155,8 @@ export default async function({
},
});

["add", "change"].forEach(function(type) {
watcher.on(type, function(filename) {
["add", "change"].forEach(function(type: string): void {
watcher.on(type, function(filename: string): void {
handleFile(
filename,
filename === filenameOrDir
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-cli/src/babel/file.js
Expand Up @@ -223,7 +223,7 @@ export default async function({
pollInterval: 10,
},
})
.on("all", function(type: string, filename: string) {
.on("all", function(type: string, filename: string): void {
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
return;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/babel-cli/src/babel/options.js
Expand Up @@ -320,7 +320,10 @@ function booleanify(val: any): boolean | any {
return val;
}

function collect(value, previousValue): Array<string> {
function collect(
value: string | any,
previousValue: Array<string>,
): Array<string> {
// If the user passed the option with no value, like "babel file.js --presets", do nothing.
if (typeof value !== "string") return previousValue;

Expand Down

0 comments on commit 1d1101e

Please sign in to comment.