Skip to content

Commit a392407

Browse files
committed
Merge branch 'develop' into merge_develop_15
2 parents 5896795 + 788dfd1 commit a392407

File tree

17 files changed

+68
-50
lines changed

17 files changed

+68
-50
lines changed

.circleci/workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33
chrome-stable-version: &chrome-stable-version "138.0.7204.183"
44
chrome-beta-version: &chrome-beta-version "139.0.7258.66"
5-
firefox-stable-version: &firefox-stable-version "137.0"
5+
firefox-stable-version: &firefox-stable-version "141.0"
66

77
orbs:
88
browser-tools: circleci/[email protected]

cli/types/cypress.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,7 @@ declare namespace Cypress {
38283828
validate?: () => Promise<false | void> | void
38293829
}
38303830

3831-
type SameSiteStatus = 'no_restriction' | 'strict' | 'lax'
3831+
type SameSiteStatus = 'no_restriction' | 'strict' | 'lax' | 'unspecified'
38323832

38333833
interface SelectFileOptions extends Loggable, Timeoutable, ActionableOptions {
38343834
/**
@@ -3879,8 +3879,8 @@ declare namespace Cypress {
38793879
*/
38803880
expiry: number
38813881
/**
3882-
* The cookie's SameSite value. If set, should be one of `lax`, `strict`, or `no_restriction`.
3883-
* `no_restriction` is the equivalent of `SameSite=None`. Pass `undefined` to use the browser's default.
3882+
* The cookie's SameSite value. If set, should be one of `lax`, `strict`, `no_restriction`, or `unspecified`.
3883+
* `no_restriction` is the equivalent of `SameSite=None`. Pass `undefined` to use the browser's default ('unspecified' is the default for Firefox 140 and up).
38843884
* Note: `no_restriction` can only be used if the secure flag is set to `true`.
38853885
* @default undefined
38863886
*/

guides/eslint-migration.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,39 +108,50 @@ For each package in the batch:
108108
- In each migrated package, add `@packages/eslint-config` to `devDependencies` (use a relative file path if not published to npm).
109109
- **Add ESLint as a dev dependency:**
110110
- Since `@packages/eslint-config` has ESLint as a peer dependency, add `eslint: "^9.18.0"` to `devDependencies`.
111-
4. **Run lint and autofix:**
111+
4. **Add lint-staged configuration:**
112+
- Add a `lint-staged` section to the package's `package.json`:
113+
```json
114+
{
115+
"lint-staged": {
116+
"**/*.{js,jsx,ts,tsx}": "eslint --fix"
117+
}
118+
}
119+
```
120+
- This ensures that when files are staged for commit, they are automatically linted and fixed using the package's local ESLint configuration.
121+
5. **Run lint and autofix:**
112122
- From the package root, run:
113123
```
114124
npx eslint . --ext .js,.ts,.tsx,.jsx --fix
115125
```
116126
- Manually fix any remaining lint errors.
117-
5. **Verify TypeScript configuration:**
127+
6. **Verify TypeScript configuration:**
118128
- Ensure the package has a valid `tsconfig.json` that works with the new ESLint config.
119129
- Run `npx tsc --noEmit` to check for TypeScript compilation errors.
120130
- Verify that the new ESLint config can properly parse TypeScript files in the package.
121-
6. **Run tests for the package** to ensure nothing broke.
122-
7. **Commit changes** with a clear message, e.g.:
131+
7. **Run tests for the package** to ensure nothing broke.
132+
8. **Commit changes** with a clear message, e.g.:
123133
```
124134
chore(npm/grep): migrate to @packages/eslint-config and remove legacy eslint-plugin-dev
125135
```
126136
127-
### 3. **Open a PR for Each Batch**
137+
### 4. **Open a PR for Each Batch**
128138
- Keep each migration PR focused (one batch per PR).
129139
- List all affected packages in the PR description.
130140
- Include a checklist for each package:
131141
- [ ] Removed old ESLint config
132142
- [ ] Added new config
143+
- [ ] Added lint-staged configuration
133144
- [ ] Ran lint and fixed errors
134145
- [ ] Ran tests
135146
136-
### 4. **Document Issues or Gaps**
147+
### 5. **Document Issues or Gaps**
137148
- If you hit any missing rules or plugin gaps, note them for follow-up.
138149
- If a package needs a custom override, add it in a local `eslint.config.ts` (prefer to upstream to the shared config if possible).
139150
140-
### 5. **Deprecate and Remove Old Plugin**
151+
### 6. **Deprecate and Remove Old Plugin**
141152
- Once all packages are migrated, remove `@cypress/eslint-plugin-dev` from the repo and CI.
142153
143-
### 6. **Simplify Lint-Staged Configuration**
154+
### 7. **Simplify Lint-Staged Configuration**
144155
After all packages are migrated, simplify the lint-staged configuration in root `package.json`:
145156
146157
```json
@@ -152,7 +163,7 @@ After all packages are migrated, simplify the lint-staged configuration in root
152163
}
153164
```
154165

155-
### 7. **Update Lerna/Monorepo Config**
166+
### 8. **Update Lerna/Monorepo Config**
156167
- Ensure all packages reference the new config in their `package.json`/`eslint.config.ts`.
157168
- Update documentation and developer onboarding guides.
158169

@@ -317,6 +328,7 @@ For each package, ensure you've completed:
317328
- [ ] Removed `.eslintrc*` files
318329
- [ ] Created `eslint.config.ts` with proper configuration
319330
- [ ] Added required dependencies (`eslint`, `@packages/eslint-config`, `jiti`)
331+
- [ ] Added lint-staged configuration to `package.json`
320332
- [ ] Created/updated `tsconfig.json` that extends base config
321333
- [ ] Updated ESLint scripts (removed `--ext` flag)
322334
- [ ] Ran `yarn lint` successfully

npm/grep/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"cypress",
4141
"grep"
4242
],
43+
"lint-staged": {
44+
"**/*.{js,jsx,ts,tsx,json}": "eslint --fix"
45+
},
4346
"resolutions": {
4447
"jiti": "^2.4.2"
4548
},

package.json

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -265,27 +265,7 @@
265265
]
266266
},
267267
"lint-staged": {
268-
"npm/grep/**/*.{js,jsx,ts,tsx}": "yarn lint:fix",
269-
"*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
270-
"cli/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
271-
"packages/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
272-
"scripts/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
273-
"system-tests/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
274-
"tooling/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
275-
"npm/angular/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
276-
"npm/cypress-schematic/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
277-
"npm/eslint-plugin-dev/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
278-
"npm/mount-utils/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
279-
"npm/puppeteer/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
280-
"npm/react/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
281-
"npm/svelte/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
282-
"npm/vite-dev-server/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
283-
"npm/vite-plugin-cypress-esm/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
284-
"npm/vue/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
285-
"npm/webpack-batteries-included-preprocessor/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
286-
"npm/webpack-dev-server/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
287-
"npm/webpack-preprocessor/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
288-
"npm/xpath/**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
268+
"**/*.{js,jsx,ts,tsx,json,eslintrc,vue}": "eslint --fix",
289269
"*workflows.yml": "node scripts/format-workflow-file.js"
290270
},
291271
"resolutions": {

packages/driver/cypress/e2e/commands/cookies.cy.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,10 +1374,17 @@ describe('src/cy/commands/cookies', () => {
13741374

13751375
cy.setCookie('five', 'bar')
13761376

1377-
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
1378-
// TODO(webkit): pw webkit has the same issue as firefox (no "unspecified" state), need a patched binary
1379-
if (Cypress.isBrowser('firefox') || Cypress.isBrowser('webkit')) {
1380-
cy.getCookie('five').should('include', { sameSite: 'no_restriction' })
1377+
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1550032
1378+
// Firefox bidi returns "unspecified" for sameSite;
1379+
// webkit & firefox < 135 return "no_restriction" for sameSite;
1380+
// other browsers do not return sameSite at all
1381+
const sameSite = (
1382+
Cypress.isBrowser('webkit')
1383+
) ? 'no_restriction' :
1384+
Cypress.isBrowser('firefox') ? 'unspecified' : null
1385+
1386+
if (sameSite) {
1387+
cy.getCookie('five').should('include', { sameSite })
13811388
} else {
13821389
cy.getCookie('five').should('not.have.property', 'sameSite')
13831390
}
@@ -1515,7 +1522,7 @@ describe('src/cy/commands/cookies', () => {
15151522
assertLogLength(this.logs, 1)
15161523
expect(lastLog.get('error').message).to.eq(stripIndent`
15171524
If a \`sameSite\` value is supplied to \`cy.setCookie()\`, it must be a string from the following list:
1518-
> no_restriction, lax, strict
1525+
> no_restriction, lax, strict, unspecified
15191526
You passed:
15201527
> bad`)
15211528

packages/driver/cypress/e2e/e2e/e2e_cookies.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const cleanse = (cookies) => {
88
})
99
}
1010

11-
const firefoxDefaultSameSite = Cypress.isBrowser({ family: 'firefox' }) ? { sameSite: 'no_restriction' } : {}
11+
const firefoxDefaultSameSite = Cypress.isBrowser({ family: 'firefox' }) ? { sameSite: 'unspecified' } : {}
1212

1313
describe('e2e cookies spec', () => {
1414
it('simple cookie', () => {

packages/driver/cypress/e2e/e2e/origin/cookie_login.cy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ describe('cy.origin - cookie login', { browser: '!webkit' }, () => {
192192
verifyIdpNotLoggedIn({ expectNullCookie: false })
193193
})
194194

195-
// FIXME: Currently in Firefox, the default cookie setting in the extension is no_restriction, which can be set with Secure=false.
196-
it('SameSite=None -> not logged in', { browser: '!firefox' }, () => {
195+
it('SameSite=None -> not logged in', () => {
197196
cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => {
198197
cy.get('[data-cy="username"]').type(username)
199198
cy.get('[data-cy="cookieProps"]').type('SameSite=None')

packages/driver/src/cy/commands/cookies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function pickCookieProps (cookie) {
2121
// different defaults, and Firefox lacks support for `unspecified`, so
2222
// `undefined` is used in lieu of `unspecified`
2323
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
24-
const VALID_SAMESITE_VALUES = ['no_restriction', 'lax', 'strict']
24+
const VALID_SAMESITE_VALUES = ['no_restriction', 'lax', 'strict', 'unspecified']
2525

2626
function normalizeSameSite (sameSite?: string) {
2727
if (_.isUndefined(sameSite)) {

packages/eslint-config/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@
2727
},
2828
"peerDependencies": {
2929
"eslint": "^9.31.0"
30+
},
31+
"lint-staged": {
32+
"**/*.{js,jsx,ts,tsx,json}": "eslint --fix"
3033
}
3134
}

0 commit comments

Comments
 (0)