nodegit
nodegit copied to clipboard
[refactor] use async/await syntax?
As I dig through the source, I'm noticing that there's a lot of messy manual Promise chaining, eg. https://github.com/nodegit/nodegit/blob/master/generate/scripts/generateNativeCode.js#L121-L171. Is there a reason not to use async/await syntax? I'd be happy to submit some PRs if maintainers would be interested.
For some context async
/await
syntax has been supported in node.js since v7.6.0 which is from 2017, so we wouldn't be dropping support for barely anyone AFAICT.
I have completed a translation from .then
-ing to async/await for the entire lib/
and lifecycleScripts/
directories. Commits are linked above. There are only a handful of .then
s left in places where they actually appear to be the cleanest solution. Otherwise everything has been refactored to use async/await for clarity.
Everything builds and passes the entire test suite. Throughout the process I also upgraded the test runner from istanbul to nyc. It turns out that istanbul has been deprecated, and nyc is the recommended solution now. See https://github.com/samuela/nodegit/commit/63c801c48f48aa5587e60b99b90211039e602ad5 for more info.
Using async/await syntax also required upgrading jshint, and updating the configuration to use the "esversion": 9
config option instead of esnext
which has been deprecated. See https://github.com/samuela/nodegit/commit/e09963961185d76a4d7e088df4a8d489c35e0289 for more info.
I'd be happy to contribute all these changes upstream if they are of interest to maintainers. Let me know! (cc @implausible @ianhattendorf others?)
Could this be considered?
Why is this being ignored? Is there some good reason to avoid migrating the project to the modern async/await syntax?