Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zero 0 exit code when formatting with syntax error #28483

Open
bneijt opened this issue Mar 12, 2025 · 0 comments · May be fixed by #28523
Open

zero 0 exit code when formatting with syntax error #28483

bneijt opened this issue Mar 12, 2025 · 0 comments · May be fixed by #28523
Labels
deno fmt Related to the "deno fmt" subcommand or dprint

Comments

@bneijt
Copy link

bneijt commented Mar 12, 2025

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

@marvinhagemeister marvinhagemeister added the deno fmt Related to the "deno fmt" subcommand or dprint label Mar 12, 2025
@dsherret dsherret changed the title zero 0 exit code when formatting with error zero 0 exit code when formatting with syntax error Mar 15, 2025
@WWRS WWRS linked a pull request Mar 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno fmt Related to the "deno fmt" subcommand or dprint
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants