Product
Introducing Socket Optimize
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.
eslint-plugin-vitest
Advanced tools
Eslint plugin for vitest
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-vitest
:
npm install eslint-plugin-vitest --save-dev
Add vitest
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["vitest"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"vitest/max-nested-describe": [
"error",
{
"max": 3
}
]
}
}
To use the recommended configuration, extend it in your .eslintrc
file:
{
"extends": ["plugin:vitest/recommended"]
}
To use the all configuration, extend it in your .eslintrc
file:
{
"extends": ["plugin:vitest/all"]
}
⚠️ Configurations set to warn in.
🌐 Set in the all
configuration.
✅ Set in the recommended
configuration.
🔧 Automatically fixable by the --fix
CLI option.
💡 Manually fixable by editor suggestions.
Name | Description | ⚠️ | 🔧 | 💡 |
---|---|---|---|---|
consistent-test-filename | forbidden .spec test file pattern | 🌐 | ||
consistent-test-it | Prefer test or it but not both | 🌐 | 🔧 | |
expect-expect | Enforce having expectation in test body | ✅ | ||
max-expects | Enforce a maximum number of expect per test | 🌐 | ||
max-nested-describe | Nested describe block should be less than set max value or default value | 🌐 | ||
no-alias-methods | Disallow alias methods | 🌐 | 🔧 | |
no-commented-out-tests | Disallow commented out tests | ✅ | ||
no-conditional-expect | Disallow conditional expects | 🌐 | ||
no-conditional-in-test | Disallow conditional tests | 🌐 | ||
no-conditional-tests | Disallow conditional tests | 🌐 | ||
no-disabled-tests | Disallow disabled tests | 🌐 | ||
no-done-callback | Disallow using a callback in asynchrounous tests and hooks | 🌐 | 💡 | |
no-duplicate-hooks | Disallow duplicate hooks and teardown hooks | 🌐 | ||
no-focused-tests | Disallow focused tests | 🌐 | 🔧 | |
no-hooks | Disallow setup and teardown hooks | 🌐 | ||
no-identical-title | Disallow identical titles | ✅ | 🔧 | |
no-interpolation-in-snapshots | Disallow string interpolation in snapshots | 🌐 | 🔧 | |
no-large-snapshots | Disallow large snapshots | 🌐 | ||
no-mocks-import | Disallow importing from mocks directory | 🌐 | ||
no-restricted-matchers | Disallow the use of certain matchers | 🌐 | ||
no-restricted-vi-methods | Disallow specific vi. methods | 🌐 | ||
no-skipped-tests | Disallow skipped tests | 🌐 | ||
no-standalone-expect | Disallow using expect outside of it or test blocks | 🌐 | ||
no-test-prefixes | Disallow using test as a prefix | 🌐 | 🔧 | |
no-test-return-statement | Disallow return statements in tests | 🌐 | ||
prefer-called-with | Suggest using toBeCalledWith() or toHaveBeenCalledWith() | 🌐 | ||
prefer-lowercase-title | Enforce lowercase titles | 🌐 | 🔧 | |
prefer-to-be | Suggest using toBe() | ✅ | 🔧 | |
valid-expect | Enforce valid expect() usage | ✅ | ||
valid-title | Enforce valid titles | ✅ | 🔧 |
FAQs
Eslint plugin for vitest
The npm package eslint-plugin-vitest receives a total of 531,580 weekly downloads. As such, eslint-plugin-vitest popularity was classified as popular.
We found that eslint-plugin-vitest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.
Product
We're excited to announce that Socket now supports the Java programming language.
Security News
Socket detected a malicious Python package impersonating a popular browser cookie library to steal passwords, screenshots, webcam images, and Discord tokens.