Skip to content
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

no-floating-effects rule #14

Open
dudeofawesome opened this issue Jul 14, 2024 · 2 comments · May be fixed by #18
Open

no-floating-effects rule #14

dudeofawesome opened this issue Jul 14, 2024 · 2 comments · May be fixed by #18
Labels
enhancement New feature or request

Comments

@dudeofawesome
Copy link

What is the problem this feature would solve?

Background

typescript-eslint has a rule called no-floating-promises which requires all promises to be handled (either via return or await) or explicitly ignored (via void).

It would be nice to be able to get a lint warning when leaving an Effect hanging.

What is the feature you are proposing to solve the problem?

A new rule to detect floating Effects could warn on the following circumstances:

❌ Incorrect

Effect.gen(function* () {
  Console.log('foo');
//^ floating Effect
});

const program = pipe(
  Effect.succeed('foo'),
  Effect.tap(v => {
    Console.log(v);
//  ^ floating Effect
  }),
);

✅ Correct

Effect.gen(function* () {
  yield* Console.log('foo');
});

const program = pipe(
  Effect.succeed('foo'),
  Effect.tap(Console.log),
);

What alternatives have you considered?

No response

@dudeofawesome dudeofawesome added the enhancement New feature or request label Jul 14, 2024
@justinfarrelldev
Copy link

This would be fantastic, just wanted to enthusiastically voice my support! 🙂

@mattiamanzati mattiamanzati linked a pull request Nov 12, 2024 that will close this issue
5 tasks
@danielo515
Copy link

I would love tho have this. But I understand it's tricky to implement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants