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
add eslint-plugin-no-typeof-window-undefined
#4587
Changes from all commits
bb03e2d
0fdc668
43d54a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -246,6 +246,11 @@ describe('QueryClientProvider', () => { | |||||
}) | ||||||
|
||||||
test('should not use window to get the context when contextSharing is true and window does not exist', () => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test failed after my changes with
here
So I simulate undefined document like here
I could do it in another 2 places (but the test passed). Search for |
||||||
const { document } = globalThis | ||||||
|
||||||
// @ts-expect-error | ||||||
delete globalThis.document | ||||||
|
||||||
const queryCache = new QueryCache() | ||||||
const queryClient = createQueryClient({ queryCache }) | ||||||
|
||||||
|
@@ -269,6 +274,7 @@ describe('QueryClientProvider', () => { | |||||
|
||||||
expect(queryClientFromHook).toEqual(queryClient) | ||||||
|
||||||
globalThis.document = document | ||||||
windowSpy.mockRestore() | ||||||
}) | ||||||
}) | ||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Not sure if it's better to specify this plugin config (with a single rule) or specify it in plugins and enable this rule specifically.