chore: apply "injected" eslint rules to "isomorphic" (#34953)

This commit is contained in:
Dmitry Gozman 2025-02-27 16:31:05 +00:00 committed by GitHub
parent ad64f8d859
commit 70cc2b14e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -253,7 +253,11 @@ export default [{
'no-console': 'off'
}
}, {
files: ['packages/playwright-core/src/server/injected/**/*.ts'],
files: [
'packages/playwright-core/src/server/injected/**/*.ts',
'packages/playwright-core/src/server/isomorphic/**/*.ts',
'packages/playwright-core/src/utils/isomorphic/**/*.ts',
],
languageOptions: languageOptionsWithTsConfig,
rules: {
...noWebGlobalsRules,

View File

@ -129,10 +129,13 @@ export function source() {
function serialize(value: any, handleSerializer: (value: any) => HandleOrValue, visitorInfo: VisitorInfo): SerializedValue {
if (value && typeof value === 'object') {
// eslint-disable-next-line no-restricted-globals
if (typeof globalThis.Window === 'function' && value instanceof globalThis.Window)
return 'ref: <Window>';
// eslint-disable-next-line no-restricted-globals
if (typeof globalThis.Document === 'function' && value instanceof globalThis.Document)
return 'ref: <Document>';
// eslint-disable-next-line no-restricted-globals
if (typeof globalThis.Node === 'function' && value instanceof globalThis.Node)
return 'ref: <Node>';
}