-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[pkg:linter] proposal: test_block_last #59417
Copy link
Copy link
Closed
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
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
Description
When providing optional arguments to
package:testfunctions that take functions (liketestandgroup) 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:testfunctions that take blocks and (optional) named args.Bad Examples
Good Examples
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: