Skip to content

Commit 1cadbf8

Browse files
committed
Improve docs
1 parent ee54ae6 commit 1cadbf8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

stack/eslint-plugin/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Require Jest module mocking APIs to be called before any other statements in the
1111

1212
#### Rule Details
1313

14-
Jest module mocking APIs such as "jest.mock(\'./example\')" must be called before the associated module
15-
is imported, otherwise they will have no effect. Transpilers such as ts-jest and babel-jest automatically
16-
"hoist" these calls, however this can produce counterintuitive results. Instead, the hoist-jest-mocks
17-
lint rule requires developers to manually hoist these calls.
14+
Jest module mocking APIs such as "jest.mock()" must be called before the associated module is imported, otherwise
15+
they will have no effect. Transpilers such as `ts-jest` and `babel-jest` automatically "hoist" these calls, however
16+
this can produce counterintuitive behavior. Instead, the `hoist-jest-mocks` lint rule simply requires developers
17+
to write the statements in the correct order.
1818

1919
The following APIs are affected: 'jest.mock()', 'jest.unmock()', 'jest.enableAutomock()', 'jest.disableAutomock()',
2020
'jest.deepUnmock()'.
@@ -38,11 +38,11 @@ test("example", () => {
3838
The following patterns are NOT considered problems:
3939

4040
```ts
41-
jest.mock('./file');
41+
jest.mock('./file'); // okay, because mock() is first
4242
import * as file from './file';
4343

4444
test("example", () => {
45-
jest.mock('./file2');
45+
jest.mock('./file2'); // okay, because mock() is first within the test() code block
4646
const file2: typeof import('./file2') = require('./file2');
4747
});
4848
```
@@ -216,4 +216,3 @@ enum E {
216216
}
217217
let e: E._PrivateMember = E._PrivateMember; // okay, because _PrivateMember is declared by E
218218
```
219-

0 commit comments

Comments
 (0)