-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.js
52 lines (47 loc) · 1.8 KB
/
jest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const { UNIT_TEST_FILE_PATTERNS } = require('./lib/patterns');
const { convertErrorsToWarnings } = require('./lib/utils');
const jestFormatting = require('eslint-plugin-jest-formatting');
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
overrides: [
{
files: UNIT_TEST_FILE_PATTERNS,
plugins: ['jest-formatting'],
extends: ['plugin:jest/recommended'],
rules: {
// CUSTOMIZED RULES FROM EXTENDED CONFIGS
'jest/no-alias-methods': 'warn',
'jest/no-conditional-expect': 'warn',
'jest/no-deprecated-functions': 'warn',
'jest/no-done-callback': 'warn',
'jest/no-export': 'warn',
'jest/no-focused-tests': 'warn',
'jest/no-mocks-import': 'warn',
'jest/no-standalone-expect': 'warn',
...convertErrorsToWarnings(
jestFormatting.configs.recommended.overrides[0].rules,
),
// ADDITIONAL RULES
// https://github.com/jest-community/eslint-plugin-jest#rules
'jest/consistent-test-it': 'warn',
'jest/max-nested-describe': ['warn', { max: 2 }],
'jest/no-duplicate-hooks': 'warn',
'jest/no-test-return-statement': 'warn',
'jest/prefer-comparison-matcher': 'warn',
'jest/prefer-each': 'warn',
'jest/prefer-equality-matcher': 'warn',
'jest/prefer-expect-resolves': 'warn',
'jest/prefer-hooks-on-top': 'warn',
'jest/prefer-mock-promise-shorthand': 'warn',
'jest/prefer-spy-on': 'warn',
'jest/prefer-to-be': 'warn',
'jest/prefer-to-contain': 'warn',
'jest/prefer-to-have-length': 'warn',
'jest/prefer-todo': 'warn',
'jest/require-hook': 'warn',
'jest/require-to-throw-message': 'warn',
'jest/require-top-level-describe': 'warn',
},
},
],
};