-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Problem
Biome's noFloatingPromises lint rule cannot detect floating promises when async functions are accessed through namespace re-exports using the export import pattern.
Root cause: The current Store pattern uses:
export namespace Store {
export import Campaign = EntityCampaign;
}This prevents Biome's type inference from resolving that Store.Campaign.updateAdmin() returns a Promise<void>, even though the function has an explicit return type annotation and the rule is properly configured.
Real-world impact: Bug in envio/airdrops/mappings/common/campaign/transfer-admin.ts:37 where Store.Campaign.updateAdmin() was called without await, causing the error: "Impossible to access context.Campaign after the handler is resolved."
Warning
Any async Store methods called without await will NOT be caught by the linter, creating a silent reliability issue.
Solution
Refactor 4 Store index files to use plain object exports (Analytics pattern):
// Before (problematic)
export namespace Store {
export import Campaign = EntityCampaign;
}
// After (Biome-compatible)
export const Store = {
Campaign: EntityCampaign,
};This maintains the same public API (Store.Entity.method()) while enabling proper type inference for lint rules.
Note
The Analytics indexer already uses this correct pattern and does NOT need changes.
Testing
Undo the fix for #251 to test.
Tip
After refactoring, run na biome lint to verify the rule now works. Test by temporarily removing await from an async Store call - Biome should flag it.
Files Affected
Toggle to see affected files