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

Change effective dart rule about line length #6404

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/content/effective-dart/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ formatting the code by hand and trying to make it more readable. Think of
`dart format` as a partnership where you work together, sometimes iteratively,
to produce beautiful code.


### AVOID lines longer than 80 characters
<a id="avoid-lines-longer-than-80-characters"></a>
### PREFER lines 80 characters or fewer

{% render 'linter-rule-mention.md', rules:'lines_longer_than_80_chars' %}

Expand All @@ -469,7 +469,8 @@ compact. The main offender is usually `VeryLongCamelCaseClassNames`. Ask
yourself, "Does each word in that type name tell me something critical or
prevent a name collision?" If not, consider omitting it.

Note that `dart format` does 99% of this for you, but the last 1% is you.
Note that `dart format` defaults to 80 characters or fewer, though you can
[configure][] the default.
It does not split long string literals to fit in 80 columns,
so you have to do that manually.

Expand All @@ -481,6 +482,8 @@ an import or export), it may remain whole even if it causes the line to go over
because newlines are significant inside the string and splitting the lines into
shorter ones can alter the program.

[configure]: /tools/dart-format#configuring-formatter-page-width

<a id="do-use-curly-braces-for-all-flow-control-structures"></a>
### DO use curly braces for all flow control statements

Expand Down