Skip to content

Commit

Permalink
feat(eslint): add vitest config (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb committed Mar 5, 2024
1 parent d39b95f commit 325b65a
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -88,6 +88,7 @@ The following additional configs are available:
- `@vercel/style-guide/eslint/playwright-test`
- `@vercel/style-guide/eslint/react`
- `@vercel/style-guide/eslint/typescript` (requires `typescript` to be installed and [additional configuration](#configuring-eslint-for-typescript))
- `@vercel/style-guide/eslint/vitest`

> You'll need to use `require.resolve` to provide ESLint with absolute paths,
> due to an issue around ESLint config resolution (see
Expand Down
16 changes: 16 additions & 0 deletions eslint/rules/vitest.js
@@ -0,0 +1,16 @@
module.exports = {
rules: {
/**
* Disallow duplicate setup and teardown hooks.
*
* 🚫 Not fixable - https://github.com/veritem/eslint-plugin-vitest/blob/HEAD/docs/rules/no-duplicate-hooks.md
*/
'vitest/no-duplicate-hooks': 'error',
/**
* Require lowercase test names.
*
* 🔧 Fixable - https://github.com/veritem/eslint-plugin-vitest/blob/HEAD/docs/rules/prefer-lowercase-title.md
*/
'vitest/prefer-lowercase-title': 'warn',
},
};
3 changes: 3 additions & 0 deletions eslint/vitest.js
@@ -0,0 +1,3 @@
module.exports = {
extends: ['plugin:vitest/recommended', require.resolve('./rules/vitest')],
};
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -55,6 +55,7 @@
"eslint-plugin-testing-library": "^6.0.1",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-unicorn": "^48.0.1",
"eslint-plugin-vitest": "^0.3.22",
"prettier-plugin-packagejson": "^2.4.5"
},
"devDependencies": {
Expand Down
99 changes: 99 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 325b65a

Please sign in to comment.