Skip to content

Commit

Permalink
Docs/readme (#425)
Browse files Browse the repository at this point in the history
* docs(readme.md): update readme

* chore(pkgs): update pkgs
  • Loading branch information
veritem committed Apr 13, 2024
1 parent 1672d43 commit f8f39f0
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 194 deletions.
46 changes: 21 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ npm install eslint-plugin-vitest --save-dev

### Usage

Make sure you're running eslint `v9.0.0` or higher for the latest version of this plugin to work. The following example is how your `eslint.config.js` should be setup for this plugin to work for you.

```js
import vitest from "eslint-plugin-vitest";

export default [
{
files: ["tests/**"], // or any other pattern
plugins: {
vitest
},
rules: {
...vitest.configs.recommended.rules, // you can also use vitest.configs.recommended.all to enable all rules
"vitest/max-nested-describe": ["error", { "max": 3 }] // you can also modify rules' behavior using option like this
},
},
];
```

If you're not using the latest version of eslint (version `v8.57.0` or lower) you can setup this plugin using the following configuration

Add `vitest` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:

```json
Expand All @@ -44,31 +65,6 @@ Then configure the rules you want to use under the rules section.
}
```

#### Recommended

Make sure you're running eslint `v9.0.0` or heigher `eslint.config.js`

```js
import vitest from "eslint-plugin-vitest";

export default [
{
files: ["tests/**"], // or any other pattern
plugins: {
vitest,
},
rules: {
...vitest.configs.recommended.rules,
},
languageOptions: {
globals: {
...vitest.environments.env.globals,
},
},
},
];
```

#### Enabling with type-testing

Vitest ships with an optional [type-testing feature](https://vitest.dev/guide/testing-types), which is disabled by default.
Expand Down
11 changes: 0 additions & 11 deletions docs/rules/no-focused-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ export default [
rules: {
...vitest.configs.recommended.all,
'vitest/no-focused-tests': ['error', { 'fixable': false }]
},
settings: {
vitest: {
typecheck: true
}
},
languageOptions: {
parser: parser,
globals: {
...vitest.environments.env.globals
}
}
}
]
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
},
"devDependencies": {
"@stylistic/eslint-plugin": "^1.7.0",
"@types/eslint": "^8.56.7",
"@types/eslint": "^8.56.9",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.5",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"@typescript-eslint/rule-tester": "^7.6.0",
Expand All @@ -59,9 +59,9 @@
"eslint-remote-tester-repositories": "^1.0.1",
"ts-node": "^10.9.2",
"tsx": "^4.7.2",
"typescript": "^5.4.4",
"typescript": "^5.4.5",
"unbuild": "^2.0.0",
"vitest": "^1.4.0"
"vitest": "^1.5.0"
},
"engines": {
"node": "^18.0.0 || >= 20.0.0"
Expand Down

0 comments on commit f8f39f0

Please sign in to comment.