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.

Custom Prettier Resolution

See original GitHub issue

Instead of needing to have prettier installed in your current folder’s node_modules directory it’d be nice to have the option to specify where you’d like the extension to look for your prettier installation. Resolution strategy would be as follows:

  1. If “prettier.path” is defined try to use that.
  2. See if there’s a copy in the current directory’s node_modules folder.
  3. Use a copy of prettier bundled with the installation.

The issue I ran into: I’m using yarn workspaces and it hoists dependencies if they’re shared between different workspaces. Because of this my prettier installation isn’t in the individual workspace’s node_modules folder. It’d be nice to have the ability to set the following in my .vscode/settings.json file:

"prettier.path": "../../node_modules/prettier"

Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:20
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

7reactions
Bnayacommented, Oct 20, 2017

Same issue here, with mono repo

Failed to load prettier from /Users/.../project-root/packages/webapp/node_modules/prettier. Using bundled

yarn workspace is hoisting prettier to project-root/node_modules

2reactions
jannikbuschkecommented, Jul 25, 2019

Is there any workaround at the moment? Using lerna and prettier gets hoisted. Im suspecting this is why VS code does not apply prettier on save.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration File - Prettier
A .prettierrc.toml file. The configuration file will be resolved starting from the location of the file being formatted, and searching up the file...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
You can configure JavaScript code auto-formatting with Prettier to work ... Format JSON files with Prettier; Use custom settings overrides.
Read more >
Prettier vscode extension ignoring config files - Stack Overflow
And in the official docs, the config file resolution precedence is: A "prettier" key in your package.json file. A .prettierrc file written in ......
Read more >
Efficient workflow with ESLint and Prettier - Dhanraj Padmashali
How I configure ESLint and Prettier to catch style and code issues ... module resolution, module alias/mapping and custom file extensions.
Read more >
vim-prettier - A vim plugin wrapper for prettier : vim online
A vim plugin wrapper for prettier, pre-configured with custom default prettier settings. ... You can send commands to the resolved `prettier` cli by:...
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