
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
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"]
}
All recommend rules will be set to error by default. You can however disable some rules by setting turning them off
in your .eslintrc
file or by setting them to warn
in your .eslintrc
.
To use the all configuration, extend it in your .eslintrc
file:
{
"extends": ["plugin:vitest/all"]
}
💼 Configurations enabled in.
⚠️ 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 asynchronous 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-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-comparison-matcher | Suggest using the built-in comparison matchers | 🌐 | 🔧 | ||
prefer-each | Prefer each rather than manual loops | 🌐 | |||
prefer-equality-matcher | Suggest using the built-in quality matchers | 🌐 | 💡 | ||
prefer-expect-resolves | Suggest using expect().resolves over expect(await ...) syntax | 🌐 | 🔧 | ||
prefer-hooks-in-order | Prefer having hooks in consistent order | 🌐 | |||
prefer-hooks-on-top | Suggest having hooks before any test cases | 🌐 | |||
prefer-lowercase-title | Enforce lowercase titles | 🌐 | 🔧 | ||
prefer-mock-promise-shorthand | Prefer mock resolved/rejected shorthands for promises | 🌐 | 🔧 | ||
prefer-snapshot-hint | Prefer including a hint with external snapshots | 🌐 | |||
prefer-spy-on | Suggest using vi.spyOn | 🌐 | 🔧 | ||
prefer-strict-equal | Prefer strict equal over equal | 🌐 | 💡 | ||
prefer-to-be | Suggest using toBe() | ✅ | 🔧 | ||
prefer-to-be-falsy | Suggest using toBeFalsy() | 🌐 | 🔧 | ||
prefer-to-be-object | Prefer toBeObject() | 🌐 | 🔧 | ||
prefer-to-be-truthy | Suggest using toBeTruthy | 🌐 | 🔧 | ||
prefer-to-contain | Prefer using toContain() | 🌐 | 🔧 | ||
prefer-to-have-length | Suggest using toHaveLength() | 🌐 | 🔧 | ||
prefer-todo | Suggest using test.todo | 🌐 | 🔧 | ||
require-hook | Require setup and teardown to be within a hook | 🌐 | |||
require-to-throw-message | Require toThrow() to be called with an error message | 🌐 | |||
require-top-level-describe | Enforce that all tests are in a top-level describe | 🌐 | |||
valid-describe-callback | Enforce valid describe callback | ✅ | |||
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 523,392 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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.