prettier doesn't use eslintConfig when modules are installed globally
See original GitHub issuei have installed prettier and eslint extensions in vscode, and enable prettier.eslintIntegration setting.
and i have installed eslint and eslint-config-airbnb-base modules globally in NPM.
but prettier used prettierOptions rather than eslintConfig when i format codes.
example codes:
after formating:
however when i installed prettier-eslint-cli module globally in NPM. then run prettier-eslint .\src\index.js
. it worked as expected. see below.
i think there are some issues when prettier resolving eslintConfig if modules are installed globally. hope it be fixed.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
ESLint with Prettier issues on Yarn global install - Stack Overflow
I just ran into the same issue myself. It appears to be an issue with the newest version of eslint, mine was 4.2.0....
Read more >Failed to load plugin 'prettier' declared in '.eslintrc.js': Cannot ...
If ESLint is installed globally, then make sure ... I tried to uninstall and reinstall all relevant prettier modules, it does not help....
Read more >How to make ESLint work with Prettier avoiding conflicts and ...
Now it's time to create a config file for ESLInt: ./node_modules/eslint/bin/eslint.js --init. Or if you installed it globally you can use:.
Read more >eslint/eslint - Gitter
It has to be installed at the same place as eslint (so if you run eslint globally ... {js,jsx} --quiet Cannot find module...
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 FreeTop 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
Top GitHub Comments
Unless I missed it in the docs, I didn’t see anywhere that in order for prettier.eslintIntegration:true to work you need to have all your eslint dependencies installed locally, not globally. It makes sense now, and I understand why they should be installed locally per project instead of globally. However when I was trying to get this to work for the first time, and happened to have everything installed globally, I’ve been struggling to make it work for a long time…until I came across this issue post.
Maybe in your docs where you write:
you could add something like:
Again, maybe i just missed that info, or the assumption that a dev will know to install all eslint dependencies locally is so strong that you feel it doesn’t need to be stated (i’m still a bit of a newb).
And to be clear…I say none of this mockingly or sarcastically. I love the extension and all the hard work that has gone into this. Just offering up some unsolicited advice from a newish dev.
just created pull request #629
open to all adjustments, improvements, and general verification of the text. I believe it’s accurate, but not 100% certain