Skip to content

chore: Eslint migration foundation + migrate npm/grep package #32046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

cacieprins
Copy link
Contributor

Additional details

This is a pared down PR related to #30892

It includes:

  • The new shared eslint config
  • A migration guide, including troubleshooting steps discovered while migrating npm/grep
  • An example migration in ./npm/grep

Steps to test

How has the user experience changed?

PR Tasks

@cacieprins cacieprins force-pushed the eslint-migration-foundation branch from 5c327f5 to 831af8d Compare July 17, 2025 13:28
@jennifer-shehane
Copy link
Member

@MikeMcC399 Might be curious to get your eyes on this (if you have time), since you've been handling eslint config in the other repos so nicely. Particularly the guide outline.

Copy link

cypress bot commented Jul 17, 2025

cypress    Run #64013

Run Properties:  status check failed Failed #64013  •  git commit 09a88ac975: fix linting of primary eslint config pkg
Project cypress
Branch Review eslint-migration-foundation
Run status status check failed Failed #64013
Run duration 46m 55s
Commit git commit 09a88ac975: fix linting of primary eslint config pkg
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 13
Tests that did not run due to a developer annotating a test with .skip  Pending 1233
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 32048
View all changes introduced in this branch ↗︎
UI Coverage  45.83%
  Untested elements 190  
  Tested elements 165  
Accessibility  97.95%
  Failed rules  3 critical   8 serious   2 moderate   2 minor
  Failed elements 107  

Tests for review

Failed  cypress/e2e/studio/studio-cloud.cy.ts • 1 failed test • app-e2e

View Output

Test Artifacts
Studio Cloud > opens a cloud studio session with AI marked as coming soon Test Replay Screenshots
Flakiness  issues/28527.cy.ts • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
issue 28527 > fails and then retries and verifies about:blank is not displayed Test Replay Screenshots
Flakiness  commands/waiting.cy.js • 1 flaky test • 5x-driver-chrome

View Output

Test Artifacts
... > errors > throws when waiting for 1st response to bar Test Replay
Flakiness  issues/28527.cy.ts • 1 flaky test • 5x-driver-chrome

View Output

Test Artifacts
issue 28527 > fails and then retries and verifies about:blank is not displayed Test Replay Screenshots
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-chrome:beta

View Output

Test Artifacts
... > stops waiting when an fetch request is canceled Test Replay
Flakiness  e2e/e2e_cookies.cy.js • 1 flaky test • 5x-driver-chrome:beta

View Output

Test Artifacts
e2e cookies spec > __Host- prefix > can set __Host- cookie Test Replay

The first 5 flaky specs are shown, see all 13 specs in Cypress Cloud.


**After ESLint 9.x:**
```json
"lint": "eslint ."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The . is also no longer needed. See https://eslint.org/docs/latest/use/command-line-interface

"@typescript-eslint/parser": "7.2.0",
"eslint": "^9.18.0",
"eslint-import-resolver-typescript": "3.8.2",
"eslint-plugin-cypress": "^4.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are only working with ESLint 9.x flat configuration, then you should upgrade to "eslint-plugin-cypress": "^5.1.0"

The 4.x version is no longer maintained.

"eslint-import-resolver-typescript": "3.8.2",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-import-x": "^4.6.1",
"eslint-plugin-mocha": "^10.5.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider upgrading to eslint-plugin-mocha@11

@MikeMcC399
Copy link
Contributor

@jennifer-shehane

Might be curious to get your eyes on this (if you have time), since you've been handling eslint config in the other repos so nicely. Particularly the guide outline.

I only have some general comments:

@jennifer-shehane jennifer-shehane changed the title chore: Eslint migration foundation chore: Eslint migration foundation + migrate npm/grep package Jul 18, 2025
cursor[bot]

This comment was marked as outdated.

@cacieprins
Copy link
Contributor Author

@MikeMcC399 Thank you so much for the feedback!

@cacieprins
Copy link
Contributor Author

@MikeMcC399 I'm considering whether, after the migration in this repo, switching eslint-config out to the npm package as a major version upgrade. It's not right now to allow for a progressive migration in this repo, though. Thanks for bringing that up!

},
"include": ["e2e/**/*.ts"]
"include": [
"**/*.ts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember why we needed to touch the tsconfig here?

@@ -132,8 +132,6 @@ function shouldTestRunTitle (parsedGrep, testName) {
}

if (!Array.isArray(parsedGrep)) {
console.error('Invalid parsed title grep')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did we omit these errors? I think they are part of the source and we likely want to maintain the code here

Copy link
Contributor Author

@cacieprins cacieprins Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think that was a --fix - before I turned no-console off for this pkg

"lint": "eslint"
},
"dependencies": {
"jiti": "^2.4.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is jiti a peer dependency or something that we need to include here?

Copy link
Contributor Author

@cacieprins cacieprins Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jiti is a dependency of eslint one of these eslint plugins, but a few dependencies of frontend-shared depend on an older version of jiti. Yarn doesn't install the version that one of the eslint pugins here needs, so node uses thet older version of jiti via hoisting. Declaring it here prevents it from using the hoisted version.


{
// rules that are gold standard, but have many violations
// these are off while developing eslint, but should eventually be enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in other words we need to disable these rules temporarily because there is an overwhelming amount of errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, they're not currently rules that are applied to the project, but ones that would be good to turn on.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Invalid Glob Pattern Causes Incorrect File Exclusion

The lint-staged glob pattern **/[!npm/{grep}]/**/*.{js,jsx,ts,tsx,json,eslintrc,vue} is invalid. The [!npm/{grep}] syntax is a character class negation, matching single characters, not the npm/grep directory path. This prevents files within npm/grep from being correctly excluded from linting, potentially applying incorrect ESLint configurations or causing unexpected behavior. The pattern should use proper glob negation (e.g., !npm/grep/** or !(npm/grep)/**).

package.json#L268-L271

cypress/package.json

Lines 268 to 271 in 09a88ac

"*.coffee": "yarn stop-only --folder",
"npm/{grep}/**/*.{js,jsx,ts,tsx}": "yarn lint:fix",
"**/[!npm/{grep}]/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
"*workflows.yml": "node scripts/format-workflow-file.js"

Fix in CursorFix in Web


Bug: Debugging Statements Removed by ESLint

Two console.error statements, intended for debugging invalid parsed grep input by logging "Invalid parsed title grep" and the parsedGrep object, were unintentionally removed. This occurred due to eslint --fix running before the no-console rule was properly configured for the package.

npm/grep/src/utils.js#L134-L136

if (!Array.isArray(parsedGrep)) {
console.error('Invalid parsed title grep')
console.error(parsedGrep)

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

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.

4 participants