new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Deno · Reference · all subjects

cli commands/fmt

17 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

deno fmt basic usage

Format all supported files in the current directory with 'deno fmt'. Format specific files or directories with 'deno fmt main.ts src/'.

deno fmt --watch flag

The --watch flag automatically re-formats files when they change.

deno fmt --check flag

The --check flag verifies files are formatted without modifying them. The command exits with a non-zero status code if any files are unformatted.

deno fmt --fail-fast flag

The --fail-fast flag stops on the first unformatted file instead of reporting all unformatted files. It is useful in large codebases and works with --check.

deno fmt stdin formatting

Format code piped through stdin by using 'deno fmt -'. This is useful for editor integrations, such as 'cat main.ts | deno fmt -'.

deno fmt --ignore flag

The --ignore flag excludes files from formatting. Multiple patterns can be specified, separated by commas, such as 'deno fmt --ignore=dist/,build/'.

deno fmt configuration precedence

Configuration precedence for deno fmt, from highest to lowest, is: 1) CLI flags (--indent-width, --use-tabs, and so on), 2) The fmt block in deno.json, 3) .editorconfig, 4) Built-in defaults. The .editorconfig file only supplies values not already configured through a flag or deno.json.

deno fmt .editorconfig property mapping

Properties in .editorconfig files map to deno fmt options as follows: indent_style maps to use-tabs, indent_size maps to indent-width, and max_line_length maps to line-width.

deno fmt supported file types

deno fmt supports the following file types and extensions: JavaScript (.js, .cjs, .mjs), TypeScript (.ts, .mts, .cts), JSX (.jsx), TSX (.tsx), Markdown (.md, .mkd, .mkdn, .mdwn, .mdown, .markdown), JSON (.json), JSONC (.jsonc), CSS (.css), HTML (.html), XML (.xml), SVG (.svg), Nunjucks (.njk), Vento (.vto), YAML (.yml, .yaml), SCSS (.scss), LESS (.less), Jupyter Notebook (.ipynb), Astro (.astro, requires --unstable-component flag or "unstable": ["fmt-component"] config), Svelte (.svelte, requires --unstable-component flag or "unstable": ["fmt-component"] config), Vue (.vue, requires --unstable-component flag or "unstable": ["fmt-component"] config), SQL (.sql, requires --unstable-sql flag or "unstable": ["fmt-sql"] config).

deno fmt markdown code snippet formatting

deno fmt can format code snippets in Markdown files. Snippets must be enclosed in triple backticks and have a language attribute.

deno fmt // deno-fmt-ignore-file comment

In JavaScript, TypeScript, and JSONC files, ignore formatting an entire file by adding a '// deno-fmt-ignore-file' comment at the top of the file.

deno fmt <!-- deno-fmt-ignore --> comment

In Markdown, HTML, and CSS files, ignore formatting the next item by preceding it with a '<!-- deno-fmt-ignore -->' comment.

deno fmt <!-- deno-fmt-ignore-start --> and <!-- deno-fmt-ignore-end --> comments

In Markdown, HTML, and CSS files, ignore formatting a section of code by surrounding it with '<!-- deno-fmt-ignore-start -->' and '<!-- deno-fmt-ignore-end -->' comments.

deno fmt <!-- deno-fmt-ignore-file --> comment

In Markdown, HTML, and CSS files, ignore formatting an entire file by adding a '<!-- deno-fmt-ignore-file -->' comment at the top of the file.

deno fmt # deno-fmt-ignore comment for YAML

In YAML files, ignore formatting the next item by preceding it with a '# deno-fmt-ignore' comment.

deno fmt markup and style formatter behavior

The markup formatters (HTML, XML, SVG, and unstable component formats) and the style formatters (CSS, SCSS, and Less) only adjust whitespace. They never reorder or rewrite tokens, and they pass unknown syntax (vendor extensions, future at-rules, template expressions, even broken markup) through unchanged instead of erroring, making formatting more robust on real-world files.

deno fmt --check in CI pipelines

Use `deno fmt --check` in CI pipelines to verify that code is formatted according to Deno's default formatting conventions without making changes.

Give your agent this brain