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

Add this: void to all methods #201

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FloEdelmann
Copy link

What is the purpose of this pull request? (put an "X" next to an item)

  • Documentation update
  • Bug fix
  • Feature
  • Code style update (formatting)
  • Refactoring (no functional changes)
  • CI related changes
  • Other, please explain:

What changes did you make? (Give an overview)

When destructuring an instantiated emitter, the typescript-eslint rule unbound-method reports these cases:

const { emit, on, off } = mitt()
//      ^^^^  ^^  ^^^
// Avoid referencing unbound methods which may cause unintentional scoping of `this`.
// If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead.

Since this is not accessed inside mitt, this PR adds the this: void annotation to the emit, on and off methods.

Is there anything you'd like reviewers to focus on?

No.

Does this PR introduce a breaking change? (What changes might other developers need to make in their application due to this PR?)

No.

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

Successfully merging this pull request may close these issues.

1 participant