unbound-method
Added in v0.9.4Configuration
Rule Details
Enforce unbound methods are called with their expected scope. This rule extends @typescript-eslint/unbound-method with an understanding of Jest: a method may be passed unbound to expect or jest.mocked, which never call it.
Every other check of the base rule is kept. Methods passed to expect are still reported when the matcher calls them (toThrow, toThrowError, toThrowErrorMatchingSnapshot, and toThrowErrorMatchingInlineSnapshot), or when the expect chain has no called matcher.
Use this rule in place of @typescript-eslint/unbound-method for test files; enabling both reports the same references twice. The rule requires type information.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
This rule accepts the same options as @typescript-eslint/unbound-method, such as ignoreStatic.