linter
linter copied to clipboard
Investigate new `sort_child_properties_last` diagnostics when relaxed
#2648 introduces new diagnostics to libraries in (at least) 20 internal packages (the SDK roller stopped trying to add exceptions at 20). We'll need to investigate if these are false positives or if we need to coordinate fixes before the next roll.
/cc @a14n @emmanuel-p @jacob314
Example breakage:
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
brightness: widget.brightness,
leading: IconButton(
icon: const BackButtonIcon(), // <= LINT
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
onPressed: () {
...
},
key: backButton,
),
title: TextField(
autofocus: true,
style: widget.inputStyle ??
TextStyle(
...
),
decoration: InputDecoration.collapsed(
hintText: widget.hintText,
hintStyle: TextStyle(color: Colors.grey[500]),
),
controller: _controller,
),
actions: <Widget>[ // <= LINT
_controller.text != ''
? IconButton(
icon: Icon(
Icons.cancel,
color: Colors.grey[500],
),
tooltip: AutocompleteLocalizations.of(context)!.clearLabel(),
onPressed: () => _controller.text = '',
key: clearButton,
)
: Container()
],
backgroundColor: widget.appBarColor,
...
This need to be fixed as the lint checks now all Widget arguments and not only child/children (this was requested as part of a review on #2714)
Good to know. Given the impact, we'll have to come up with a plan for migration (or reconsider the additional diagnostics).
Thanks!
/fyi @jacob314
Happy to help migrate. Perhaps it would be worth it to add a quick fix to help migrate? Moving all violating properties to after the last non-child & non closure property would probably be a fine default.
In the example given, backgroundColor should be at the top of the method next to the brightness property. As is it is, it takes a while to spot what widget the backgroundColor is associated with.
Perhaps it would be worth it to add a quick fix to help migrate?
FWIW there is a fix but I expect it will need to be updated w/ the new and improved semantics.