-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathindex.ts
164 lines (159 loc) · 6.75 KB
/
index.ts
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import globals from 'globals'
import expectExpect from './rules/expect-expect.js'
import maxExpects from './rules/max-expects.js'
import maxNestedDescribe from './rules/max-nested-describe.js'
import missingPlaywrightAwait from './rules/missing-playwright-await.js'
import noCommentedOutTests from './rules/no-commented-out-tests.js'
import noConditionalExpect from './rules/no-conditional-expect.js'
import noConditionalInTest from './rules/no-conditional-in-test.js'
import noDuplicateHooks from './rules/no-duplicate-hooks.js'
import noElementHandle from './rules/no-element-handle.js'
import noEval from './rules/no-eval.js'
import noFocusedTest from './rules/no-focused-test.js'
import noForceOption from './rules/no-force-option.js'
import noGetByTitle from './rules/no-get-by-title.js'
import noHooks from './rules/no-hooks.js'
import noNestedStep from './rules/no-nested-step.js'
import noNetworkidle from './rules/no-networkidle.js'
import noNthMethods from './rules/no-nth-methods.js'
import noPagePause from './rules/no-page-pause.js'
import noRawLocators from './rules/no-raw-locators.js'
import noRestrictedMatchers from './rules/no-restricted-matchers.js'
import noSkippedTest from './rules/no-skipped-test.js'
import noSlowedTests from './rules/no-slowed-test.js'
import noStandaloneExpect from './rules/no-standalone-expect.js'
import noUnsafeReferences from './rules/no-unsafe-references.js'
import noUselessAwait from './rules/no-useless-await.js'
import noUselessNot from './rules/no-useless-not.js'
import noWaitForSelector from './rules/no-wait-for-selector.js'
import noWaitForTimeout from './rules/no-wait-for-timeout.js'
import preferComparisonMatcher from './rules/prefer-comparison-matcher.js'
import preferEqualityMatcher from './rules/prefer-equality-matcher.js'
import preferHooksInOrder from './rules/prefer-hooks-in-order.js'
import preferHooksOnTop from './rules/prefer-hooks-on-top.js'
import preferLocator from './rules/prefer-locator.js'
import preferLowercaseTitle from './rules/prefer-lowercase-title.js'
import preferNativeLocators from './rules/prefer-native-locators.js'
import preferStrictEqual from './rules/prefer-strict-equal.js'
import preferToBe from './rules/prefer-to-be.js'
import preferToContain from './rules/prefer-to-contain.js'
import preferToHaveCount from './rules/prefer-to-have-count.js'
import preferToHaveLength from './rules/prefer-to-have-length.js'
import preferWebFirstAssertions from './rules/prefer-web-first-assertions.js'
import requireHook from './rules/require-hook.js'
import requireSoftAssertions from './rules/require-soft-assertions.js'
import requireToThrowMessage from './rules/require-to-throw-message.js'
import requireTopLevelDescribe from './rules/require-top-level-describe.js'
import validDescribeCallback from './rules/valid-describe-callback.js'
import validExpect from './rules/valid-expect.js'
import validExpectInPromise from './rules/valid-expect-in-promise.js'
import validTitle from './rules/valid-title.js'
const index = {
configs: {},
rules: {
'expect-expect': expectExpect,
'max-expects': maxExpects,
'max-nested-describe': maxNestedDescribe,
'missing-playwright-await': missingPlaywrightAwait,
'no-commented-out-tests': noCommentedOutTests,
'no-conditional-expect': noConditionalExpect,
'no-conditional-in-test': noConditionalInTest,
'no-duplicate-hooks': noDuplicateHooks,
'no-element-handle': noElementHandle,
'no-eval': noEval,
'no-focused-test': noFocusedTest,
'no-force-option': noForceOption,
'no-get-by-title': noGetByTitle,
'no-hooks': noHooks,
'no-nested-step': noNestedStep,
'no-networkidle': noNetworkidle,
'no-nth-methods': noNthMethods,
'no-page-pause': noPagePause,
'no-raw-locators': noRawLocators,
'no-restricted-matchers': noRestrictedMatchers,
'no-skipped-test': noSkippedTest,
'no-slowed-test': noSlowedTests,
'no-standalone-expect': noStandaloneExpect,
'no-unsafe-references': noUnsafeReferences,
'no-useless-await': noUselessAwait,
'no-useless-not': noUselessNot,
'no-wait-for-selector': noWaitForSelector,
'no-wait-for-timeout': noWaitForTimeout,
'prefer-comparison-matcher': preferComparisonMatcher,
'prefer-equality-matcher': preferEqualityMatcher,
'prefer-hooks-in-order': preferHooksInOrder,
'prefer-hooks-on-top': preferHooksOnTop,
'prefer-locator': preferLocator,
'prefer-lowercase-title': preferLowercaseTitle,
'prefer-native-locators': preferNativeLocators,
'prefer-strict-equal': preferStrictEqual,
'prefer-to-be': preferToBe,
'prefer-to-contain': preferToContain,
'prefer-to-have-count': preferToHaveCount,
'prefer-to-have-length': preferToHaveLength,
'prefer-web-first-assertions': preferWebFirstAssertions,
'require-hook': requireHook,
'require-soft-assertions': requireSoftAssertions,
'require-to-throw-message': requireToThrowMessage,
'require-top-level-describe': requireTopLevelDescribe,
'valid-describe-callback': validDescribeCallback,
'valid-expect': validExpect,
'valid-expect-in-promise': validExpectInPromise,
'valid-title': validTitle,
},
}
const sharedConfig = {
rules: {
'no-empty-pattern': 'off',
'playwright/expect-expect': 'warn',
'playwright/max-nested-describe': 'warn',
'playwright/missing-playwright-await': 'error',
'playwright/no-conditional-expect': 'warn',
'playwright/no-conditional-in-test': 'warn',
'playwright/no-element-handle': 'warn',
'playwright/no-eval': 'warn',
'playwright/no-focused-test': 'error',
'playwright/no-force-option': 'warn',
'playwright/no-nested-step': 'warn',
'playwright/no-networkidle': 'error',
'playwright/no-page-pause': 'warn',
'playwright/no-skipped-test': 'warn',
'playwright/no-standalone-expect': 'error',
'playwright/no-unsafe-references': 'error',
'playwright/no-useless-await': 'warn',
'playwright/no-useless-not': 'warn',
'playwright/no-wait-for-selector': 'warn',
'playwright/no-wait-for-timeout': 'warn',
'playwright/prefer-web-first-assertions': 'error',
'playwright/valid-describe-callback': 'error',
'playwright/valid-expect': 'error',
'playwright/valid-expect-in-promise': 'error',
'playwright/valid-title': 'error',
},
} as const
const legacyConfig = {
...sharedConfig,
env: {
'shared-node-browser': true,
},
plugins: ['playwright'],
}
const flatConfig = {
...sharedConfig,
languageOptions: {
globals: globals['shared-node-browser'],
},
plugins: {
playwright: index,
},
}
// @ts-expect-error We author this plugin in ESM, but export as CJS for
// compatibility with ESLint<9. Long term, this will be changed to `export default`.
export = {
...index,
configs: {
'flat/recommended': flatConfig,
'playwright-test': legacyConfig,
recommended: legacyConfig,
},
}