refactor: migrate prefer last#287
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the prefer_last lint rule and its associated quick fix to the standard analyzer plugin APIs, refactoring the rule, visitor, and fix implementations while adding a new reflective test suite. The review feedback highlights two key issues: first, the quick fix implementation does not preserve null-awareness (e.g., ?.), which could strip null-safety operators and cause static analysis errors; second, the visitor accesses arguments.first without checking if the argument list is empty, which could throw a StateError and crash the linter during active editing.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
6c49098 to
0c55241
Compare
aa85631 to
f0acb31
Compare
0c55241 to
8cbbc84
Compare
| : '${expression.target ?? ''}.last'; | ||
| } else { | ||
| return '.last'; | ||
| switch (expression) { |
There was a problem hiding this comment.
should we also add test cases for cascades and null-awares, I think that only makes sense?
Closes #279