Skip to content

no_adjacent_strings_in_list should trigger when the collection if is missing a trailing comma #58273

@jmagman

Description

@jmagman

Describe the issue
no_adjacent_strings_in_list should trigger when the collection if is missing a trailing comma.

To Reproduce

List<String> list = <String>[
  'a',
  'b'
  'c'
];

triggers the lint but

List<String> list = <String>[
  'a',
  if (true) 'b'
  'c'
];

does not.

Expected behavior
Lint warning: DON'T use adjacent strings in list. on the if (true) 'b' line.

Additional context
Real world bug:
https://github.com/flutter/flutter/pull/70325/files#diff-fbf1a86439c67e75e90a00f32fd2b789323582ced2f4f5cfea2d27a1af18aa30R427

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requestcustomer-flutterdevexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.linter-false-negativeIssues related to lint rules that fail to report a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions