Skip to content

Add --verify flag for verbose syntax checking with success confirmation #67482

Open

Description

@hakontdal

What is the problem this feature will solve?

When running node -c script.js (or node --check script.js) interactively in the terminal, a successful syntax check exits with code 0 and produces zero output.

While silent execution is ideal for CI/CD pipelines and automated scripts, it causes ambiguity during manual, interactive use. Total silence makes it unclear whether the command actually executed, processed the intended file, or completed without issues. Having an explicit visual confirmation would significantly improve the interactive developer experience.

What is the feature you are proposing to solve the problem?

Introduce a new --verify CLI flag that performs the exact same syntax check as --check (-c), but prints a brief, Unix-friendly confirmation message to stdout when the check succeeds (e.g., OK: script.js). If syntax errors are found, it behaves identically to --check by printing the errors to stderr and exiting with a non-zero exit code.

Example usage:

$ node --verify script.js
OK: script.js

What alternatives have you considered?

  1. Combining --check with a --verbose flag (node -c --verbose script.js): This would also achieve the desired opt-in behavior without breaking existing scripts, and could be implemented either alongside --verify or instead of it. However, --verify is shorter and more ergonomic for frequent manual use.
  2. Changing the default behavior of --check (-c): Avoided, as printing output on success by default would break backward compatibility and add unwanted noise to existing automated scripts and build pipelines.
  3. Writing a custom shell wrapper or alias: Possible locally (e.g., checking $LASTEXITCODE or $?), but having built-in support directly in Node.js provides a consistent, cross-platform experience across Windows, macOS, and Linux without requiring per-machine setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions