Skip to content

Commit 256a5f9

Browse files
feat(e2e): strict oxlint, oxfmt, and type-aware linting (#5002)
* feat(e2e): migrate to strict oxlint, oxfmt, and type-aware linting Replace ESLint, Prettier, and tsc:check with oxlint --type-aware --type-check and oxfmt in e2e-tests. Add waitForConfigReconciled() for auth provider rollout waits and remove hard waitForTimeout usage across specs and helpers. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(e2e): enable strict TypeScript and resolve all type errors Set strict: true in e2e-tests tsconfig and fix ~235 type errors across specs and utilities with proper guards, error helpers, and typing. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(e2e): keep lint/prettier/tsc script names for OXC toolchain Map existing yarn scripts to oxlint and oxfmt so docs, CI, and lint-staged keep using lint:check, lint:fix, prettier:check, prettier:fix, and tsc:check. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(e2e): simplify OXC scripts to lint and fmt Use lint/lint:fix and fmt/fmt:check script names, remove tsc and legacy prettier script aliases. Type-aware settings remain in oxlint.config.ts. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(e2e): enable strict oxlint plugins and burn down violations Add import, node, and promise plugins with suspicious-as-error categories, promote Playwright and type-aware unsafe-* rules to error, and fix the resulting violations across helpers, specs, and support code. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(e2e): derive locale and audit types from as const arrays Use single-source-of-truth const tuples for Locale and audit log enums, and loop LOCALES when merging translation bundles. Co-authored-by: Cursor <cursoragent@cursor.com> * ci: retrigger checks after base branch change Co-authored-by: Cursor <cursoragent@cursor.com> * fix(e2e): restore Playwright fixture destructuring for testInfo hooks Oxlint no-empty-pattern conflicted with Playwright's required `{}` callback shape; the _args workaround passed lint but broke test collection in Prow. Disable no-empty-pattern for spec files and add yarn test:list to GHA. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(e2e): resolve strict-mode and audit log validation regressions Restore Log stack parsing dropped by the typed constructor refactor, use .first() for ambiguous increment buttons after locator migration, and revert annotator catalog check to verifyText which handles duplicates. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(e2e): restore card scoping and catalog import assertions Revert application-provider to per-card DOM selectors that avoid strict mode on shared article headings, and stop expecting undefined from registerExistingComponent which returns a boolean. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(e2e): use inline oxlint disable for application-provider locators Replace file-level no-raw-locators override with a scoped block comment next to the nested div card selectors, matching repo convention. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(e2e): restore helper-based assertions from oxlint burn-down Await whitelisted POM helpers directly instead of expect().resolves.toBeUndefined(), revert inline locators to uiHelper.verify* where helpers encode strictness, and drop redundant post-YAML expects covered by inspectEntityAndVerifyYaml. Co-authored-by: Cursor <cursoragent@cursor.com> * chore(e2e): adopt Oxfmt defaults with import and package.json sort Use Oxfmt-recommended defaults (printWidth 100, sortPackageJson) and enable sortImports. Reformat the full e2e-tests tree so fmt:check stays green. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 65bcea6 commit 256a5f9

79 files changed

Lines changed: 3414 additions & 4329 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/e2e-tests-lint.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
lint:
16-
name: TSC, ESLint, ShellCheck and Prettier
16+
name: Oxlint, Oxfmt, and ShellCheck
1717
runs-on: ubuntu-latest
1818

1919
steps:
@@ -33,18 +33,18 @@ jobs:
3333
working-directory: ./e2e-tests
3434
run: yarn install --mode=skip-build
3535

36-
- name: Run TypeScript Compiler check
36+
- name: Run Oxlint
3737
working-directory: ./e2e-tests
38-
run: yarn tsc:check
38+
run: yarn lint
3939

40-
- name: Run ESLint check
40+
- name: Verify Playwright test collection
4141
working-directory: ./e2e-tests
42-
run: yarn lint:check
42+
run: yarn test:list
4343

4444
- name: Run ShellCheck
4545
working-directory: ./e2e-tests
4646
run: yarn shellcheck
4747

48-
- name: Run Prettier check
48+
- name: Run Oxfmt check
4949
working-directory: ./e2e-tests
50-
run: yarn prettier:check
50+
run: yarn fmt:check

e2e-tests/.lintstagedrc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
export default {
55
"*.sh": "shellcheck --severity=warning --color=always",
6-
"*": "yarn prettier:fix",
6+
"*": "yarn fmt",
77
"*.{js,jsx,ts,tsx,mjs,cjs}": "yarn lint:fix",
8-
"*.{ts,tsx}": () => "yarn tsc:check",
98
};

e2e-tests/.oxfmtrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"sortImports": true,
4+
"ignorePatterns": [".local-test", "coverage"]
5+
}

e2e-tests/.prettierrc.cjs

Lines changed: 0 additions & 50 deletions
This file was deleted.

e2e-tests/eslint.config.js

Lines changed: 0 additions & 136 deletions
This file was deleted.

e2e-tests/oxlint.config.ts

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import { defineConfig } from "oxlint";
2+
3+
export default defineConfig({
4+
plugins: ["eslint", "typescript", "unicorn", "oxc", "import", "node", "promise"],
5+
categories: {
6+
correctness: "error",
7+
suspicious: "error",
8+
},
9+
options: {
10+
typeAware: true,
11+
typeCheck: true,
12+
},
13+
jsPlugins: ["eslint-plugin-playwright", "eslint-plugin-check-file"],
14+
ignorePatterns: [
15+
"node_modules/**",
16+
"playwright-report/**",
17+
"test-results/**",
18+
"coverage/**",
19+
".local-test/**",
20+
],
21+
rules: {
22+
"typescript/no-floating-promises": "error",
23+
"typescript/await-thenable": "error",
24+
"typescript/no-unsafe-assignment": "error",
25+
"typescript/no-unsafe-member-access": "error",
26+
"typescript/no-unsafe-call": "error",
27+
"typescript/no-unsafe-return": "error",
28+
"typescript/strict-void-return": "error",
29+
"check-file/filename-naming-convention": [
30+
"error",
31+
{
32+
"**/*.{js,ts,jsx,tsx}": "KEBAB_CASE",
33+
},
34+
{
35+
ignoreMiddleExtensions: true,
36+
},
37+
],
38+
"check-file/folder-naming-convention": [
39+
"error",
40+
{
41+
"**": "KEBAB_CASE",
42+
},
43+
],
44+
"playwright/no-wait-for-timeout": "error",
45+
"playwright/no-force-option": "error",
46+
"playwright/expect-expect": "error",
47+
"playwright/valid-expect": "error",
48+
"playwright/prefer-native-locators": "error",
49+
"playwright/no-raw-locators": [
50+
"error",
51+
{
52+
allowed: [],
53+
},
54+
],
55+
"playwright/no-skipped-test": [
56+
"error",
57+
{
58+
allowConditional: true,
59+
},
60+
],
61+
},
62+
overrides: [
63+
{
64+
files: ["playwright/e2e/auth-providers/**/*.spec.ts"],
65+
rules: {
66+
"typescript/strict-void-return": "off",
67+
},
68+
},
69+
{
70+
files: ["**/*.spec.ts", "**/*.test.ts", "playwright/**/*.ts"],
71+
rules: {
72+
// Playwright requires object destructuring for hook/test callbacks that take
73+
// testInfo as a second argument (e.g. async ({}, testInfo) =>). Oxlint's
74+
// no-empty-pattern rejects {}; disable it here so lint and runtime agree.
75+
"eslint/no-empty-pattern": "off",
76+
"playwright/valid-title": "off",
77+
"playwright/valid-describe-callback": "off",
78+
"playwright/no-wait-for-selector": "off",
79+
"playwright/expect-expect": [
80+
"error",
81+
{
82+
assertFunctionNames: [
83+
"expect",
84+
"toPass",
85+
"verifyHeading",
86+
"verifyQuickAccess",
87+
"verifyLink",
88+
"verifyRowsInTable",
89+
"verifyRowInTableByUniqueText",
90+
"verifyDivHasText",
91+
"verifyComponentInCatalog",
92+
"verifyParagraph",
93+
"verifyText",
94+
"verifyTextinCard",
95+
"verifyVisitedCardContent",
96+
"verifyAboutCardIsDisplayed",
97+
"verifyPRStatisticsRendered",
98+
"verifyPRRows",
99+
"verifyPRRowsPerPage",
100+
"registerExistingComponent",
101+
"inspectEntityAndVerifyYaml",
102+
"runAccessibilityTests",
103+
"validateLog",
104+
"validateLogEvent",
105+
"validateRbacLogEvent",
106+
"checkRbacResponse",
107+
"verifyTextInSelector",
108+
"verifyPartialTextInSelector",
109+
"loginAsGuest",
110+
"waitForTitle",
111+
],
112+
},
113+
],
114+
},
115+
},
116+
],
117+
});

0 commit comments

Comments
 (0)