Deno: Auto Format JavaScript Code

By Xah Lee. Date: . Last updated: .

Auto Format Code

deno fmt filename

Disable Auto Format for Code Block

to tell deno not to format a semantic unit of code, add

// deno-fmt-ignore

to the line above it.

// deno-fmt-ignore
const   x =   123;

Disable Auto Format for Whole File

add to the top of file

// deno-fmt-ignore-file

deno format cannot have 0 indent.


interesting, here brave search ai got the correct answer. but grok got it wrong, even when asking it to make sure. prompt for both is:

deno --indent-width 0

deno indent brave search ai 2025-10-23 1653c
deno indent brave search ai 2025-10-23 1653c
deno indent grok ai 2025-10-23 16595
deno indent grok ai 2025-10-23 16595