diff --git a/README.md b/README.md index e694fbf..3f96e79 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,49 @@ To use the all configuration, extend it in your `.eslintrc` file: } ``` +#### Running on test files only + +This plugin assumes that you're running it on tests files only by default which sometimes is not the case. If you can to run it on test files only. Your configuration will look like this: + +If you're using `.eslintrc` + +```json +{ + "extends": ["eslint:recommended"], + "overrides": [ + { + "files": ["tests/**"], // or any other pattern + "plugins": ["vitest"], + "extends": ["plugin:vitest/recommended"] + } + ] +} +``` + +If you're using `.eslintrc.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, + }, + }, + }, +]; +``` + + ### Rules diff --git a/docs/rules/expect-expect.md b/docs/rules/expect-expect.md index f281baf..c5c352e 100644 --- a/docs/rules/expect-expect.md +++ b/docs/rules/expect-expect.md @@ -31,7 +31,7 @@ Array of custom expression strings that are converted into a regular expression. ```json { - "custom-expressions": [ + "customExpressions": [ "expectValue", "mySecondExpression" ]