JSPM

  • Created
  • Published
  • Downloads 543773
  • Score
    100M100P100Q182092F
  • License MIT

Eslint plugin for vitest

Package Exports

  • eslint-plugin-vitest

Readme

eslint-plugin-vitest

npm ci

Eslint plugin for vitest

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-vitest:

npm install eslint-plugin-vitest --save-dev

Usage

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

To use the all configuration, extend it in your .eslintrc file:

{
  "extends": ["plugin:vitest/all"]
}

Rules

⚠️ Configurations set to warn in.
🌐 Set in the all configuration.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.

Name Description ⚠️ 🔧
consistent-test-it Prefer test or it but not both 🌐 🔧
expect-expect Enforce having expectation in test body
max-nested-describe Nested describe block should be less than set max value or default value 🌐
no-conditional-tests Disallow conditional tests 🌐
no-focused-tests Disallow focused tests 🌐 🔧
no-hooks Disallow setup and teardown hooks 🌐
no-identical-title Disallow identical titles 🔧
no-restricted-vi-methods Disallow specific vi. methods 🌐
no-skipped-tests Disallow skipped tests 🌐
prefer-lowercase-title Enforce lowercase titles 🌐 🔧
prefer-to-be Suggest using toBe() 🔧

Credits

Licence

MIT Licence © 2022 - present veritem