Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Conversation

@srawlins
Copy link
Contributor

Description

This enhances no_adjacent_string_in_list to include if-elements and for-elements (see tests for examples).

Note that this will trigger on if-elements and for-elements in sets as well 😲 . The lint broadly does not cover sets. Should it? New lint rule? Deprecate this one and make a new lint rule for collection literals and collection elements?

Fixes dart-lang/sdk#58273

Also fixes some grammar in the docs, and makes the test code more idiomatic.

@google-cla google-cla bot added the cla: yes label Jun 18, 2021
@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 94.027% when pulling 0207594 on srawlins:fix-2343 into 82e4f0e on dart-lang:master.

Copy link
Contributor

@bwilkerson bwilkerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose for the lint is to catch missing commas. We can't have the same problem in maps that we do in lists and sets, but yes I think it makes sense to catch these in sets as well.

Either way this is a breaking change, but it's a bigger breaking change if we catch this in sets. I don't know what we want to do about sets (add them or add a new lint), but I do believe that we either need to not report a lint in if and for elements in sets or we need to handle all elements in sets. In its current form this rule is inconsistent.

It probably makes the most sense to limit the behavior to lists for now and open an issue for community feedback on the idea of adding support for sets.

@srawlins
Copy link
Contributor Author

Filed an issue: dart-lang/sdk#58437

@srawlins
Copy link
Contributor Author

srawlins commented Oct 3, 2022

Replaced by #3741, as I don't use the source repo found in this PR, any longer.

@srawlins srawlins closed this Oct 3, 2022
@srawlins srawlins deleted the fix-2343 branch October 3, 2022 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

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

3 participants