brackets-userland / brackets-eslint

Adds ESLint support to Brackets
MIT License
43 stars 15 forks source link

eslint-config-angular support #47

Closed healthypets closed 8 years ago

healthypets commented 8 years ago

Is it possible to get this working with eslint-config-angular?

I have been having issues with it not finding the module, even though I have tried both global and local installations.

Thanks!

zaggino commented 8 years ago

Can you provide a link to your project on github? Or create a sample one if you don't have it. Thanks

healthypets commented 8 years ago

https://github.com/healthypets/project-base

Wasn't sure if you wanted the node modules or not so I intentionally left them. Can do a clean install if necessary. ESLint in brackets throws a 'cannot find module eslint-config-angular' error when trying to lint inside of brackets for lint-test.js

zaggino commented 8 years ago

So, your project is using eslint-config-angular but the error message says this:

image

You can fix it by doing npm install --save eslint-plugin-angular in your project. After that:

image

healthypets commented 8 years ago

Hmm perhaps there is a difference in environment here then.

Mine is showing:

ESLint terminated with error: Error: Cannot find module 'eslint-config-angular' Referenced from: C:\xampp\htdocs\project-base\.eslintrc.js  

I'm on Windows, though that's likely not the only env difference.

zaggino commented 8 years ago

What version of Brackets are you running?

zaggino commented 8 years ago

I recommend trying out latest 1.8 pre-release from here: https://github.com/adobe/brackets/releases or my electron build from here: https://github.com/zaggino/brackets-electron/releases

Brackets before 1.8 doesn't work with eslint version 3

healthypets commented 8 years ago

Currently running Release 1.7 so that would make sense. I'll install that release. Apparently I missed that memo, thanks!

zaggino commented 8 years ago

https://github.com/zaggino/brackets-eslint/issues/36

zaggino commented 8 years ago

Let me know if the upgrade to 1.8 did work for you please.

healthypets commented 8 years ago

Updated the to latest 1.8 pre-release from Brackets. Still getting the following:

ESLint terminated with error: Error: Cannot find module 'eslint-config-angular' Referenced from: C:\xampp\htdocs\project-base\.eslintrc.js

If I just have base rules in the .eslintrc.js then it seems to function fine. It just can't seem to find the module when I use: "extends": "angular"

zaggino commented 8 years ago

When you open brackets console (Debug > Show developer tools or F12), do you have anything else there?

healthypets commented 8 years ago
NodeDebugUtils.js:111 [node-error 2:47:18 PM] [brackets-eslint] Error thrown in executeOnText: Error: Cannot find module 'eslint-config-angular'
Referenced from: C:\xampp\htdocs\project-base\.eslintrc.js
    at Object.ModuleResolver.resolve (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\util\module-resolver.js:75:19)
    at resolve (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config\config-file.js:479:33)
    at load (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config\config-file.js:496:24)
    at C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config\config-file.js:392:36
    at Array.reduceRight (native)
    at applyExtends (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config\config-file.js:363:28)
    at Object.load (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config\config-file.js:530:22)
    at loadConfig (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config.js:64:33)
    at getLocalConfig (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config.js:126:23)
    at Config.getConfig (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\config.js:227:22)
    at processText (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\cli-engine.js:223:27)
    at CLIEngine.executeOnText (C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\node_modules\eslint\lib\cli-engine.js:761:26)
    at C:\Users\User\AppData\Roaming\Brackets\extensions\user\brackets-eslint\dist\node\eslint.js:238:23
    at fs.js:266:14
    at C:\xampp\htdocs\project-base\node_modules\graceful-fs\graceful-fs.js:43:10
    at C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules\fs-extra\node_modules\rimraf\node_modules\graceful-fs\graceful-fs.js:103:5
zaggino commented 8 years ago

I have now tried on second windows machine with your project and npm install eslint-plugin-angular fixes it again. Can't help here. (I'm using brackets-electron for windows on both but that should not make a difference)

healthypets commented 8 years ago

Okay, I will look at setting this up on a clean virtual machine. An acquaintance tried this as well and had the same issue not being able to find the config module. Perhaps a clean env will be different.

Thanks for your time!

zaggino commented 8 years ago

I'd be interesting to find out what the problem is. If you wan't me to provide any settings, installed apps or whatever from my windows machines, let me know. But they are quite normal, latest versions of node, npm, git, etc.

zaggino commented 8 years ago

Please also be sure to test this with https://github.com/zaggino/brackets-electron/releases too when you're at it, thanks!

zaggino commented 8 years ago

I've also released brackets-eslint@3.0.0 which includes a fair bit of refactoring, maybe that'll help too.

karol-majewski commented 8 years ago

Updated Brackets to 1.8 and now ESLint doesn't work at all. It worked just fine with 1.7, but now there's no coming back.

ESLintError: Legacy node process detected, please update to Brackets 1.8 or Brackets-Electron

zaggino commented 8 years ago

Did you install Brackets 1.8 from here? https://github.com/adobe/brackets/releases

zaggino commented 8 years ago

@guess-and-correct 3.0.2 will fix it but you need to use eslint 2.x in your project

karol-majewski commented 8 years ago

@zaggino I did (the .msi package). For what it's worth, when updating ESLint using npm-registry, it threw a couple warnings about npm being too old. Even after updating Brackets to 1.8, npm-registry is still using node v0.10.24 and npm 2.14.5.

zaggino commented 8 years ago

This is now fixed with latest Brackets (includes node v6)