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
consolidate global and require() usages #569
Conversation
It's commit like this where I wish Github provides a diff mode that ignore whitespace changes... 😅 |
So this will hopefully solve #568 and more - @oliviertassinari if you can verify this that would be helpful! And we can actually review the diff with whitespace changes ignored 👏 |
@@ -1,6 +1,6 @@ | |||
(function() { | |||
'use strict'; | |||
'use strict'; |
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.
This is a browser file and strict is fine in the function.
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.
strict
rule from eslint
complaints - do you want me to add /* eslint-disable */
instead?
@XhmikosR both comments addressed, PR rebased |
@@ -1,5 +1,8 @@ | |||
{ | |||
"env": { | |||
"browser": true | |||
}, | |||
"rules": { | |||
"strict": "off" |
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.
Have you just tried setting node to false without turning off strict?
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.
No dice 😕
{
"env": {
"browser": true,
"node": false
}
}
gives
114:2 error Use the function form of 'use strict' strict
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.
Weird, I'd expect it to handle the browser case. How about strict: [2, "function"]
? Can you test if it works OK for both cases? Otherwise there is the safe
option too.
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 think it's more to do with the Google Analytics code at the bottom of the script?
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.
If that's the case please just add eslint ignore around the snippet.
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.
"node": false
would mean I need to add /* global: require */
as well - but okay, I'll get them 😅
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.
Then keep node...
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.
Alright:
- keep
node: true
- change to
strict: [2, "function"]
- add
/* eslint-disable */
before GA
Sounds about right?
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.
👍
@XhmikosR amended last commit to adjust eslint rules |
merge browserify tasks into one single pass for online package generation fixes #295
Editted commit message to close relevant issue. |
Ship it.
|
https://github.com/kangax/html-minifier/pull/569/files?w=1 Sadly you can not comment in this mode. |
Long time coming and is much needed by now! :) |
Next step — ES6 via babel :) |
Will you make the switch? :) BTW I'm thinking we might need to find another parser.
|
Nope, nothing to do with Babel. Babel broke because the author of one of the (npm) dependencies pulled them out. |
Hopefully this will keep the source code clean from multiple module import paths, and makes it more readable plus happy with things like
webpack
etc.