Skip to content

Commit b89530e

Browse files
amir-rahmaniiASafaeirad
authored andcommitted
feat(tests): update test plugins rules
1 parent d7bdcec commit b89530e

File tree

4 files changed

+21
-27
lines changed

4 files changed

+21
-27
lines changed

src/modules/jest.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import plugin from 'eslint-plugin-jest';
2+
import globals from 'globals';
23

34
import { globs } from '../utils/globs.mjs';
45

@@ -9,6 +10,11 @@ function jest() {
910
return {
1011
files: globs.test,
1112
plugins: { jest: plugin },
13+
languageOptions: {
14+
globals: {
15+
...globals.jest,
16+
},
17+
},
1218
rules: {
1319
'jest/consistent-test-it': 'off',
1420
'jest/expect-expect': 'off',

src/modules/playwright.mjs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@ function playwright() {
88
plugins: { playwright: plugin },
99
files: globs.e2e,
1010
rules: {
11-
'jest/no-standalone-expect': [
12-
'error',
13-
{
14-
additionalTestBlockFunctions: [
15-
'test.jestPlaywrightDebug',
16-
'it.jestPlaywrightDebug',
17-
'test.jestPlaywrightSkip',
18-
'it.jestPlaywrightSkip',
19-
'test.jestPlaywrightConfig',
20-
'it.jestPlaywrightConfig',
21-
],
22-
},
23-
],
2411
'playwright/expect-expect': 'error',
2512
'playwright/missing-playwright-await': 'error',
2613
'playwright/max-nested-describe': ['warn', { max: 5 }],
@@ -40,6 +27,7 @@ function playwright() {
4027
'playwright/no-useless-await': 'error',
4128
'playwright/no-unsafe-references': 'warn',
4229
'playwright/no-useless-not': 'warn',
30+
'playwright/no-unused-locators': 'warn',
4331
'playwright/no-wait-for-navigation': 'warn',
4432
'playwright/no-wait-for-selector': 'warn',
4533
'playwright/no-wait-for-timeout': 'warn',

src/modules/tests.mjs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import plugin from '@vitest/eslint-plugin';
21
import globals from 'globals';
32

43
import { predicate } from '../utils/conditions.mjs';
@@ -8,28 +7,20 @@ import { globs } from '../utils/globs.mjs';
87
* @param { import('..').Options } options
98
* @return { import('eslint').Linter.Config }
109
*/
10+
1111
function tests(options = {}) {
1212
return {
13-
plugins: { vitest: plugin },
1413
files: [...globs.test, ...globs.e2e],
1514
languageOptions: {
16-
globals: { ...globals['shared-node-browser'], ...globals.jest },
15+
globals: { ...globals['shared-node-browser'] },
1716
},
1817
rules: {
19-
'vitest/padding-around-after-all-blocks': 'warn',
20-
'vitest/padding-around-after-each-blocks': 'warn',
21-
'vitest/padding-around-before-all-blocks': 'warn',
22-
'vitest/padding-around-before-each-blocks': 'warn',
23-
'vitest/padding-around-describe-blocks': 'warn',
24-
'vitest/padding-around-expect-groups': 'warn',
25-
'vitest/padding-around-test-blocks': 'warn',
26-
2718
'max-lines-per-function': 'off',
2819
'no-sparse-arrays': 'off',
2920
'no-empty-function': 'off',
3021

3122
...predicate(options.react, {
32-
'react/jsx-no-constructed-context-values': 'off',
23+
'@eslint-react/no-unstable-context-value': 'off',
3324
}),
3425

3526
...predicate(options.typescript, {

src/modules/vitest.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ function vitest() {
5858
'vitest/no-standalone-expect': 'warn',
5959
'vitest/no-test-prefixes': 'warn',
6060
'vitest/no-test-return-statement': 'warn',
61+
62+
'vitest/padding-around-after-all-blocks': 'warn',
63+
'vitest/padding-around-after-each-blocks': 'warn',
64+
'vitest/padding-around-before-all-blocks': 'warn',
65+
'vitest/padding-around-before-each-blocks': 'warn',
66+
'vitest/padding-around-describe-blocks': 'warn',
67+
'vitest/padding-around-expect-groups': 'warn',
68+
'vitest/padding-around-test-blocks': 'warn',
69+
6170
'vitest/prefer-called-once': 'warn',
6271
'vitest/prefer-called-times': 'off',
6372
'vitest/prefer-called-with': 'warn',
@@ -88,11 +97,11 @@ function vitest() {
8897
'vitest/require-local-test-context-for-concurrent-snapshots': 'warn',
8998
'vitest/require-mock-type-parameters': 'off',
9099
'vitest/require-to-throw-message': 'warn',
91-
'vitest/require-top-level-describe': 'warn',
100+
'vitest/require-top-level-describe': 'off',
92101
'vitest/valid-describe-callback': 'warn',
93102
'vitest/valid-expect': 'warn',
94103
'vitest/valid-expect-in-promise': 'warn',
95-
'vitest/valid-title': 'warn',
104+
'vitest/valid-title': ['warn', { allowArguments: true }],
96105
'vitest/warn-todo': 'warn',
97106
},
98107
};

0 commit comments

Comments
 (0)