Skip to content

zero 0 exit code when formatting with syntax error #28483

Closed
@bneijt

Description

@bneijt

Version: Deno 2.2.1

Exit code when failing to format bad file is 0, deno fmt --check fails.

Expected behavior: fmt fails, so should exit with a non-zero exit code.

Reproduce using the following script:

#!/bin/bash
deno --version
# json with js extension
echo '{ "data": {"lang": "en", "length": 25} }' > a.js
deno fmt a.js
echo "Deno exit was $?"

for 2.2.1 produces:

deno 2.2.1 (stable, release, x86_64-unknown-linux-gnu)
v8 13.4.114.9-rusty
typescript 5.7.3
Error formatting: /tmp/a.js
   Expected ';', '}' or <eof> at file:///tmp/a.js:1:9

  { "data": {"lang": "en", "length": 25} }
          ~
Checked 1 file
Deno exit was 0

I expected it to exit with 1.

Seems like the same kind of issue as #4157

Metadata

Metadata

Assignees

No one assigned

    Labels

    deno fmtRelated to the "deno fmt" subcommand or dprint

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions