zooper_beaver 0.3.0
zooper_beaver: ^0.3.0 copied to clipboard
A configurable, line-width-aware formatter for Dart with rules in a project-local .beaver.yaml.
0.3.0 #
Settings cleanup: each layout question has one key, and every term is defined with real output in docs/rules/wrap.md. Output under the dart preset is unchanged.
Breaking (configuration) #
These spellings now fail with exit code 78 and a message naming the replacement:
policy: chop_alwayson any list: writepolicy: chop_if_longwithchop_from: 1. On a chain,chop_alwayswithkeep_single_line_if_fits: falseischop_from: 2.wrap.chained_calls.keep_single_line_if_fits: usechop_from. A chain below the threshold that fits already stays on one line underfillandchop_if_long.chop_on_trailing_commaonbinary_expressions,conditional_expressions,chained_calls,cascades,initializer_lists,switch_expressionsandclass_header, which never read it. It stays onarguments,parameters,collection_literals,enum_valuesand as the globalwrap.chop_on_trailing_comma.
Breaking (formatted output) #
align: true(andindent.align.*: true) is now an alias ofindent: first_item, which only aligns; it no longer moves the brackets. A configuration that relied on it to keep the first item on the(line and the)after the last item needsbreak_after_open_bracket: falseandbreak_before_close_bracket: falseon that list to keep its look. On a chain, alignment applies only when the first call stays on the receiver line, so addkeep_first_call_on_receiver_line(for exampletrue).align: falseis accepted and dropped. Onwrap.initializer_lists, whose preset isfirst_item, writeindent: inheritto turn alignment off.- With both
break_after_open_bracket: falseandbreak_before_close_bracket: false(the layoutalign: trueused to produce), a source trailing comma is dropped and no longer chops the list, since nothing would keep the chop on the next run.align: trueused to keep that comma.
Renamed (old spellings stay valid as aliases) #
- Policy value
if_longisfill. close_bracket: own_line | after_last_itemisbreak_before_close_bracket: true | false, onwrapand on the four bracketed lists.align: trueisindent: first_item;indenttakesinherit | <integer> | first_item(notfirst_itemoncascades).
Added #
wrap.break_after_open_bracket(presettrue, plusinheritfields on the four bracketed lists):falsekeeps the first item on the bracket's line. A source break right after the opening bracket now follows this field instead ofkeep_existing_line_breaks.wrap.chained_calls.keep_first_call_on_receiver_linetakes a list of receiver kinds:type_names,identifiers,this,calls,properties.truemeans every kind,falsemeans[](the preset).wrap.switch_expressionspreset ispolicy: chop_if_longwithchop_from: 1(the same output as before).- A glossary at the top of
docs/rules/wrap.md, and the sub-option rule: a sub-option whose parent is not in effect (chop_fromundernever,indent_fromunderfirst_item,trailing_commasunderbreak_before_close_bracket: false) is ignored.
0.2.0 #
Breaking (formatted output) #
Two preset defaults change, so a project formatted with 0.1.0 can change on the next run:
blank_lines.between_comment_and_declarationispreserve: a blank line between an ordinary comment and the declaration below it now stays (0.1.0 removed it). Doc comments and// ignore:directives still stay next to their declaration. Setblank_lines.between_comment_and_declaration: 0for the old output.wrap.cascades.keep_existing_line_breaksisinherit(trueunder the preset): a break you typed before the section of a one-section cascade now stays (0.1.0 joined it when it fit). Setwrap.cascades.keep_existing_line_breaks: falsefor the old output.
Every other new key defaults to the 0.1.0 output. One more change applies only to configurations that set braces.else_on_new_line: true: the new braces.while_on_new_line follows it, so the while of a do loop moves to its own line; set braces.while_on_new_line: false for the old output.
Added #
- Every wrappable list is a map with
policy,chop_from,keep_existing_line_breaksandchop_on_trailing_comma, plusalign,indent,close_bracketandtrailing_commaswhere they apply.wrap.<list>: <policy>stays valid as a shorthand, andindent.align.*,wrap.chained_calls.min_callsandwrap.before_operatorstay valid as aliases. inheritlinks a per-list field to its global key;config --printshows whereinheritwas set and where the value came from.- New lists:
wrap.cascades,wrap.initializer_lists,wrap.switch_expressions,wrap.class_headerandwrap.enum_values. - New wrap keys:
wrap.arguments.hug_block_argument,wrap.chop_on_calls,wrap.close_bracket,wrap.break_before.*,wrap.chained_calls.keep_first_call_on_receiver_line,wrap.annotations,wrap.braceless_bodies,wrap.control_conditions,wrap.simple_case_bodies_on_one_line,wrap.simple_methods_on_one_line, andtrailing_commas: add_when_chopped. - New spacing, blank-line, brace and string keys:
spaces.before_trailing_commentand five colon keys;blank_lines.at_block_edges,after_last_member,max_consecutive_in_code,between_top_level_declarations,between_import_groups,between_comment_and_declarationand the twokeep_between_non_block_*keys;braces.catch_on_new_line,finally_on_new_lineandwhile_on_new_line;strings.quotes_avoid_escapes. line_ending: auto | lf | crlfandinclude:(globs, default['**']).editorconfig: truereadsindent_style,indent_sizeandend_of_linefrom.editorconfig, below any explicit Beaver setting. While it is on,config --printneeds--forand--stdinneeds--stdin-name.beaver config --templateprints every setting with its preset value and alternatives; the same text is indocs/beaver.template.yaml.
0.1.0 #
First release.
beavercommand: format files in place,--checkand--difffor CI,--stdinfor editors (with--rangefor selections),config --printandinit..beaver.yamlconfiguration with the built-indartpreset,extends:inheritance andexclude:patterns; generated files are skipped by default.- Rules for wrapping (arguments, parameters, collections, binary and conditional expressions, method chains), trailing commas, indentation and alignment, spaces, blank lines, braces and string quotes.
- Line breaks you typed are kept; a trailing comma puts every item on its own line.
// beaver-ignore,// beaver-ignore-start/-endand// dart format off/on.- Every result is verified to be the same program before it is written.
- Prebuilt, unsigned binaries for Linux, macOS and Windows; extensions for VS Code and IntelliJ IDEA / Android Studio.