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.

prettier doesn't use eslintConfig when modules are installed globally

See original GitHub issue

i 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: image after formating: image however when i installed prettier-eslint-cli module globally in NPM. then run prettier-eslint .\src\index.js. it worked as expected. see below. image i think there are some issues when prettier resolving eslintConfig if modules are installed globally. hope it be fixed.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ndstephenscommented, Nov 3, 2018

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:

prettier.eslintIntegration (default: false) - JavaScript and TypeScript only Use prettier-eslint instead of prettier. Other settings will only be fallbacks in case they could not be inferred from ESLint rules.

you could add something like:

prettier-eslint already installed with extension. All other eslint dependencies need to be installed locally

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.

1reaction
ndstephenscommented, Nov 9, 2018

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

Read more comments on GitHub >

github_iconTop 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 >
Install - Prettier
First, install Prettier locally:
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 >

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