swc-project/swc · warning
No `.js` or `.jsx` files found in `{}`
Error message
No `.js` or `.jsx` files found in `{}` What it means
The Flow strip verification subcommand collects candidate files under the given path via collect_flow_files (a directory walk that keeps .js/.jsx files) and refuses to run when the result set is empty. This is an input sanity check, not a crash: the command has nothing to verify. Only .js and .jsx extensions are considered, regardless of file contents.
Source
Thrown at crates/dbg-swc/src/es/flow/strip.rs:53
#[clap(long)]
pub enums: bool,
#[clap(long)]
pub decorators: bool,
#[clap(long)]
pub components: bool,
#[clap(long)]
pub pattern_matching: bool,
}
impl StripCommand {
pub fn run(self, cm: Arc<SourceMap>) -> Result<()> {
let files = collect_flow_files(&self.path)?;
if files.is_empty() {
bail!(
"No `.js` or `.jsx` files found in `{}`",
self.path.display()
);
}
let flow_syntax = self.flow_syntax();
let mut failures = Vec::new();
for path in files.iter() {
if let Err(err) = verify_file(cm.clone(), path, flow_syntax) {
failures.push(err);
}
}
let total = files.len();
let failed = failures.len();
let passed = total - failed;
View on GitHub (pinned to 5176682b65)
Solutions
- Point the command at the directory that actually holds the Flow .js/.jsx sources
- Verify the file set first: find <path> -name '*.js' -o -name '*.jsx'
- Initialize submodules if the Flow corpus lives in one: git submodule update --init --recursive
Example fix
# before $ dbg-swc es flow strip --path . # repo root, only .ts files error: No `.js` or `.jsx` files found in `.` # after - target the Flow source tree $ git submodule update --init --recursive $ dbg-swc es flow strip --path ./submodules/flow/fixtures
Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash # verify the corpus has candidates before running the strip command if ! find "$TARGET" -type f \( -name '*.js' -o -name '*.jsx' \) | grep -q .; then echo "no .js/.jsx files under $TARGET" >&2 exit 2 fi exec dbg-swc es flow strip --path "$TARGET"
Prevention
- Script a find/glob count of .js/.jsx files before invoking the CLI
- Run 'git submodule update --init --recursive' when the Flow corpus lives in submodules
- Note the walker only matches extensions .js and .jsx - rename or convert other sources first
When it happens
Trigger: Invoking the strip command with --path pointing at a tree that contains no .js/.jsx files: a .ts/.tsx-only project, an empty directory, or the wrong directory level (repo root when sources are in a subdirectory).
Common situations: Running against modern TypeScript repositories; forgetting 'git submodule update --init --recursive' so Flow fixture submodules are empty; passing a build output dir instead of the source dir.
Related errors
AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17).
Data as JSON: /api/errors/07379d42f87fd046.
Report an issue: GitHub.