|
1 |
| -import { defineConfig } from "eslint-define-config"; |
| 1 | +import { defineFlatConfig } from "eslint-define-config"; |
| 2 | +import jestPlugin from "eslint-plugin-jest"; |
| 3 | +import testingLibrary from "eslint-plugin-testing-library"; |
| 4 | +import { awaitUserEventRule } from "../rules/await-user-event"; |
2 | 5 |
|
3 |
| -export const testsConfig = defineConfig({ |
4 |
| - env: { |
5 |
| - "jest/globals": true, |
| 6 | +export const testsConfig = defineFlatConfig([ |
| 7 | + { |
| 8 | + languageOptions: { |
| 9 | + globals: { |
| 10 | + "jest/globals": true, |
| 11 | + }, |
| 12 | + }, |
| 13 | + plugins: { |
| 14 | + jest: jestPlugin, |
| 15 | + "testing-library": testingLibrary, |
| 16 | + }, |
| 17 | + rules: { |
| 18 | + // Setting the recommended rules manually, because we don't want warnings, only errors |
| 19 | + "jest/no-alias-methods": "error", // STYLE |
| 20 | + "jest/no-commented-out-tests": "error", |
| 21 | + "jest/no-conditional-expect": "error", |
| 22 | + "jest/no-conditional-in-test": "error", |
| 23 | + "jest/no-deprecated-functions": "error", |
| 24 | + "jest/no-disabled-tests": "error", |
| 25 | + "jest/no-done-callback": "error", |
| 26 | + "jest/no-export": "error", |
| 27 | + "jest/no-focused-tests": "error", |
| 28 | + "jest/no-identical-title": "error", |
| 29 | + "jest/no-mocks-import": "error", |
| 30 | + "jest/no-standalone-expect": "error", |
| 31 | + "jest/no-test-prefixes": "error", // STYLE - force it.skip over xtest |
| 32 | + "jest/no-test-return-statement": "error", |
| 33 | + "jest/prefer-to-have-length": "error", // STYLE |
| 34 | + "jest/valid-describe-callback": "error", |
| 35 | + "jest/valid-expect": "error", |
| 36 | + "jest/valid-expect-in-promise": "error", |
| 37 | + "jest/valid-title": ["error", { disallowedWords: ["should"] }], // STYLE |
| 38 | + "jest/padding-around-all": "error", // STYLE |
| 39 | + "testing-library/await-async-queries": "error", |
| 40 | + "testing-library/no-manual-cleanup": "error", |
| 41 | + "testing-library/no-container": "error", |
| 42 | + "testing-library/no-await-sync-queries": "error", |
| 43 | + "testing-library/no-await-sync-events": "error", |
| 44 | + "testing-library/no-debugging-utils": "error", |
| 45 | + "testing-library/await-async-utils": "error", |
| 46 | + "testing-library/no-promise-in-fire-event": "error", |
| 47 | + "testing-library/no-render-in-lifecycle": "error", |
| 48 | + "testing-library/no-unnecessary-act": "error", |
| 49 | + "testing-library/no-wait-for-multiple-assertions": "error", |
| 50 | + "testing-library/prefer-explicit-assert": "error", |
| 51 | + "testing-library/prefer-presence-queries": "error", |
| 52 | + "testing-library/no-wait-for-side-effects": "error", |
| 53 | + "testing-library/prefer-screen-queries": "error", |
| 54 | + "@bam.tech/await-user-event": "error", |
| 55 | + }, |
6 | 56 | },
|
7 |
| - plugins: ["jest", "testing-library"], |
8 |
| - rules: { |
9 |
| - // Setting the recommended rules manually, because we don't want warnings, only errors |
10 |
| - "jest/no-alias-methods": "error", // STYLE |
11 |
| - "jest/no-commented-out-tests": "error", |
12 |
| - "jest/no-conditional-expect": "error", |
13 |
| - "jest/no-conditional-in-test": "error", |
14 |
| - "jest/no-deprecated-functions": "error", |
15 |
| - "jest/no-disabled-tests": "error", |
16 |
| - "jest/no-done-callback": "error", |
17 |
| - "jest/no-export": "error", |
18 |
| - "jest/no-focused-tests": "error", |
19 |
| - "jest/no-identical-title": "error", |
20 |
| - "jest/no-mocks-import": "error", |
21 |
| - "jest/no-standalone-expect": "error", |
22 |
| - "jest/no-test-prefixes": "error", // STYLE - force it.skip over xtest |
23 |
| - "jest/no-test-return-statement": "error", |
24 |
| - "jest/prefer-to-have-length": "error", // STYLE |
25 |
| - "jest/valid-describe-callback": "error", |
26 |
| - "jest/valid-expect": "error", |
27 |
| - "jest/valid-expect-in-promise": "error", |
28 |
| - "jest/valid-title": ["error", { disallowedWords: ["should"] }], // STYLE |
29 |
| - "jest/padding-around-all": "error", // STYLE |
30 |
| - "testing-library/await-async-queries": "error", |
31 |
| - "testing-library/no-manual-cleanup": "error", |
32 |
| - "testing-library/no-container": "error", |
33 |
| - "testing-library/no-await-sync-queries": "error", |
34 |
| - "testing-library/no-await-sync-events": "error", |
35 |
| - "testing-library/no-debugging-utils": "error", |
36 |
| - "testing-library/await-async-utils": "error", |
37 |
| - "testing-library/no-promise-in-fire-event": "error", |
38 |
| - "testing-library/no-render-in-lifecycle": "error", |
39 |
| - "testing-library/no-unnecessary-act": "error", |
40 |
| - "testing-library/no-wait-for-multiple-assertions": "error", |
41 |
| - "testing-library/prefer-explicit-assert": "error", |
42 |
| - "testing-library/prefer-presence-queries": "error", |
43 |
| - "testing-library/no-wait-for-side-effects": "error", |
44 |
| - "testing-library/prefer-screen-queries": "error", |
45 |
| - "@bam.tech/await-user-event": "error", |
46 |
| - }, |
47 |
| -}); |
| 57 | +]); |
0 commit comments