-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathoxlint.config.ts
More file actions
166 lines (165 loc) · 5.57 KB
/
Copy pathoxlint.config.ts
File metadata and controls
166 lines (165 loc) · 5.57 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
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
165
166
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["eslint", "typescript", "unicorn", "oxc", "import", "node", "promise"],
categories: {
correctness: "error",
suspicious: "error",
pedantic: "error",
},
options: {
typeAware: true,
typeCheck: true,
},
jsPlugins: ["eslint-plugin-playwright", "eslint-plugin-check-file"],
ignorePatterns: [
"node_modules/**",
"playwright-report/**",
"test-results/**",
"coverage/**",
".local-test/**",
"scripts/**",
],
rules: {
"typescript/no-floating-promises": "error",
"typescript/await-thenable": "error",
"typescript/no-unsafe-assignment": "error",
"typescript/no-unsafe-member-access": "error",
"typescript/no-unsafe-call": "error",
"typescript/no-unsafe-return": "error",
"typescript/strict-void-return": "error",
"typescript/prefer-readonly-parameter-types": "off",
"check-file/filename-naming-convention": [
"error",
{
"**/*.{js,ts,jsx,tsx}": "KEBAB_CASE",
},
{
ignoreMiddleExtensions: true,
},
],
"check-file/folder-naming-convention": [
"error",
{
"**": "KEBAB_CASE",
},
],
"playwright/no-wait-for-timeout": "error",
"playwright/no-force-option": "error",
"playwright/expect-expect": "error",
"playwright/valid-expect": "error",
"playwright/prefer-native-locators": "error",
"playwright/no-raw-locators": [
"error",
{
allowed: [],
},
],
"playwright/no-skipped-test": [
"error",
{
allowConditional: true,
},
],
},
overrides: [
{
// Auth-provider specs deploy RHDH in beforeAll and use async Playwright hooks.
// strict-void-return and no-misused-promises produce false positives on those
// describe/beforeAll callbacks without improving test safety.
files: ["playwright/e2e/auth-providers/**/*.spec.ts"],
rules: {
"typescript/strict-void-return": "off",
"typescript/no-misused-promises": "off",
},
},
{
// Spec files orchestrate multi-step E2E flows; length limits target production
// code readability, not test scenarios that must stay in one file for clarity.
files: ["**/*.spec.ts", "**/*.test.ts"],
rules: {
"eslint/max-lines": "off",
"eslint/max-lines-per-function": "off",
},
},
{
// Shared infrastructure (utils, support, data, e2e helpers) is split into
// modules but still contains cohesive orchestration (kube waits, deployment
// setup, log parsing). Complexity limits would force artificial fragmentation.
files: [
"playwright/utils/**/*.ts",
"playwright/support/**/*.ts",
"playwright/data/**/*.ts",
"playwright/e2e/**/*.ts",
],
rules: {
"eslint/max-lines": "off",
"eslint/max-lines-per-function": "off",
"eslint/max-depth": "off",
},
},
{
// Facade modules aggregate many submodules by design (e.g. KubeClient re-exports,
// rhdh-deployment orchestration, locale translation maps). A flat import count
// does not reflect coupling when each import is a focused submodule.
files: ["playwright/utils/**/*.ts", "playwright/e2e/localization/**/*.ts"],
rules: {
"import/max-dependencies": "off",
},
},
{
// valid-title / valid-describe-callback: existing suite uses legacy naming
// patterns that do not match the plugin's strict conventions.
// no-wait-for-selector: replaced with expect() and locator.waitFor() per
// hardening guidelines; rule would flag intentional migration patterns.
// expect-expect + assertFunctionNames: POM verify* helpers and loginAsGuest
// perform assertions on behalf of the spec; register them so specs are not
// forced to duplicate expect() calls after every helper invocation.
files: ["**/*.spec.ts", "**/*.test.ts", "playwright/**/*.ts"],
rules: {
// Playwright requires object destructuring for hook/test callbacks that take
// testInfo as a second argument (e.g. async ({}, testInfo) =>). Oxlint's
// no-empty-pattern rejects {}; disable it here so lint and runtime agree.
"eslint/no-empty-pattern": "off",
"playwright/valid-title": "off",
"playwright/valid-describe-callback": "off",
"playwright/no-wait-for-selector": "off",
"playwright/expect-expect": [
"error",
{
assertFunctionNames: [
"expect",
"toPass",
"verifyHeading",
"verifyQuickAccess",
"verifyLink",
"verifyRowsInTable",
"verifyRowInTableByUniqueText",
"verifyDivHasText",
"verifyComponentInCatalog",
"verifyParagraph",
"verifyText",
"verifyTextinCard",
"verifyVisitedCardContent",
"verifyAboutCardIsDisplayed",
"verifyPRStatisticsRendered",
"verifyPRRows",
"verifyPRRowsPerPage",
"registerExistingComponent",
"inspectEntityAndVerifyYaml",
"runAccessibilityTests",
"validateLog",
"validateLogEvent",
"validateRbacLogEvent",
"checkRbacResponse",
"verifyTextInSelector",
"verifyPartialTextInSelector",
"loginAsGuest",
"restartDeployment",
"waitForTitle",
],
},
],
},
},
],
});