---
title: Format command
description: Format Dart code in the workspace with `dart format`.
---
> ## Documentation Index
> Fetch the complete documentation index at: https://melos.invertase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

<Info>Supports all [Melos filtering](/filters) flags.</Info>

Format the code in your Melos workspace according to Dart formatting standards.

```bash
melos format
```

For more information, see [Dart format](https://dart.dev/tools/dart-format).

## --set-exit-if-changed
If there are any formatting changes, returns exit code 1. This flag is
particularly useful in CI/CD pipelines to automatically detect and reject
commits that do not adhere to the formatting standards.

```bash
melos format --set-exit-if-changed
```

<Info>
By default, `dart format` overwrites the Dart files.
</Info>

## --output
This option is useful when you want to review formatting changes without
directly overwriting your files.

It takes one of `json`, `none`, `show`, or `write` (the default, which
overwrites the files on disk).

Outputs the formatted code to the console.

```bash
melos format --output show
# or

melos format -o show
```

Outputs the formatted code as a JSON object

```bash
melos format -o json
```

Lists the files that would be formatted, without showing the formatted content
or making changes.

```bash
melos format -o none
```

## --line-length

The line length to format the code to. Forwarded to `dart format`.

```bash
melos format --line-length 100
```

## concurrency (-c)
Defines the max concurrency value of how many packages execute the command
at any one time. Defaults to `1`.

```bash
# Set a 5 concurrency

melos format -c 5
```
