Skip to content

chore(packages/runner): migrate to @packages/eslint-config - #35175

Merged
jennifer-shehane merged 3 commits into
developfrom
eslint/r13-runner
Oct 27, 2026
Merged

jennifer-shehane merged 3 commits into
developfrom
eslint/r13-runner

Conversation

@jennifer-shehane

@jennifer-shehane jennifer-shehane commented Oct 27, 2026 •

Copy link
Copy Markdown
Member
  • Closes N/A. This is one slice of the ESLint 9 flat-config migration tracked in guides/eslint-migration.md.

Additional details

This PR moves @packages/runner onto the shared flat config. It's two commits, and the second one can be dropped on its own if you'd rather keep this PR runner-only.

1. Migration (ee67320)

  • Adds eslint.config.ts with baseConfig, jsonConfig and tsconfigRootDir. The window/parent globals from injection/.eslintrc.json are now scoped to injection/**, and the generated *.scss.d.ts typings stay ignored. The handwritten index.d.ts lints clean, so the old blanket **/*.d.ts ignore is gone.
  • package.json gets the eslint, @packages/eslint-config and jiti devDependencies, "lint": "eslint" and a lint-staged key. jsonConfig also reordered the top-level keys, which is expected. Runner is added to the root lint:fix scope and ticked off in the guide.
  • no-unsafe-finally (3 sites in the cross-origin fetch/XHR patches): each return inside finally is now try { … } catch {} followed by the call. Errors from our own bookkeeping are still swallowed so the user's request goes out, and errors thrown by the original fetch/open/send still propagate, exactly as before.
  • ban-ts-comment: each @ts-ignore became @ts-expect-error - <reason>. Three of them in webpack.config.ts no longer suppressed anything, so they're deleted.
  • prefer-const: this is new since chore: enable prefer-const in the shared ESLint flat config #35169. Two late-assigned lets became const where they're assigned. That's safe because the closures that read them can't run before that line.
  • No rules were relaxed. tslint stays in check-ts, matching errors and launcher.

2. Types instead of suppressions (3ec7bf2)

  • packages/web-config: the getCommonConfig/getSimpleConfig literals and the sass rule now use satisfies webpack.Configuration/RuleSetRule, so fields like enforce and resolve.fallback keep their literal types. That removes four suppressions in runner. The exported shapes don't change otherwise, and reporter still type-checks and builds.
  • packages/driver/types: adds request:sent:with:credentials to Cypress.Backend. The server only emits for it, so it returns Promise<void>.
  • Runner: the babel-loader lookup now narrows with flatMap instead of lodash.find.
  • One @ts-expect-error remains, on the prism plugin push. The babel plugins array is typed from web-config's own entries, and typing it properly means restructuring getCommonConfig.

Steps to test

  • yarn lint --scope @packages/runner
  • yarn check-ts --scope @packages/runner --scope @packages/reporter --scope @packages/web-config
  • yarn health-check (needs a built tree, because knip loads runner's webpack config, which waits on icons/dist)
  • yarn workspace @packages/runner build: the bundle still includes the prism plugin output

Runner has no unit tests of its own (they moved to @packages/app). The cross-origin patch behavior is exercised by packages/driver/cypress/e2e/e2e/origin/patches.cy.ts in CI.

How has the user experience changed?

No change.

PR Tasks

  • [na] Is there an associated issue with maintainer approval for PR submission? This is a mechanical lint migration from the tracked checklist.
  • [na] Have tests been added/updated?
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions? The only type change is in the driver's internal types.

Generated by Claude Code


Note

Low Risk
Mechanical lint migration with intentional control-flow refactors in cross-origin patches that preserve “don’t block the user request” behavior; no user-facing API changes.

Overview
Migrates @packages/runner to ESLint 9 flat config (eslint.config.ts with shared baseConfig/jsonConfig), drops legacy .eslintignore and injection .eslintrc.json (globals scoped to injection/**), and wires lint-staged, eslint, jiti, and root lint:fix scope. The migration checklist marks runner complete.

Lint-driven code fixes in runner: cross-origin fetch/XHR patches replace no-unsafe-finally finally+return with try/catch so internal bookkeeping errors still don’t block user requests; prefer-const and formatting tweaks in injection utils/timers/cookies.

Supporting typing cleanup (no intended runtime change): packages/web-config uses satisfies webpack.Configuration on shared webpack helpers so runner’s webpack.config.ts drops most @ts-ignore and narrows babel-loader lookup without lodash; Cypress.Backend gains request:sent:with:credentials so runner can call Cypress.backend without suppressions.

Reviewed by Cursor Bugbot for commit 193dba2. Bugbot is set up for automated code reviews on this repo. Configure here.

Move @packages/runner onto the shared ESLint 9 flat config, with
jsonConfig, and drop its .eslintignore and injection/.eslintrc.json.
The window/parent globals are now scoped to injection/**, and the
generated *.scss.d.ts typings stay ignored.

- Rewrite the three return-in-finally blocks in the cross-origin
  fetch/XHR patches as try/catch followed by the call. Errors from
  Cypress's own bookkeeping are still swallowed so the request goes
  out, and errors from the original fetch/open/send still propagate.
- Turn @ts-ignore into described @ts-expect-error, deleting the three
  in webpack.config.ts that no longer suppressed anything.
- Apply prefer-const and stylistic autofixes, and reorder package.json
  keys per jsonConfig.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r24y62FhjfjSRy1R2V
- web-config: check the getCommonConfig/getSimpleConfig literals and the
  sass rule with `satisfies`, so fields like enforce and resolve.fallback
  keep their literal types and the configs assign to
  webpack.Configuration without suppression.
- driver types: add 'request:sent:with:credentials' to Cypress.Backend.
- runner: narrow the babel-loader lookup with flatMap instead of lodash.

One @ts-expect-error remains, on the prism plugin push, since the babel
plugins array is typed from web-config's own entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r24y62FhjfjSRy1R2V
@cypress

cypress Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

cypress    Run #75026

Run Properties:  status check passed Passed #75026  •  git commit 193dba2780: Merge branch 'develop' into eslint/r13-runner
Project cypress
Branch Review eslint/r13-runner
Run status status check passed Passed #75026
Run duration 17m 03s
Commit git commit 193dba2780: Merge branch 'develop' into eslint/r13-runner
Committer Claude
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 13
Tests that did not run due to a developer annotating a test with .skip  Pending 1036
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 30034
View all changes introduced in this branch ↗︎
UI Coverage  67.12%
  Untested elements 24  
  Tested elements 49  
Accessibility  98.98%
  Failed rules  0 critical   3 serious   2 moderate   0 minor
  Failed elements 18  

@jennifer-shehane jennifer-shehane self-assigned this Oct 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r24y62FhjfjSRy1R2V
@jennifer-shehane
jennifer-shehane merged commit a4c26a3 into develop Oct 27, 2026
88 of 89 checks passed
@jennifer-shehane
jennifer-shehane deleted the eslint/r13-runner branch October 27, 2026 16:16
jennifer-shehane pushed a commit that referenced this pull request Oct 27, 2026
#35175 typed getCommonConfig() with `satisfies webpack.Configuration`,
so `mode` is no longer inferred as `string` and the directive on the
reporter's config is unused. webpack-cli type-checks the config, so the
stale directive failed build-for-tests with TS2578.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r3jb5WdjcbUvWd3r8b
jennifer-shehane added a commit that referenced this pull request Oct 27, 2026
* chore: migrate @packages/reporter to @packages/eslint-config

Move @packages/reporter to the shared ESLint 9 flat config, with
jsonConfig so package.json keeps being linted.

- Add eslint.config.ts (baseConfig + jsonConfig) and drop .eslintrc.json,
  .eslintignore and cypress/.eslintrc.json. The cypress and mocha globals
  those files enabled come from the shared config's eslint-plugin-cypress
  and eslint-plugin-mocha presets. The cypress/fixtures ignore carries
  over, and the old **/*.d.ts ignore narrows to the generated
  *.scss.d.ts typings, so index.d.ts is linted now. tailwind.config.js
  gets the __dirname global the old node env provided.
- Add @packages/eslint-config, eslint and jiti devDependencies, a plain
  `eslint` lint script and a per-package lint-staged key. The first
  `--fix` reordered package.json top-level keys, as jsonConfig expects.
- Drop the tslint script from check-ts and port its no-floating-promises
  rule as @typescript-eslint/no-floating-promises over the files
  tsconfig.json covers (src/** and cypress/**/*.ts). Cypress chainables
  are not flagged.
- Add the package to the root lint:fix scope.
- Turn every @ts-ignore into @ts-expect-error with a reason, as
  ban-ts-comment requires. Nine directives suppressed nothing and were
  removed.
- Fix the React rules the old config never loaded here: escape the
  quotes in runnable-header, type the children prop in tag.cy.tsx, and
  add rel='noreferrer' to the external docs link in runnables.tsx.
- Tick the package off in guides/eslint-migration.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r3jb5WdjcbUvWd3r8b

* chore: replace reporter @ts-expect-error directives with type-safe code

Address review of the @packages/reporter ESLint migration.

- hook-model: return a boolean from the filter predicate so it matches
  lodash's overloads.
- attempt-model: narrow LogProps with an `in` check for sessionInfo, and
  bind this.err to a local so the guard's narrowing reaches the callback.
- shortcuts: guard isTextLike with $dom.isElement. It checks nodeType, so
  unlike `instanceof HTMLElement` it holds for targets from the reporter's
  iframe document, which the shortcuts are also bound to.
- Spec directive reasons named the fixtures as the source of the optional
  types; they come from the specs' own RootRunnable and Partial<Err>
  declarations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r3jb5WdjcbUvWd3r8b

* chore: drop reporter webpack @ts-expect-error fixed upstream

#35175 typed getCommonConfig() with `satisfies webpack.Configuration`,
so `mode` is no longer inferred as `string` and the directive on the
reporter's config is unused. webpack-cli type-checks the config, so the
stale directive failed build-for-tests with TS2578.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r3jb5WdjcbUvWd3r8b

* chore: type reporter code instead of suppressing with @ts-expect-error

Replace eight @ts-expect-error directives with code that type-checks.
None changes runtime behavior.

- webpack.config.ts: spread `config.plugins ?? []`, since Configuration
  types plugins as optional.
- err-model: declare codeFrame optional. It is undefined until update()
  sets it, which the type now says.
- switch: type onUpdate and the click handler with React's MouseEvent,
  which is what onClick passes. No caller reads the event.
- Specs: keep the spy cy.spy() returns and call withArgs on it, rather
  than on runner.emit, whose EventEmitter type has no withArgs.
- runnables_store spec: the requestAnimationFrame stub passes a timestamp
  and returns a request ID, matching the DOM signature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r3jb5WdjcbUvWd3r8b

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants