-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
86 lines (85 loc) · 5.78 KB
/
Copy patheslint.config.js
File metadata and controls
86 lines (85 loc) · 5.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import playwright from 'eslint-plugin-playwright';
import tseslint from 'typescript-eslint';
export default [
{
files: ['tests/**/*.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
},
},
plugins: {
playwright: playwright,
'@typescript-eslint': tseslint.plugin,
},
rules: {
'@typescript-eslint/no-unused-vars': 'error', // Disallow unused variables
'@typescript-eslint/no-floating-promises': 'error', // Require Promise-like statements to be handled
'playwright/consistent-spacing-between-blocks': 'error', // Enforce consistent spacing between test blocks
'playwright/expect-expect': 'error', // Enforce assertion to be made in a test body
'playwright/max-nested-describe': 'off', // Enforce a maximum depth to nested describe calls
'playwright/no-conditional-expect': 'error', // Disallow calling expect conditionally
'playwright/no-conditional-in-test': 'error', // Disallow conditional logic in tests
'playwright/no-element-handle': 'error', // Disallow usage of element handles
'playwright/no-eval': 'error', // Disallow usage of page.$eval() and page.$$eval()
'playwright/no-force-option': 'error', // Disallow usage of the { force: true } option
'playwright/no-nested-step': 'error', // Disallow nested test.step() methods
'playwright/no-page-pause': 'error', // Disallow using page.pause()
'playwright/no-skipped-test': 'error', // Disallow usage of the .skip annotation
'playwright/no-useless-await': 'error', // Disallow unnecessary awaits for Playwright methods
'playwright/no-useless-not': 'error', // Disallow not matchers when a specific matcher exists
'playwright/no-wait-for-selector': 'error', // Disallow usage of page.waitForSelector()
'playwright/no-wait-for-timeout': 'error', // Disallow usage of page.waitForTimeout()
'playwright/missing-playwright-await': 'error', // Enforce Playwright APIs to be awaited
'playwright/no-focused-test': 'error', // Disallow usage of .only annotation
'playwright/no-networkidle': 'error', // Disallow usage of the networkidle option
'playwright/no-standalone-expect': 'error', // Disallow using expect outside of test blocks
'playwright/no-unsafe-references': 'error', // Prevent unsafe variable references in page.evaluate()
'playwright/no-unused-locators': 'error', // Disallow unused page locators
'playwright/no-wait-for-navigation': 'error', // Disallow usage of page.waitForNavigation()
'playwright/prefer-web-first-assertions': 'error', // Suggest using web first assertions
'playwright/valid-describe-callback': 'off', // Enforce valid describe() callback
'playwright/valid-expect': 'error', // Enforce valid expect() usage
'playwright/valid-expect-in-promise': 'error', // Require promises with expectations to be valid
'playwright/valid-test-tags': 'error', // Enforce valid tag format in test blocks
'playwright/valid-title': 'error', // Enforce valid titles
'playwright/max-expects': 'error', // Enforce a maximum number of expects per test
'playwright/no-commented-out-tests': 'error', // Disallow commented out tests
'playwright/no-duplicate-hooks': 'off', // Disallow duplicate setup and teardown hooks
'playwright/no-duplicate-slow': 'error', // Disallow multiple test.slow() calls in the same test
'playwright/no-get-by-title': 'error', // Disallow using getByTitle()
'playwright/no-hooks': 'error', // Disallow setup and teardown hooks
'playwright/no-nth-methods': 'off', // Disallow usage of first(), last(), and nth() methods
'playwright/no-raw-locators': 'off', // Disallow using raw locators
'playwright/no-restricted-locators': 'error', // Disallow specific locator methods
'playwright/no-restricted-matchers': 'error', // Disallow specific matchers and modifiers
'playwright/no-restricted-roles': 'error', // Disallow specific roles in getByRole()
'playwright/no-slowed-test': 'error', // Disallow usage of the .slow annotation
'playwright/prefer-comparison-matcher': 'error', // Suggest using built-in comparison matchers
'playwright/prefer-equality-matcher': 'error', // Suggest using built-in equality matchers
'playwright/prefer-hooks-in-order': 'off', // Prefer having hooks in a consistent order
'playwright/prefer-hooks-on-top': 'off', // Suggest having hooks before any test cases
'playwright/prefer-locator': 'error', // Suggest locators over page methods
'playwright/prefer-lowercase-title': 'error', // Enforce lowercase test names
'playwright/prefer-native-locators': 'error', // Suggest built-in locators over page.locator()
'playwright/prefer-strict-equal': 'off', // Suggest using toStrictEqual()
'playwright/prefer-to-be': 'error', // Suggest using toBe()
'playwright/prefer-to-contain': 'error', // Suggest using toContain()
'playwright/prefer-to-have-count': 'error', // Suggest using toHaveCount()
'playwright/prefer-to-have-length': 'error', // Suggest using toHaveLength()
'playwright/require-hook': 'off', // Require setup and teardown code to be within a hook
'playwright/require-soft-assertions': 'off', // Require assertions to use expect.soft()
'playwright/require-tags': 'off', // Require test blocks to have tags
'playwright/require-to-pass-timeout': 'error', // Require a timeout option for toPass()
'playwright/require-to-throw-message': 'error', // Require a message for toThrow()
'playwright/require-top-level-describe': 'off', // Require test cases and hooks to be inside a describe block
},
},
{
files: ['tests/ui/**/*.ts'],
rules: {
'playwright/require-tags': 'error', // Require test blocks to have tags
},
},
];