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

Style Guide suggestion on Promises #9078

Closed
stacey-gammon opened this issue Nov 15, 2016 · 3 comments
Closed

Style Guide suggestion on Promises #9078

stacey-gammon opened this issue Nov 15, 2016 · 3 comments
Labels

Comments

@stacey-gammon
Copy link
Contributor

I think we should be consistent in our use of native vs bluebird promises, as it can be confusing in the code to figure out which type is being used.

I'd like to propose that we add a style guide entry around this:

  • Use native promises where ever possible and reasonable
  • If you must use bluebird, and you are returning a Promise from an exported function, wrap it in a native promise. That way everyone can assume that a Promise returned from a function is of the native type.

Open for debate!

@epixa
Copy link
Contributor

epixa commented Nov 15, 2016

A million times, yes. Using bluebird is an implementation detail of a module, it shouldn't be exported directly otherwise the API of the module is the API of bluebird.

@Bargs
Copy link
Contributor

Bargs commented Nov 16, 2016

Agreed. The styleguide should also recommend adding unit tests for this sort of API contract, otherwise it would be very easy to accidentally break.

@stacey-gammon
Copy link
Contributor Author

Final decision: use native promises . More info on this discuss issue too: #13855

Closing, this is no longer active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants