question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Promise" is now a global - Breaks linting

See original GitHub issue

All of my builds are now failing because of jshint/jshint#1747

In short: Promise is a global reserved word and the latest jshint version will break with the error “Redefinition of ‘Promise’.”.

Case in point by @rwaldron:

Would you write this?

var Array = require("my-array-implementation");

…or pave over any other built-in object?

A strategy has to be devised to move Bluebird away from this conflict, documents, globals, etc, with an urgency for the README.md file.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:28 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
myndzicommented, Sep 1, 2014

Promise is eventually going to be an existing global, why not do something like:

var Bluebird = require('bluebird');
Bluebird.extend(Promise); 

?

This would fill in all the methods that don’t already exist, allow to continue using Promise, which is good for not having to edit a bunch of lines in old code, and satisfy JSHint all at once…?

If you don’t actually have the global Promise constructor, it would create it as a global

0reactions
petkaantonovcommented, Aug 27, 2014

The docs show the default way which continues to be var Promise, jshint users can use the predef option or different name.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No Floating Promises: an eslint rule to prevent async code errors
The article discusses the ESLint rule "no-floating-promises" which disallows promises without await. The rule is designed to prevent ...
Read more >
Local Install of ESLint Breaks In-Editor Linting
Currently this means requiring the team to install eslint, the current plugins and any future plugins globally, which is not ideal.
Read more >
25. Promises for asynchronous programming - Exploring JS
Promises provide a better way of working with callbacks: Now an asynchronous function returns a Promise, an object that serves as a placeholder...
Read more >
EsLint - Suppress "Do not use 'new' for side effects"
Now, if I satisfy EsLint, my app craps out: Uncaught (in promise) TypeError: Cannot set property '_handleMouse' of undefined(…) eslint.
Read more >
Keep Your Promises in TypeScript using async/await
Now create an async function called startAsync . This function is actually quite similar to the start function that we had written before....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found