Skip to content

Commit 13422bc

Browse files
Update dart format page (#6367)
Fixes #6222 --------- Co-authored-by: Parker Lougheed <[email protected]>
1 parent 172e28f commit 13422bc

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/content/tools/dart-format.md

+12-14
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ provide a list of paths to the desired files or directories.
1919
### Specify one path
2020

2121
Provide the path to one file or directory.
22-
If you specify a directory, `dart format` affects only the files in the
23-
immediate directory; it doesn't recurse through subdirectories.
22+
If you pass a directory path,
23+
`dart format` recurses into its subdirectories as well.
2424

2525
**Example:** To format all the Dart files in or under the current directory:
2626

@@ -66,21 +66,16 @@ so they can trigger another action in response to the exit code.
6666
$ dart format -o none --set-exit-if-changed bin/my_app.dart
6767
```
6868

69-
## Use trailing commas
69+
## What changes?
7070

71-
Use optional trailing commas for better automatic formatting.
72-
Add a trailing comma at the end of parameter lists in functions, methods,
73-
and constructors.
74-
This helps the formatter insert the appropriate amount of line breaks for
75-
Dart-style code.
71+
`dart format` makes the following formatting changes:
7672

77-
## Affects whitespace only
73+
* Removes whitespace.
74+
* Wraps every line to 80 characters long or shorter.
75+
* Adds trailing commas to any argument or parameter list.
76+
that splits across multiple lines, and removes them from ones that don't.
77+
* Might move comments before or after a comma.
7878

79-
To avoid making changes that might be unsafe,
80-
`dart format` only affects whitespace.
81-
82-
There's a lot more to writing readable and
83-
consistent code than just whitespace, though.
8479
To learn more about best practices for writing and styling Dart code,
8580
check out the [Dart style guide][].
8681

@@ -94,6 +89,9 @@ use the `dart help` command or see the documentation for the
9489
$ dart help format
9590
```
9691

92+
Check out the [formatter FAQ][] for more context behind formatting decisions.
93+
9794
[Dart style guide]: /effective-dart/style
9895
[dart_style]: {{site.pub-pkg}}/dart_style
9996
[dart-guidelines]: /effective-dart/style#formatting
97+
[formatter FAQ]: {{site.repo.dart.org}}/dart_style/wiki/FAQ

0 commit comments

Comments
 (0)