@@ -5,44 +5,54 @@ import globals from 'globals';
55/**
66 * @type {import('eslint').Linter.Config[] }
77 */
8- const config = createConfig ( {
9- name : '@metamask/eslint-config-jest' ,
8+ const config = createConfig ( [
9+ {
10+ name : '@metamask/eslint-config-jest' ,
1011
11- extends : [ jest . configs [ 'flat/recommended' ] , jest . configs [ 'flat/style' ] ] ,
12+ extends : [ jest . configs [ 'flat/recommended' ] , jest . configs [ 'flat/style' ] ] ,
1213
13- languageOptions : {
14- globals : {
15- ...globals . jest ,
14+ languageOptions : {
15+ globals : {
16+ ...globals . jest ,
17+ } ,
18+ } ,
19+
20+ rules : {
21+ 'jest/consistent-test-it' : [ 'error' , { fn : 'it' } ] ,
22+ 'jest/no-duplicate-hooks' : 'error' ,
23+ 'jest/no-conditional-in-test' : 'error' ,
24+ 'jest/no-test-return-statement' : 'error' ,
25+ 'jest/prefer-hooks-on-top' : 'error' ,
26+ 'jest/prefer-lowercase-title' : [ 'error' , { ignore : [ 'describe' ] } ] ,
27+ 'jest/prefer-spy-on' : 'error' ,
28+ 'jest/prefer-strict-equal' : 'error' ,
29+ 'jest/prefer-todo' : 'error' ,
30+ 'jest/require-top-level-describe' : 'error' ,
31+ 'jest/require-to-throw-message' : 'error' ,
32+ 'jest/valid-expect' : [ 'error' , { alwaysAwait : true } ] ,
33+ 'jest/no-restricted-matchers' : [
34+ 'error' ,
35+ {
36+ resolves : 'Use `expect(await promise)` instead.' ,
37+ toBeFalsy : 'Avoid `toBeFalsy`' ,
38+ toBeTruthy : 'Avoid `toBeTruthy`' ,
39+ toMatchSnapshot : 'Use `toMatchInlineSnapshot()` instead' ,
40+ toThrowErrorMatchingSnapshot :
41+ 'Use `toThrowErrorMatchingInlineSnapshot()` instead' ,
42+ } ,
43+ ] ,
1644 } ,
1745 } ,
46+ {
47+ name : '@metamask/eslint-config-jest/typescript' ,
1848
19- rules : {
20- '@typescript-eslint/unbound-method' : 'off' ,
21- 'jest/consistent-test-it' : [ 'error' , { fn : 'it' } ] ,
22- 'jest/no-duplicate-hooks' : 'error' ,
23- 'jest/no-conditional-in-test' : 'error' ,
24- 'jest/no-test-return-statement' : 'error' ,
25- 'jest/prefer-hooks-on-top' : 'error' ,
26- 'jest/prefer-lowercase-title' : [ 'error' , { ignore : [ 'describe' ] } ] ,
27- 'jest/prefer-spy-on' : 'error' ,
28- 'jest/prefer-strict-equal' : 'error' ,
29- 'jest/prefer-todo' : 'error' ,
30- 'jest/require-top-level-describe' : 'error' ,
31- 'jest/require-to-throw-message' : 'error' ,
32- 'jest/unbound-method' : 'error' ,
33- 'jest/valid-expect' : [ 'error' , { alwaysAwait : true } ] ,
34- 'jest/no-restricted-matchers' : [
35- 'error' ,
36- {
37- resolves : 'Use `expect(await promise)` instead.' ,
38- toBeFalsy : 'Avoid `toBeFalsy`' ,
39- toBeTruthy : 'Avoid `toBeTruthy`' ,
40- toMatchSnapshot : 'Use `toMatchInlineSnapshot()` instead' ,
41- toThrowErrorMatchingSnapshot :
42- 'Use `toThrowErrorMatchingInlineSnapshot()` instead' ,
43- } ,
44- ] ,
49+ files : [ '**/*.test.ts' , '**/*.test.tsx' , '**/*.test.mts' , '**/*.test.cts' ] ,
50+
51+ rules : {
52+ '@typescript-eslint/unbound-method' : 'off' ,
53+ 'jest/unbound-method' : 'error' ,
54+ } ,
4555 } ,
46- } ) ;
56+ ] ) ;
4757
4858export default config ;
0 commit comments