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
| import type { Linter } from 'eslint';
|
| import { interopDefault } from '../util';
|
| export async function test(): Promise<Linter.Config[]> {
| const [pluginTest, pluginNoOnlyTests] = await Promise.all([
| interopDefault(import('eslint-plugin-vitest')),
| // @ts-expect-error - no types
| interopDefault(import('eslint-plugin-no-only-tests')),
| ] as const);
|
| return [
| {
| files: [
| `**/__tests__/**/*.?([cm])[jt]s?(x)`,
| `**/*.spec.?([cm])[jt]s?(x)`,
| `**/*.test.?([cm])[jt]s?(x)`,
| `**/*.bench.?([cm])[jt]s?(x)`,
| `**/*.benchmark.?([cm])[jt]s?(x)`,
| ],
| plugins: {
| test: {
| ...pluginTest,
| rules: {
| ...pluginTest.rules,
| ...pluginNoOnlyTests.rules,
| },
| },
| },
| rules: {
| 'no-console': 'off',
| 'node/prefer-global/process': 'off',
| 'test/consistent-test-it': [
| 'error',
| { fn: 'it', withinDescribe: 'it' },
| ],
| 'test/no-identical-title': 'error',
| 'test/no-import-node-test': 'error',
| 'test/no-only-tests': 'error',
| 'test/prefer-hooks-in-order': 'error',
| 'test/prefer-lowercase-title': 'error',
| },
| },
| ];
| }
|
|