require_trailing_commas_custom 1.0.0 copy "require_trailing_commas_custom: ^1.0.0" to clipboard
require_trailing_commas_custom: ^1.0.0 copied to clipboard

discontinuedreplaced by: better_require_trailing_commas

A modified lint rule of require_trailing_commas

require_trailing_commas_custom #

lint rule for custom_lint

The rule is simple. If you opened parentheses intending to write multiline contents, it requires trailing commas.

✅ Good #

Foo(
  a: 1,
  b: 2,
);

Foo(Bar(
  a: 1,
  b: 2,
));

useEffect(() {
  // ...
}, []);

❌️ Bad #

Foo(
  a: 1,
  b: 2 // <-
);

Foo(Bar(
  a: 1,
  b: 2 // <-
));

useEffect(
  () {
    // ...
  },
  [] // <-
);

Records supported

final (String, String) foo = (
  "bar",
  "baz" // <-
);

Switch expressions supported

final foo = switch (state) {
  State.success => 0,
  State.failure => 1 // <-
}

Enums supported

enum FooState {
  bar,
  baz // <-
}

enum BarState {
  taro("taro"),
  hanako("hanako") // <-
  ;
  
  const BarState(this.name);

  final String name;
}
1
likes
0
points
14
downloads

Publisher

verified publisherchikach.net

Weekly Downloads

A modified lint rule of require_trailing_commas

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, analyzer_plugin, custom_lint_builder

More

Packages that depend on require_trailing_commas_custom