Skip to content

Conversation

Katekko
Copy link

@Katekko Katekko commented Aug 1, 2025

Status

READY

Breaking Changes

NO

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@Katekko Katekko requested a review from felangel as a code owner August 1, 2025 00:01
@Katekko
Copy link
Author

Katekko commented Aug 1, 2025

Hello @felangel

I've implemented the avoid_async_emit lint rule based on the open issue regarding unguarded emit calls inside async methods. This rule helps ensure emit is properly guarded with isClosed checks to prevent potential runtime issues. Please review and let me know if any adjustments are needed!

ps. This is my first time contributing a lint rule. Please let me know if there are any improvements I can make or if there's a better approach I should follow.

Copy link
Owner

@felangel felangel left a comment

Choose a reason for hiding this comment

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

Thanks so much for the PR! I haven't thoroughly reviewed the code yet but at first glance I think changes are needed since this lint rule should apply to both Bloc and Cubit instances. Currently it looks like this is implemented to ignore Bloc instances entirely.

@felangel felangel added enhancement New feature or request pkg:bloc_lint This issue is related to the bloc_lint package labels Aug 1, 2025
@Katekko
Copy link
Author

Katekko commented Aug 1, 2025

You were right—I needed to include Bloc as well. I updated the condition in handleIdentifier to check for both Cubit and Bloc tokens. Thanks for pointing it out!

Copy link

codecov bot commented Aug 1, 2025

Codecov Report

❌ Patch coverage is 95.94595% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.83%. Comparing base (1ff7d61) to head (f688b0f).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...ages/bloc_lint/lib/src/rules/avoid_async_emit.dart 95.94% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            master    #4585      +/-   ##
===========================================
- Coverage   100.00%   99.83%   -0.17%     
===========================================
  Files           61       62       +1     
  Lines         1793     1867      +74     
===========================================
+ Hits          1793     1864      +71     
- Misses           0        3       +3     
Flag Coverage Δ
bloc_lint 99.50% <95.94%> (-0.50%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@euclidesgc
Copy link

You were right—I needed to include Bloc as well. I updated the condition in handleIdentifier to check for both Cubit and Bloc tokens. Thanks for pointing it out!

Great job, bro, you were amazing.
This will help us get the benefits much sooner than we expected. I'm proud of you, and thanks so much for your contribution to this process. I can't wait to use it.

@felangel
Copy link
Owner

felangel commented Aug 4, 2025

Just wanted to say this is still very much on my radar -- I need to get #4562 merged first and then this is next on my list to review and get merged. Thanks so much for taking the time to contribution! 💙

@felangel
Copy link
Owner

felangel commented Sep 22, 2025

Sorry for the delay! This is next on my todo list and I'm hoping to get this reviewed and merged in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:bloc_lint This issue is related to the bloc_lint package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(bloc_lint): avoid_async_emit
4 participants