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 not defined. (no-undef)

See original GitHub issue
  • ESLint Version: 4.14.0
  • Node Version: 6.11.1
  • npm Version: 5.3.0

What parser (default, Babel-ESLint, etc.) are you using? default

const promise = new Promise((resolve, reject) => {});

eslint config

{
	"env": {
		"browser": true,
		"node": true
	},
	"parserOptions": {
		"ecmaVersion": 6,
		"sourceType": "script"
	},
	"extends": ["kentcdodds/possible-errors", "kentcdodds/best-practices"],
	"rules": {
		"global-require": "off"
	}
}

What did you expect to happen? No un-def error for es6 globals (Promise)

What actually happened? Throws un-def error for ‘Promise’

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

32reactions
j-f1commented, Jan 6, 2018

Do you have es6: true set under the env key in your ESLint config?

3reactions
platinumazurecommented, Jan 6, 2018

@bharathvaj1995 ecmaVersion only affects the parser, so it allows ES6 syntax (such as let/const). The environment will set ecmaVersion for you, but will also enable all of the ES6 globals (such as Promise, Map, Set). If you want ES7 (or later) and ES6 globals, you would do env es6:true and ecmaVersion: (something greater than 6)… Hope that makes sense!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESlint : which config for Promise and Async - Stack Overflow
/*eslint no-undef: 0*/. Or you can change the eslint config file (change the rules). And you are good to go! Hope this helps!...
Read more >
How to Fix “Promise resolver undefined is not a function” in ...
The promise executor is a function accepting two other functions: resolve and reject . If you're running into the “Promise resolver undefined ......
Read more >
no-undef - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
ReferenceError: "x" is not defined - JavaScript - MDN Web Docs
The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
Read more >
eslint error 'Promise' is not defined no-undef の対処方法
eslint error Promise is not defined no-undef の対処方法を紹介します。 eslintで下記のようにPromiseが定義されていませんとエラーが出る場合が ...
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