Skip to content
This repository has been archived by the owner on Feb 11, 2025. It is now read-only.

feat(eslint): add vitest config #96

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['plugin:vitest/recommended', require.resolve('./rules/vitest')],
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
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.

Loading