Skip to content

Commit 794b8f8

Browse files
committed
🔧 chore: vitestのeslintルールを追加
1 parent 1bbb910 commit 794b8f8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

eslint.config.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'node:url';
44
import vueEslintParser from 'vue-eslint-parser';
55
import { includeIgnoreFile } from '@eslint/compat';
66
import tsEslintParser from '@typescript-eslint/parser';
7+
import vitest from '@vitest/eslint-plugin';
78
import vuePrettierConfig from '@vue/eslint-config-prettier';
89
import globals from 'globals';
910
import withNuxt from './.nuxt/eslint.config.mjs';
@@ -84,5 +85,26 @@ export default withNuxt([
8485
],
8586
},
8687
},
88+
{
89+
files: ['**/__test__/**', '**/__tests__/**', '**/tests/**', '**/test/**'],
90+
plugins: {
91+
vitest,
92+
},
93+
rules: {
94+
...vitest.configs.recommended.rules,
95+
'vitest/consistent-test-it': ['error', { fn: 'test', withinDescribe: 'test' }],
96+
'vitest/no-conditional-expect': 'error',
97+
'vitest/no-conditional-in-test': 'error',
98+
'vitest/no-conditional-tests': 'error',
99+
'vitest/no-disabled-tests': 'error',
100+
'vitest/no-duplicate-hooks': 'error',
101+
'vitest/no-identical-title': 'error',
102+
'vitest/no-test-return-statement': 'error',
103+
'vitest/prefer-mock-promise-shorthand': 'error',
104+
'vitest/require-hook': 'error',
105+
'vitest/require-to-throw-message': 'error',
106+
'vitest/require-top-level-describe': ['error', { maxNumberOfTopLevelDescribes: 2 }],
107+
},
108+
},
87109
vuePrettierConfig,
88110
]);

0 commit comments

Comments
 (0)