-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check trailing commas in list/set/map literals #3340
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks good.
I can't speak to whether the change in semantics is what users want, but this is likely to be a breaking change for at least some users.
I agree but I don't think the creation of a new rule |
/cc @goderbauer |
Overall this looks reasonable to me. Have you by any chance already applied this to the Flutter code base to see if there are any surprising cases on a larger code base like that? |
Correct me if I'm wrong but I will take a look among the 12K+ problems reported by VS code when I enable the current version of the lint. |
You are right, we never did enable it it looks like. |
I tested this PR on flutter and there are 700+ diagnostics about missing trailing commas in set/list/map literals. You can take a look at flutter/flutter#102585 What should we do with the current PR? |
I scrolled through flutter/flutter#102585. There are no surprises in there for me. So extending the trailing comma to collections still sounds reasonable to me. |
My biggest concern on this is the time to migrate internal code that will break when we try and roll with this landed. I'm guessing that the If anyone wants to pitch in there, tests live here: |
|
This PR extends the`add_trailing_comma` fix to handle for the [upcoming support of list/set/map literals in `require_trailing_commas`](dart-lang/linter#3340). It's likely the tests in this PR will fail until sdk update the linter dependency to include dart-lang/linter#3340 Closes #48968 GitOrigin-RevId: 24b374e Change-Id: I066a8524d18a4213eb5300b9310bdb4a562f0e27 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243920 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
@pq : There is now a fix to help the migration. |
This is another one that will likely require a bunch of internal cleanup before landing in the SDK. I'm a bit oversubscribed at the moment but will put the feelers out for volunteers... Thanks @a14n! |
@pq is there a lot of internal cleanup to do? |
This rule is enabled internally, so I'll kick off a job to test it out. |
There is much to clean up internally, haha. I've started the process. May take a few days. Thanks a million for your patience!! |
Update, I have an in-progress change to fix the internal code but there are a lot of hoops to jump though, so I'm going to pause that. No ETA for when this can land. |
@a14n this is now making great progress internally, would you mind making one more pass over the flutter repos before I land? I'm very excited for this one 😁 |
AFAICT this lint rule is disable in flutter/flutter. |
Oh I see, woohoo! Thanks! @pq any concerns with me landing then? Tracking for internal compliance is b/279356486. |
Quick note that this does not cover ListPatterns or MapPatterns. Mentioned in an open issue about records. |
Description
This PR checks trailing commas in list/set/map literals.