source: frontend/node_modules/eslint-plugin-jest/docs/rules/unbound-method.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.5 KB
Line 
1# Enforces unbound methods are called with their expected scope (`unbound-method`)
2
3## Rule Details
4
5This rule extends the base [`@typescript-eslint/unbound-method`][original-rule]
6rule, meaning you must depend on `@typescript-eslint/eslint-plugin` for it to
7work. It adds support for understanding when it's ok to pass an unbound method
8to `expect` calls.
9
10See the [`@typescript-eslint` documentation][original-rule] for more details on
11the `unbound-method` rule.
12
13Note that while this rule requires type information to work, it will fail
14silently when not available allowing you to safely enable it on projects that
15are not using TypeScript.
16
17## How to use
18
19```json5
20{
21 parser: '@typescript-eslint/parser',
22 parserOptions: {
23 project: 'tsconfig.json',
24 ecmaVersion: 2020,
25 sourceType: 'module',
26 },
27 overrides: [
28 {
29 files: ['test/**'],
30 plugins: ['jest'],
31 rules: {
32 // you should turn the original rule off *only* for test files
33 '@typescript-eslint/unbound-method': 'off',
34 'jest/unbound-method': 'error',
35 },
36 },
37 ],
38 rules: {
39 '@typescript-eslint/unbound-method': 'error',
40 },
41}
42```
43
44This rule should be applied to your test files in place of the original rule,
45which should be applied to the rest of your codebase.
46
47## Options
48
49See [`@typescript-eslint/unbound-method`][original-rule] options.
50
51<sup>Taken with ❤️ [from `@typescript-eslint` core][original-rule]</sup>
52
53[original-rule]:
54 https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unbound-method.md
Note: See TracBrowser for help on using the repository browser.