Override Promises

The promise is now a global reserved word in es6, and the lint throws an error. So what are the pitfalls of this

var Promise = require("bluebird"); 

or should i do

 var BluebirdPromise = require("bluebird"); 
+7
javascript ecmascript-6 bluebird es6-promise
source share
2 answers

There seems to be no problem updating the promise if it is not global. But the second is the best approach.

Many of us do this. No problems. You just use faster exercise, that's all. But note that you can use more and more promises provided by various libraries, so these are very limited replacements (there are discussions in the node world about ways to define a library as a global promise provider). - Denis Segurett

+2
source share

Simply put, these lines are inside .jshintrc

 { "undef": true, "unused": true, "predef": [ "-Promise" ] } 
+2
source share

All Articles