重新定义承诺

Redefinition of Promise

Promise 现在是 es6 中的全局保留字,并且 linters 会抛出错误。那么这样做有什么坑

var Promise = require("bluebird");

或者我应该做

var BluebirdPromise = require("bluebird");

只要不是全局的,重新声明 promise 似乎没有问题。但第二种方法更好

Many of us do that. There's no problem. You're just using a faster implementation, that's all. But note that you may use more and more promises given by various libraries, so this is a very limited replacement (there are discussions in the node world about ways to define a library as a global promise provider). – Denys Séguret

只需将这些行放在 .jshintrc

{
  "undef": true,
  "unused": true,
  "predef": [ "-Promise" ]
}