You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for the great work on Biome. I’m currently using it in a JavaScript project and really appreciate how fast, helpful it is et les suggestions de correction.
I’d like to suggest a feature that could improve code safety when working with async functions or class methods.
Use case
In my project, I often work with async functions and methods inside classes. Sometimes, a function is expected to return a value, but due to oversight, it ends up not returning anything (implicit undefined).
Problem
class UserService {
async getUser(id) {
if (!id) {
return; // ❌ returns undefined
}
const user = await db.findUser(id);
if (user) {
return user;
}
// ❌ implicitly returns undefined
}
}
This is a simplified example to demonstrate the problem, but such a rule could help make code safer by catching unintended undefined returns.
Thank you for taking the time to read my suggestion !
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
First, thanks for the great work on Biome. I’m currently using it in a JavaScript project and really appreciate how fast, helpful it is et les suggestions de correction.
I’d like to suggest a feature that could improve code safety when working with async functions or class methods.
Use case
In my project, I often work with async functions and methods inside classes. Sometimes, a function is expected to return a value, but due to oversight, it ends up not returning anything (implicit undefined).
Problem
This is a simplified example to demonstrate the problem, but such a rule could help make code safer by catching unintended undefined returns.
Thank you for taking the time to read my suggestion !
Beta Was this translation helpful? Give feedback.
All reactions