Skip to content

refactor: migrate prefer_first#286

Open
andrew-bekhiet-solid wants to merge 5 commits into
analysis_server_migrationfrom
278-migrate-prefer_first
Open

refactor: migrate prefer_first#286
andrew-bekhiet-solid wants to merge 5 commits into
analysis_server_migrationfrom
278-migrate-prefer_first

Conversation

@andrew-bekhiet-solid

Copy link
Copy Markdown
Collaborator

Closes #278

@andrew-bekhiet-solid andrew-bekhiet-solid linked an issue Jun 15, 2026 that may be closed by this pull request

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the prefer_first lint rule and its quick fix (PreferFirstFix) to the standard analyzer plugin APIs, updating the rule, visitor, and fix implementations, and introducing a reflective test suite. The review feedback highlights two critical issues: first, using thisOrAncestorOfType independently for both MethodInvocation and IndexExpression can lead to incorrect replacements in nested expressions, which can be resolved by using thisOrAncestorMatching; second, calling .first on node.argumentList.arguments can cause analyzer crashes when the argument list is empty, which should be avoided by using firstOrNull.

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.

Comment thread lib/src/lints/prefer_first/fixes/prefer_first_fix.dart
Comment thread lib/src/lints/prefer_first/visitors/prefer_first_visitor.dart Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate prefer_first

1 participant