Explain how to disable vim-prettier default settings in readme #343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I spent a while figuring out why vim-prettier was adding some default CLI options like
--tab-width=4
to the prettier command it was running, which was causing changes that would break my CI build when it would check the codebase against a.prettierrc
that (obviously) didn't include vim-prettier's default settings.In case anyone encounters a similar issue, here's what I found out:
g:prettier#config#tab_width
is set toauto
(the default), it will set it to the value of theshiftwidth
vim setting (see https://github.com/prettier/vim-prettier/blob/e122231/autoload/prettier/resolver/config.vim#L56). In my case it would set it to 4 on markdown filesThere doesn't seem to be any option to prevent vim-prettier from adding all those CLI flags, but thankfully we can ask prettier to ignore them whenever a config file is passed with the
--config-precedence prefer-file
option.I thought this deserved a clearer mention in the section of the README that mentions the vim-prettier default config. WDYT?
(Thanks to @twm who put me on the right track in this issue comment: #266 (comment))