Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing flow type to babel-cli for consistency #10692

Merged
merged 1 commit into from Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -313,7 +313,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