-
Notifications
You must be signed in to change notification settings - Fork 27
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
refactors var into let/const #70
Conversation
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.
i see you are saying you changed them in "all of the source files", but the first few modified files are the build output. did you change the sources and re-run the builds, or did you change the builds themselves? in either case, it means implicit deprecation of browsers which don't support that syntax (about 3.6%).
here is where i got that number from:
https://caniuse.com/?search=let
if we don't care about IE <11, Firefox <44, etc., then this is fine. i'd imagine we ought to let the build system take care of the legwork regarding let
/const
though.
The changes in the build files are the result of running the build script before final testing. I guess Rollup decided to do something a little different with the ES6 syntax EDIT: Oh wait, I see what you mean. Not sure how that happened, let me push up a quick fix. |
ah, seems like you are right. i think it is because we only use babel in our testing, not our building. i just went down a rabbit hole trying to figure out where the hell that browser detection regex stuff i noticed in the webextension came from. turns out it was added by @poorejc , looks like it is just the inlined content of the library. this isn't relevant in this PR, especially given the change is like two years old at this point, but it is a shame we had to drop being "runtime dependency free" for that browser detection stuff. to not be entirely unhelpful, i tried to get our build system to do the
// near the top, with the other imports
const {babel: rollupBabel} = require('@rollup/plugin-babel');
//in the gulp.task('rollup'... plugins
commonjs({ include: /node_modules/ }),
rollupBabel({ babelHelpers: "runtime", exclude: /node_modules/, plugins: ["@babel/plugin-transform-block-scoping"] }), doing this seemed to result in a relatively small diff to the build outputs, and transforms any |
Very nice! I also noticed that we weren't transpiling in our builds and thought it was odd. Glad it was an easy fix! |
Regarding |
personally, im not terribly sure of the value of it at all. @poorejc probably has more context, but it being in the extension build seems pointless, as the return value of example of such a library: |
@confusingstraw RE 'detect-browser'. Yes, some time ago our core user group made some strong requests for browser characteristics. Did some research and, at the time, 'detect-browser' appeared to check the boxes (well used on npm, upvoted on stack). Fully open to updating to a better library. I'll pull your suggestion into a new ticket, Rob. NOTE: obviously the request was for inclusion into the client library. No one is using the web extension in production. It's inclusion there is a side effect of our build process. |
added to #71 |
@UncleGedd does this branch include commits for Gulp refactor? Looking through these comments, it seems like it does. However there are some merge conflicts in the Gulp refactor PR but not this one. Just curious if I should mess around with the previous PR, or go straight to this one. |
@JPoore, this PR does not include the commits for the Gulp refactor. Each PR (both this one and the Gulp refactor) started from the master branch. We are using Rollup inside the Gulp build tasks which is why it is mentioned in some of the comments above. Also, I'm happy to pair on the merges if that would be helpful. EDIT: took care of the merge conflicts in the Gulp refactor PR |
OK, @UncleGedd awesome. I'll get to testing and pushing these tonight. Sorry, was running a bit behind this week--little busier than expected. |
Updates Variable Declarations to ES6 syntax
A todo in the codebase was to change
var
tolet
(see attachHandlers.js), so I went ahead and updated all of the source files (not including the web extension) to use the appropriatelet
/const
ES6 syntax.