-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Run Prettier only if project contains prettier configuration #182
Comments
Hi @charlyx , How did you install Otherwise you can always do the following:
Please note that depending on your OS the installation of |
Hi @mitermayer, thanks for your answer. I don't have any problem running prettier. I'm asking for a feature I believe does not exist. My problem is that I would like to not run prettier on every project. I would like to be able to run it only if my project is configured for using prettier. This is what I described in my issue:
I hope my message makes it clearer. Do you have any idea on the subject though? |
That sounds like a reasonable feature request I can work on it |
@mitermayer did you have a chance to work on it? If not, I'd be happy to make a PR. Do you have any guidelines to get me started? |
Hi @charlyx , Sorry been super busy lately with work! A PR would be super welcome! If you do a PR to |
I would also love this feature. Just remember that not all projects have a prettier configuration file. Some use the default prettier configuration. Perhaps vim-prettier could run only if prettier is named as a direct dependency in package.json. |
In the meantime, I solved this by adding this to my let g:prettier#autoformat = 0
if filereadable(findfile('.prettierrc.js', '.;'))
echo "Using prettier..."
autocmd BufWritePre *.js,*.jsx,*mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
endif This implementation only searches parent directories for |
FYI: I have a branch that has a new However, I haven't submitted a PR yet because I haven't been able to get this to work under @mitermayer Do you have any guidance on how to proceed here? Maybe I should wait until the |
Update: I've opened a formal PR here. There are still a few loose ends to tie up but feel free to comment. |
I will aim to look into this sometime this week or next weekend, been very busy at work but I really want to release 1.x soon! There are some bugs that i want to fix and some "todo" that i want to clean, but overall is very stable |
👋 Just checking in - I know the holidays are coming up so no pressure if you're still tight on time. I've been using this change pretty regularly over the last month or so and have no major issues to report.. |
Hi @atomdmac, will try to get on this in the holidays! sorry trying to wrap up end of the year goals at work |
This issue has been fixed already by @atomdmac |
I updated my plugin and Im still having this issue. Am I missing something? |
Will reopen this issue for further investigation |
@gWOLF3 Do you have any settings in your |
I had the same issue today as @gWOLF3 . Following @mitermayer fixed it.
About vim-prettier I have nothing special in my .vimrc, only Great work, great plugin. Thanks all for your time. |
It could also be nice to have the feature to only format if Prettier is in your dependencies. |
Do you want to request a feature or report a bug?
feature
What is the current/expected behavior?
Currently Prettier is always called whether the project you're working on is using Prettier or not.
I'd like to be able to run prettier only if the project is configured to use Prettier.
This behaviour could be enabled using a variable.
What do you think?
What version of
vim-prettier
are you using - (output of:PrettierVersion
) ?0.2.7
What version of
prettier
are you using - (output of:PrettierCliVersion
) ?Prettier: no prettier executable installation found.
What is your
prettier
executable path - (output of:PrettierCliPath
) ?Prettier: no prettier executable installation found.
Did this work in previous versions of vim-prettier and/or prettier ?
I don't know.
The text was updated successfully, but these errors were encountered: