Skip to content

Commit ce73952

Browse files
committed
Add rule customization docs for jest and vitest configs
1 parent d749dad commit ce73952

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

docs/jest.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ Config for projects using **Jest** for testing.
1414

1515
```jsonc
1616
{
17-
"extends": ["@code-pushup/eslint-config/jest"]
17+
"extends": ["@code-pushup/eslint-config/jest"],
18+
// customize rules if needed:
19+
"rules": {
20+
// e.g. to customize `test` or `it` usage (default is `it` in `describe` and `test` at top-level):
21+
"jest/consistent-test-it": ["warn", { "fn": "test", "withinDescribe": "test" }]
22+
}
1823
}
1924
```
2025

docs/vitest.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@ Config for projects using **Vitest** for testing.
1414

1515
```jsonc
1616
{
17-
"extends": ["@code-pushup/eslint-config/vitest"]
17+
"extends": ["@code-pushup/eslint-config/vitest"],
18+
// customize rules if needed:
19+
"rules": {
20+
// e.g. to customize file naming convention (default pattern is ".*\\.spec\\.[tj]sx?$"):
21+
"vitest/consistent-test-filename": [
22+
"warn",
23+
{ "pattern": ".*\\.(unit|integration|e2e)\\.test\\.ts$" }
24+
],
25+
// e.g. to customize `test` or `it` usage (default is `it` in `describe` and `test` at top-level):
26+
"vitest/consistent-test-it": ["warn", { "fn": "test", "withinDescribe": "test" }]
27+
}
1828
}
1929
```
2030

scripts/helpers/configs.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ const angularExtraEslintrc = `,
147147
const configsExtraEslintrc = {
148148
angular: angularExtraEslintrc,
149149
'angular-ngrx': angularExtraEslintrc,
150+
jest: `,
151+
// customize rules if needed:
152+
"rules": {
153+
// e.g. to customize \`test\` or \`it\` usage (default is \`it\` in \`describe\` and \`test\` at top-level):
154+
"jest/consistent-test-it": ["warn", { "fn": "test", "withinDescribe": "test" }]
155+
}`,
156+
vitest: `,
157+
// customize rules if needed:
158+
"rules": {
159+
// e.g. to customize file naming convention (default pattern is ".*\\\\.spec\\\\.[tj]sx?$"):
160+
"vitest/consistent-test-filename": [
161+
"warn",
162+
{ "pattern": ".*\\\\.(unit|integration|e2e)\\\\.test\\\\.ts$" }
163+
],
164+
// e.g. to customize \`test\` or \`it\` usage (default is \`it\` in \`describe\` and \`test\` at top-level):
165+
"vitest/consistent-test-it": ["warn", { "fn": "test", "withinDescribe": "test" }]
166+
}`,
150167
};
151168

152169
/**

0 commit comments

Comments
 (0)