-
Notifications
You must be signed in to change notification settings - Fork 45
feat: support Dart 3.8.0 #152
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
Conversation
WalkthroughThe changes update Dart SDK constraints to 3.8.0 in multiple configuration files, upgrade the analysis options to use very_good_analysis 9.0.0, and add a new strict analysis configuration file. Additionally, two linter rules are removed from exclusion lists in documentation and configuration files. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Analyzer
participant Linter
Developer->>Analyzer: Trigger analysis (now uses very_good_analysis 9.0.0)
Analyzer->>Linter: Apply updated rules (from analysis_options.9.0.0.yaml)
Linter-->>Analyzer: Report results (with stricter and updated rule set)
Analyzer-->>Developer: Output analysis/lint results
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.github/workflows/tool_linter_rules.yaml
(1 hunks)README.md
(0 hunks)lib/analysis_options.9.0.0.yaml
(1 hunks)lib/analysis_options.yaml
(1 hunks)pubspec.yaml
(1 hunks)tool/linter_rules/exclusion_reasons.json
(0 hunks)tool/linter_rules/pubspec.yaml
(1 hunks)
💤 Files with no reviewable changes (2)
- tool/linter_rules/exclusion_reasons.json
- README.md
🧰 Additional context used
🪛 GitHub Actions: ci
lib/analysis_options.yaml
[warning] 1-1: 'switch_on_type' is not a recognized lint rule in the included options file.
[warning] 1-1: 'unnecessary_unawaited' is not a recognized lint rule in the included options file.
🔇 Additional comments (5)
pubspec.yaml (1)
10-12
: Align Dart SDK constraint
Updated the SDK constraint to^3.8.0
, which aligns with the PR objective and is consistent with other tool and CI configurations..github/workflows/tool_linter_rules.yaml (1)
17-21
: Update CI Dart version
The GitHub Actions workflow’s Dart setup step now usessdk: 3.8.0
, matching the root and tool SDK constraints.tool/linter_rules/pubspec.yaml (1)
6-8
: Sync tool SDK environment
Thelinter_rules
tool’spubspec.yaml
now specifiessdk: ^3.8.0
, maintaining consistency across the repo.lib/analysis_options.yaml (1)
1-2
: Reference new analysis options
This file now includesanalysis_options.9.0.0.yaml
(v9.0.0). Pipeline warnings indicate unrecognized rules (e.g.,switch_on_type
,unnecessary_unawaited
). Please verify that the included file defines these rules correctly and that their names match the official lint rule names.🧰 Tools
🪛 GitHub Actions: ci
[warning] 1-1: 'switch_on_type' is not a recognized lint rule in the included options file.
[warning] 1-1: 'unnecessary_unawaited' is not a recognized lint rule in the included options file.
lib/analysis_options.9.0.0.yaml (1)
197-197
:❌ Incorrect review comment
Unrecognized lint rule:
unnecessary_unawaited
The analyzer flagsunnecessary_unawaited
as invalid—consider replacing it with the correct rule (unawaited_futures
?) or removing it to clear CI errors.
To verify whether
unnecessary_unawaited
is actually defined in your analysis options file, let’s inspect the rules around line 197:
🏁 Script executed:
#!/usr/bin/env bash # Locate the analysis options file file=$(fd -t f analysis_options.9.0.0.yaml | head -n 1) echo "Inspecting: $file" # Show context around the reported line sed -n '180,220p' "$file"Length of output: 1540
🌐 Web query:
Is 'unnecessary_unawaited' a valid Dart lint rule?
💡 Result:
Yes,
unnecessary_unawaited
is a valid Dart lint rule.This rule flags unnecessary uses of the
unawaited()
function when calling an asynchronous method or function that is annotated with@awaitNotRequired
. When such a method is annotated this way, wrapping it withunawaited()
is redundant and should be avoided.Example from official documentation:
BAD:
@awaitNotRequired Future<LogMessage> log(String message) { ... } void f() { unawaited(log('Message.')); }GOOD:
@awaitNotRequired Future<LogMessage> log(String message) { ... } void f() { log('Message.'); }How to enable:
To enable this rule, add it to your
analysis_options.yaml
file underlinter > rules
:linter: rules: - unnecessary_unawaitedor using map syntax:
linter: rules: unnecessary_unawaited: trueThe official documentation confirms that
unnecessary_unawaited
is available in Dart as of version 3.8.0 and provides clear guidelines on its use and configuration[7].Citations:
- 1: https://dart.dev/tools/linter-rules
- 2: https://dart.dev/tools/linter-rules/all
- 3: https://github.com/dart-lang/lints
- 4: https://gist.github.com/rydmike/fa5c991118ab712f35d2285e7b8a82cb
- 5: https://dart-ko.dev/tools/linter-rules
- 6: https://pub.dev/documentation/lint/latest/
- 7: https://dart.dev/tools/linter-rules/unnecessary_unawaited
- 8: https://pub.dev/packages/lint
- 9: https://www.thedroidsonroids.com/blog/development/how-to-create-dart-lint-rule-for-flutter
- 10: https://pub.dev/packages/lints/versions/2.1.1
Incorrect lint rule warning –
unnecessary_unawaited
is valid
The ruleunnecessary_unawaited
has been part of the Dart linter since version 3.8.0 and is correctly listed in youranalysis_options.yaml
. The CI errors you’re seeing are likely due to an older SDK or linter package that doesn’t yet include this rule. No change is needed in your rules list—please upgrade your Dart analyzer/linter in CI to a version that supportsunnecessary_unawaited
.Likely an incorrect or invalid review comment.
Assigning to @marcossevilla, he will ensure the pipeline passes. |
@alestiago @wolfenrain CI fails because the lints |
Let's exclude those (switch_on_type and unnecessary_unawaited, if not available in Dart 3.8) and update the exclusion reason accordingly. Once we prepare for another release that supports Dart 3.8 or above we would make sure to include them in. |
I thought this PR was for Dart 3.8? That's the impression I get from the PR description at least. The trailing commas setting isn't supported pre 3.8 either. |
not sure since @wolfenrain created this, but based on what you just shared it makes more sense to me if we use 3.8.1, but we would skip 3.8.0 since we're on 3.7.0 right now. @alestiago do you have more context on this? |
@marcossevilla I have more context. :) |
based on what @spydon said, @alestiago and I decided to bump the min sdk to 3.8.0 and add the formatter change since it was available in this version, this release will be 9.0.0. After this is published, we will work on a 10.0.0-rc.1 so the min sdk is bumped to 3.8.1 and we add the rules that previously conflicted in this same PR. |
Status
READY
Description
Getting ready for v3.8.0 of Dart. This also includes @spydon's changes from #151 (that I stole with his permission).
Type of Change
Summary by CodeRabbit
Chores
Documentation