unnecessary-trailing-comma
added in: 1.2.0
style
Checks for unnecessary trailing commas for arguments, parameters, enum values and collections.
Removing those commas results in dart format
producing code that fits on one line.
⚙️ Config
Set max-width
(default is 80
) to configure a custom max line width.
Set multiline
(default is false
) to highlight a unnecessary comma for arguments that take more than one line and are last.
dart_code_metrics:
...
rules:
...
- unnecessary-trailing-comma:
max-width: 100
Example
❌ Bad:
// LINT
void function(
String first,
String second,
) {
return;
}
✅ Good:
void function(String first, String second) {
return;
}