-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
base: develop
Are you sure you want to change the base?
Conversation
5c327f5
to
831af8d
Compare
831af8d
to
8c27e00
Compare
@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. |
cypress
|
Project |
cypress
|
Branch Review |
eslint-migration-foundation
|
Run status |
|
Run duration | 46m 55s |
Commit |
|
Committer | Cacie Prins |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
1
|
|
13
|
|
1233
|
|
0
|
|
32048
|
View all changes introduced in this branch ↗︎ |
UI Coverage
45.83%
|
|
---|---|
|
190
|
|
165
|
Accessibility
97.95%
|
|
---|---|
|
3 critical
8 serious
2 moderate
2 minor
|
|
107
|
Tests for review
cypress/e2e/studio/studio-cloud.cy.ts • 1 failed test • app-e2e
Test | Artifacts | |
---|---|---|
Studio Cloud > opens a cloud studio session with AI marked as coming soon |
Test Replay
Screenshots
|
issues/28527.cy.ts • 1 flaky test • 5x-driver-electron
Test | Artifacts | |
---|---|---|
issue 28527 > fails and then retries and verifies about:blank is not displayed |
Test Replay
Screenshots
|
commands/waiting.cy.js • 1 flaky test • 5x-driver-chrome
Test | Artifacts | |
---|---|---|
... > errors > throws when waiting for 1st response to bar |
Test Replay
|
issues/28527.cy.ts • 1 flaky test • 5x-driver-chrome
Test | Artifacts | |
---|---|---|
issue 28527 > fails and then retries and verifies about:blank is not displayed |
Test Replay
Screenshots
|
commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-chrome:beta
Test | Artifacts | |
---|---|---|
... > stops waiting when an fetch request is canceled |
Test Replay
|
e2e/e2e_cookies.cy.js • 1 flaky test • 5x-driver-chrome:beta
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.
guides/eslint-migration.md
Outdated
|
||
**After ESLint 9.x:** | ||
```json | ||
"lint": "eslint ." |
There was a problem hiding this comment.
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
packages/eslint-config/package.json
Outdated
"@typescript-eslint/parser": "7.2.0", | ||
"eslint": "^9.18.0", | ||
"eslint-import-resolver-typescript": "3.8.2", | ||
"eslint-plugin-cypress": "^4.1.0", |
There was a problem hiding this comment.
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.
packages/eslint-config/package.json
Outdated
"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", |
There was a problem hiding this comment.
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
I only have some general comments:
|
@MikeMcC399 Thank you so much for the feedback! |
@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", |
There was a problem hiding this comment.
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?
npm/grep/src/utils.js
Outdated
@@ -132,8 +132,6 @@ function shouldTestRunTitle (parsedGrep, testName) { | |||
} | |||
|
|||
if (!Array.isArray(parsedGrep)) { | |||
console.error('Invalid parsed title grep') |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
… from eslint-config
There was a problem hiding this 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
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" |
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
Lines 134 to 136 in 09a88ac
if (!Array.isArray(parsedGrep)) { | |
console.error('Invalid parsed title grep') | |
console.error(parsedGrep) |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Additional details
This is a pared down PR related to #30892
It includes:
npm/grep
./npm/grep
Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?