-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-set-flutterlinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Description
When providing optional arguments to package:test
functions that take functions (like test
and group
) supply the named arguments before the function block.
Details
When the test/group "body" is large, it's easy to "lose" the named arguments (like skip
, onPlatform
, etc) below the anonymous function.
Kind
Enforces (un-formalized) style advice that might be generally applicable, but especially with pkg:test
functions that take blocks and (optional) named args.
Bad Examples
test(
'bob',
() {
// code
},
skip: 'Reason',
);
Good Examples
test(
'bob',
skip: 'Reason',
() {
// code
},
);
Discussion
See also https://dart.dev/tools/linter-rules/sort_child_properties_last
One could argue this should be in Effective Dart or Flutter Style Guide, but it's a bit weird since it references an API defined in a package.
Example of a PR that implements this change:
jacob314 and srawlins
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-set-flutterlinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug