swc-project/swc · error

Lint command is not yet implemented

Error message

Lint command is not yet implemented

What it means

The `swc` CLI (swc_cli_impl) declares a `lint` subcommand in its clap Command enum, but LintOptions::execute is a stub calling unimplemented!() at lint.rs:8. Any `swc lint ...` invocation panics with 'not implemented: Lint command is not yet implemented' and exits 101. SWC has no linting pipeline exposed through this CLI.

Source

Thrown at crates/swc_cli_impl/src/commands/lint.rs:8

use clap::Parser;

#[derive(Parser)]
pub struct LintOptions {}

impl super::CommandRunner for LintOptions {
    fn execute(&self) -> anyhow::Result<()> {
        unimplemented!("Lint command is not yet implemented")
    }
}

View on GitHub (pinned to d7d7434666)

Solutions

  1. Use a dedicated linter for the job: eslint, oxlint, or biome.
  2. If you only need syntax checking, `swc compile` will surface parse errors.
  3. If you maintain a fork, make execute return an anyhow::bail! error instead of panicking, or wire in a real lint runner.
  4. Upvote/track the upstream CLI roadmap for lint support.

Example fix

# before
swc lint ./src

# after
swc compile ./src --out-dir /tmp/swc-check   # parse errors only
npx oxlint ./src                             # real linting
Defensive patterns

Strategy: try-catch

Validate before calling

# Probe cheaply before wiring a lint stage to the native CLI
printf 'let x = 1;' > /tmp/probe.js
swc lint /tmp/probe.js >/dev/null 2>/tmp/swc_lint.err
if grep -q 'Lint command is not yet implemented' /tmp/swc_lint.err; then
  echo 'swc lint is a stub — use eslint/oxlint/biome instead'
fi

Try / catch

set +e
swc lint ./src 2>/tmp/lint.err
status=$?
set -e
if [ "$status" -eq 101 ] && grep -q 'Lint command is not yet implemented' /tmp/lint.err; then
  echo 'falling back to oxlint' >&2
  exec npx oxlint ./src
fi
exit "$status"

Prevention

When it happens

Trigger: Running `swc lint src/` with the native swc binary; clap accepts the subcommand, lib.rs dispatches Command::Lint(options) => options.execute(), which panics.

Common situations: Users migrating from `eslint`/`tsc` assuming `swc lint` exists because it appears in `swc --help`; CI lint stages wired to the wrong binary; confusion because the subcommand is listed despite being unimplemented.

Related errors


AI-assisted analysis of swc-project/swc@d7d7434666 (2026-08-16). Data as JSON: /api/errors/e5efa1ec8a28d566. Report an issue: GitHub.