Skip to content

Bump eslint to v8.14 and remove window typeof check in registry #6181

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

Merged
merged 3 commits into from
May 9, 2022

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented May 6, 2022

New valid-typeof rule catch what appears to be a bug in src/registry.
@plotly/plotly_js

@archmoj archmoj added bug something broken status: reviewable labels May 6, 2022
src/registry.js Outdated
@@ -276,7 +276,7 @@ function registerTraceModule(_module) {
// add `PlotlyGeoAssets` global to stash references to all fetched
// topojson / geojson data
if((bpmName === 'geo' || bpmName === 'mapbox') &&
(typeof window !== undefined && window.PlotlyGeoAssets === undefined)
(typeof window !== 'undefined' && window.PlotlyGeoAssets === undefined)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The condition here is still not strict enough.
I suggest we use:

Suggested change
(typeof window !== 'undefined' && window.PlotlyGeoAssets === undefined)
(typeof window === 'object' && window.PlotlyGeoAssets === undefined)

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's the only place we do typeof window at all, everywhere else we just assume it's present. Given that as is it's always going to give true, can't we just remove that condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We also test for window here:

if(window && window.process && window.process.versions) {

@archmoj archmoj added type: maintenance and removed bug something broken labels May 6, 2022
@archmoj archmoj changed the title Bump eslint to v8.14 and fix window typeof comparison value in registry Bump eslint to v8.14 and remove window typeof check in registry May 6, 2022
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

💃

@archmoj archmoj merged commit 57dee2e into master May 9, 2022
@archmoj archmoj deleted the eslint-v8.14 branch May 9, 2022 11:04
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.

2 participants