Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-undef Promise #51

Open
dermike opened this issue Dec 12, 2016 · 14 comments
Open

no-undef Promise #51

dermike opened this issue Dec 12, 2016 · 14 comments

Comments

@dermike
Copy link

dermike commented Dec 12, 2016

Hello!

Thanks for this great plugin!
I have a, for me at least, weird problem with it. In Brackets with brackets-eslint I get this error:

ERROR: 'Promise' is not defined. [no-undef] return new Promise((resolve, reject) => {

I don't get the error however when checking it with eslint manually. As far as I can tell I'm using eslint 3.12.0 both globally and in brackets-eslint. My .eslintrc is in my ~/directory.

I can get around the error by adding /* global Promise: true */, but wish I didn't have to since it works without it in "normal" eslint. Hope this can be fixed or if anyone can spot something I've setup wrong.

cheers!

@zaggino
Copy link
Member

zaggino commented Dec 12, 2016

Hi @dermike
have you tried this?
eslint/eslint#4085 (comment)

@dermike
Copy link
Author

dermike commented Dec 12, 2016

@zaggino No, that's definitely a better solution! ..but my question is kind of still the same, why it works without it with CLI eslint and not brackets-eslint. 🤔

@dermike
Copy link
Author

dermike commented Dec 12, 2016

No error with gulp-eslint either, only brackets-eslint

@zaggino
Copy link
Member

zaggino commented Dec 12, 2016

If you can create a sample project I can clone and replicate the issue I'm happy to take a look. Otherwise I won't be guessing. I use this daily for a large number of projects without issue, although I must admit, all of them have .eslintrc in their project root. I have never tried using .eslintrc in home directory.

@zaggino
Copy link
Member

zaggino commented Dec 12, 2016

What's your OS, Mac or Linux? I'm primary a Windows user, not sure if the node domain of Brackets doesn't run under a different user so it can't find the .eslintrc in home dir.

@dermike
Copy link
Author

dermike commented Dec 12, 2016

I'm on Mac OS. I've created this repo which also includes my .eslintrc:
https://github.com/dermike/brackets-eslint-issue

Still getting the no-undef error with brackets-eslint even if it's in the project dir.

@zaggino
Copy link
Member

zaggino commented Dec 12, 2016

If you have .eslintrc in your project, brackets-eslint requires you to have installed eslint in your project dir and uses that installation. It only uses global installation when there's no .eslintrc defined. Rationale is that if you specify .eslintrc file, you also need to install exact version of eslint you want to lint with.

When I do npm install eslint in your project after cloning it my result looks like this:
image

Maybe you have an old version of eslint inside your project's node_modules ?

@dermike
Copy link
Author

dermike commented Dec 12, 2016

No, I only have it installed globally... installed latest version in the issue repo now and still the same error. Must be something Mac specific then I guess.

@zaggino
Copy link
Member

zaggino commented Dec 12, 2016

Have you tried re-installing brackets-eslint ?
Latest version should ask you to install eslint locally:
https://github.com/zaggino/brackets-eslint/blob/7cf8f61a73edd4c9f1f6d3bb64c71be5784df39d/src/node/eslint.ts#L279-L283

@dermike
Copy link
Author

dermike commented Dec 12, 2016

Remove and reinstalled and same error... did not ask me to install locally.

@zaggino
Copy link
Member

zaggino commented Dec 12, 2016

What version of Brackets are you on? 1.7 or 1.8? I'll check the code why that's the case.

@dermike
Copy link
Author

dermike commented Dec 12, 2016 via email

@zaggino
Copy link
Member

zaggino commented Dec 12, 2016

Try updating to brackets-eslint@3.0.3. I can't replicate this so I won't spend any more time on this but feel free to dig around if you want and submit a PR.

@dermike
Copy link
Author

dermike commented Dec 13, 2016

Tried with 3.0.3 and it works if I open the project directory in Brackets. Both the undef and ask to install eslint in the project. So this probably worked yesterday too, only had the file from the project open, not the project itself. So try reproducing it if you have another project open (without a local .eslintrc), and just open test.js separately.

Still getting the error though if I don't have a project local .eslintrc and eslint installed, or the current project dir opened. (I usually don't switch projects completely when I open other files from other projects). It works on other files outside of the current project as long as eslint is installed in there.

Wish there was a way it worked with my home directory .eslintrc only, but adding that globals config is good enough. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants