Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting to specify what .prettierrc to use #254

Closed
felixfbecker opened this issue Nov 5, 2017 · 11 comments
Closed

Setting to specify what .prettierrc to use #254

felixfbecker opened this issue Nov 5, 2017 · 11 comments
Labels
enhancement locked Please open a new issue and fill out the template instead of commenting.
Milestone

Comments

@felixfbecker
Copy link
Contributor

We share a .prettierrc between multiple repos by publishing it as an npm module, running prettier with

prettier --config ./node_modules/@sourcegraph/prettierc/.prettierrc

prettier-vscode currently does not have a way to configure that, it will not detect any config for the repo, so we have to duplicate the settings, which defeats the purpose of sharing the config. It would be nice to have a setting "prettier.configPath" like "prettier.ignorePath". I know you don't like new settings but this one is to avoid having to use the other settings ;)

@azz
Copy link
Member

azz commented Nov 5, 2017

Workaround, create a .prettierrc with:

module.exports = require('@sourcegraph/prettierc');

@felixfbecker
Copy link
Contributor Author

That's a great idea!

@azz azz added the enhancement label Nov 5, 2017
@kutyel
Copy link

kutyel commented Dec 4, 2017

Regarding this, according to prettier's docs, the .prettierrc file could also be a .yml file but when I try to do so the JSON validation yells at me. Is this intentional? Should I open another issue for this? Thanks in advance! 😍

@azz
Copy link
Member

azz commented Dec 4, 2017

If you're working with yaml in vscode I'd recommend using .prettierrc.yml instead.

@CiGit
Copy link
Member

CiGit commented Dec 4, 2017

@kutyel our extension is associating .prettierrc to JSON. You can change it to yaml if you prefer and it won't yell. Maybe we should remove that default association. And validate only .prettierrc.json

@kutyel
Copy link

kutyel commented Dec 4, 2017

I don't know what is the correct behaviour (cause I am biased) but for me is kinda counter-intuitive that prettier itself allows those formats (without changing the extension of the file) and the vscode-extension itself doesn't. BTW: apart from that, the plugin works perfectly and thanks very much guys for creating it for VSCode! ❤️

@cmckni3
Copy link

cmckni3 commented Nov 21, 2018

Would be nice to be able to use .prettierrc.yaml or .prettierrc.yml

@kachkaev
Copy link
Member

@felixfbecker if you prettier config is in ./node_modules/@sourcegraph/prettierc/.prettierrc, can you simply create a symlink at the root of your project pointing to that file? That might fix the issue you are having, unless I've misunderstood it.

@felixfbecker
Copy link
Contributor Author

I like to avoid symlinks if they are not needed. Many tools do not follow them (because there is risk of infinite loops) and they don’t work by default on Windows <10 / need special permissions.

@ntotten ntotten added this to the Version 3.0 milestone Oct 21, 2019
@ntotten
Copy link
Member

ntotten commented Nov 2, 2019

Feature added in version 3.0

@ntotten ntotten closed this as completed Nov 2, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 12, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

7 participants