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

feat(eslint-plugin): [unbound-method] improve error message #3203

Merged
merged 3 commits into from Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/eslint-plugin/docs/rules/unbound-method.md
Expand Up @@ -4,6 +4,8 @@ Warns when a method is used outside of a method call.

Class functions don't preserve the class scope when passed as standalone variables.

If you think it is intended, you can try to add `this: void` as the first function parameter or use arrow function instead.
JounQin marked this conversation as resolved.
Show resolved Hide resolved

## Rule Details

Examples of **incorrect** code for this rule
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin/src/rules/unbound-method.ts
Expand Up @@ -132,8 +132,8 @@ export default util.createRule<Options, MessageIds>({
requiresTypeChecking: true,
},
messages: {
unbound:
'Avoid referencing unbound methods which may cause unintentional scoping of `this`.',
unbound: `Avoid referencing unbound methods which may cause unintentional scoping of \`this\`.
If you think it is intended, you can try to add \`this: void\` as the first function parameter or use arrow function instead.`,
JounQin marked this conversation as resolved.
Show resolved Hide resolved
},
schema: [
{
Expand Down