Closed guywaldman closed 7 years ago
Q: what's the use case for this?
prettier-eslint
will find the eslint config for you based on the filePath.
When you have eslint
installed globally and don't want to add it as a local dep in a particular project.
Does this addon use the locally installed prettier/ESLint or does it bundle it's own?
@briandipalma I use a dependency called prettier-eslint by Kent C. Dodds https://github.com/prettier/prettier-eslint. I guess they install prettier & eslint as a dependency
You can now set the prettier-eslint.eslintPath
via settings.
Hi again! I'm still working through getting things set up correctly and ran into this issue... I think.
I have eslint installed globally via Yarn.
To get the vscode ESLint extension working I set:
"eslint.nodePath": "C:\\Users\\Jeremy\\AppData\\Local\\Yarn\\config\\global\\node_modules"
It works great.
However, after turning on the prettier-eslint-code extension it seems the code is being sent to prettier, but not eslint --fix. Here's what it looks like. Notice the linting errors but the checkbox next to Prettier ESLint.
Adding the setting:
"prettier-eslint.eslintPath": "C:\\Users\\Jeremy\\AppData\\Local\\Yarn\\config\\global\\node_modules"
raises the error
Error: Cannot find module 'C:\Users\Jeremy\AppData\Local\Yarn\config\global\node_modules'
If I run the eslint --fix command by hand, it works.
Thanks again for the help! It's so close to perfect. 😃
Hi @GollyJer
Try replacing
C:\Users\Jeremy\AppData\Local\Yarn\config\global\node_modules
with:
C:\Users\Jeremy\AppData\Local\Yarn\config\global\node_modules\eslint
Does that help?
Hey. Thanks again for all the help.
That doesn't work either. Same behavior. :-/
The eslint folder does exist in that path though.
And what happens if you don't set a path at all?
Same behavior. That's what started me looking down this path. I'm going to install eslint in the project to verify it works as expected that way.
Hey. Wanted to jump back on here and say that when eslint is locally installed prettier-eslint-code works poerfectly. For now, I'm just going to install eslint and eslint-airbnb (and it's 4 dependencies) in all my projects. Thanks!
Okay cool, I am not on windows so I couldn't test that. But on mac you can link the global eslint and it works. Sorry for the inconvenience...
Or alternatively, use
eslint.nodePath
insettings.json
for VSCode.P.S. Thank you for this great extension! Very much appreciated.