CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-flow-remove-types

Fast, zero-configuration Flow type annotation removal tool for JavaScript with CLI and programmatic APIs

84

1.09x
Overview
Eval results
Files

task.mdevals/scenario-4/

Flow Type Transformation Utility

Create a Node.js command-line utility that transforms Flow-typed JavaScript files in a directory, with support for filtering files using ignore patterns.

Requirements

Build a CLI tool that wraps the type removal functionality and adds custom path filtering logic.

Command-Line Interface

The utility should accept the following arguments:

  • <source-dir>: Source directory containing Flow-typed files
  • <output-dir>: Destination directory for transformed files
  • --ignore <pattern>: Optional regex pattern to exclude files (e.g., "test|spec")

Path Filtering Logic

  • Read all .js files from the source directory recursively
  • Apply the ignore pattern to filter out unwanted files
  • Transform only files that pass the filter
  • Preserve directory structure in the output

File Transformation

  • Use the type removal API to transform each file
  • Write transformed files to the output directory with the same relative paths
  • Create necessary subdirectories as needed
  • Report the number of files processed and skipped

Test Cases

  • Given a source directory with files src/app.js, src/test/app.test.js, and src/utils.js, using --ignore "test" transforms only src/app.js and src/utils.js @test
  • Processing multiple files preserves the directory structure in the output directory @test
  • Files are correctly transformed with type annotations removed @test

Implementation

@generates

Dependencies { .dependencies }

flow-remove-types { .dependency }

Provides Flow type annotation removal functionality.

Install with Tessl CLI

npx tessl i tessl/npm-flow-remove-types

tile.json