Skip to content
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 publish test for avoiding function constructors in non-gl(2d|3d) partial bundles #5383

Merged
merged 5 commits into from
Jan 7, 2021

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Jan 7, 2021

Thanks to #5358 and #5359 pull requests, most partial bundles namely basic, cartesian, finance, geo and mapbox no longer have function constructors.

This PR adds tests in publish container to lock this for future bundles.
cc: #897

@plotly/plotly_js

@archmoj archmoj added this to the v1.59.0 milestone Jan 7, 2021
.circleci/config.yml Outdated Show resolved Hide resolved
package.json Outdated
@@ -31,6 +31,7 @@
"watch": "node tasks/watch.js",
"lint": "eslint --version && eslint .",
"lint-fix": "eslint . --fix || true",
"no-new-func": "eslint --no-ignore --no-eslintrc --rule '{no-new-func: error}' dist/plotly-finance.js dist/plotly-basic.js dist/plotly-cartesian.js dist/plotly-geo.js dist/plotly-mapbox.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice simple command 🌟 I wonder though, is it possible to express this as a list of bundles to exclude - ie "test everything in dist/*js except *.min.js and plotly.js and plotly-gl3d.js and ..." that way over time we simply remove exclusions from the list, and any new bundle we create is automatically included?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in c611031.

package.json Outdated
@@ -31,6 +31,7 @@
"watch": "node tasks/watch.js",
"lint": "eslint --version && eslint .",
"lint-fix": "eslint . --fix || true",
"no-new-func": "eslint --debug --no-ignore --no-eslintrc --rule '{no-new-func: error}' $(ls dist/plotly*.js | grep -v plotly-locale* | grep -v plotly-gl* | grep -v plotly-with-meta.* | grep -v plotly.js | grep -v plotly.min.js)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! Probably don't need debug long-term, right? And I feel like we might as well include the locales in this test, for completeness... we know they're safe but wouldn't hurt to prove it.

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.

Looks great - just a nonblocking comment to consider. 💃

@archmoj
Copy link
Contributor Author

archmoj commented Jan 7, 2021

There are also a number of function constructors in MathJax code:

Mathjax

@nicolaskruchten
Copy link
Contributor

let's exclude MathJax then, it's basically "not our problem"

@archmoj archmoj merged commit 177842f into master Jan 7, 2021
@archmoj archmoj deleted the test-avoid-function-constructors-in-partial-bundles branch January 7, 2021 14:39
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.

3 participants