"Promise" is now a global - Breaks linting
See original GitHub issueAll 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:
- Created 9 years ago
- Comments:28 (10 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Promise is eventually going to be an existing global, why not do something like:
?
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
The docs show the default way which continues to be
var Promise
, jshint users can use the predef option or different name.