-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Use ESM #71
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.
Its interesting to see how code can change overtime.. especially with the introduction of esm. Nice!
@BarryThePenguin any particular parts or things that changed you found interesting? Agreed, but curious to hear your thoughts! |
console.log('javascript', require('util').inspect(table, {depth: 3})) | ||
console.log('javascript', inspect(table, {depth: 3})) |
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 probably more specific to remark-usage
being used but..
I've never really been a fan of using require
inline like this. ESM forces static imports to be defined at the beginning of the module.
Sure, there are dynamic imports. However, now that code path needs to be asynchronous
var siblings = parent.children | ||
var tail = siblings[siblings.length - 1] | ||
var index = -1 | ||
var item | ||
const siblings = parent.children | ||
const tail = siblings[siblings.length - 1] | ||
let index = -1 |
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 ESM related.. but the distinction of which var
became a let
or const
is interesting. Seeing the distinction like this is useful 👍🏻
Also, the scope of item
changing from function scope to block scope 👀
Initial checklist
Description of changes
Note: I’ll update
mdast-util-to-string
later, which causes a small change in output. And I’ll update to use JSDoc based types in another PR too — turned off dtslint meanwhile