Closed ajcrites closed 6 years ago
Hi @ajcrites,
Could you please confirm that:
:PrettierVersion
:PrettierCliVersion
:PrettierCliPath
Sometimes you may have the global installed prettier version of 1.9+ but you may be working on projects that still have the old prettier installed on their package.json
and available on their node_modules
in that case vim-prettier
will resolve that prettier
version instead of your global one
Feel free to comment or re-open this issue if that does not fix your use-case, I have closed this issue since that is a common issue faced by other users. I will update the README with a FAQ area that explains this use case
I just ran into this issue as well. This was printed out at the top of my file:
Ignored unknown option: --arrow-parens
Ignored unknown option: --prose-wrap
Ignored unknown option: --no-editorconfig
Ignored unknown option: --loglevel
:PrettierVersion
returns 0.2.6
:PrettierCliVersion
returns 1.7.4
:PrettierCliPath
returns /Users/Sloan/redacted/my-project-folder/node_modules/.bin/prettier
However, I haven't noticed this happening on another project were the prettier cli version 1.10.2
so upgrading versions might be useful to others facing this issue. However, to help debug why this might have happened here are my overrides in my .vimrc
also:
let g:prettier#quickfix_enabled = 0
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue PrettierAsync
let g:prettier#config#print_width = 100
let g:prettier#config#semi = 'false'
let g:prettier#config#single_quote = 'true'
let g:prettier#config#bracket_spacing = 'true'
let g:prettier#config#trailing_comma = 'es5'
Edit: I should also note it doesn't happen on every save... Something like 1 in 4 times.
I'm also seeing the above issue @sloansparger mentioned. I'm on Prettier 0.2.6.
Hi @sloansparger,
The reason why you are seing that on top of your file is due to using an old prettier
version, notice that you are using the latest vim-prettier
with a prettier
cli of version 1.7.4
.
If you really need to use older prettier versions, I suggest you pinning your vim-prettier
to older released versions that are supporting that particular version.
@jsatk , could you also check your prettier
resolved CLI veersion to see if your problem is the same as the above ? You can do so by typing :PrettierCliVersion
within vim, also could you check your resolved prettier
path by :PretttierCliPath
to ensure that you are using the resolved prettier you intended in the first place ?
If the above does not solve your issues please let me know and I am more than happy to try debug it for you
@mitermayer I'm on CLI version 1.5.2. Pinning my vim-prettier version to tag 0.0.11 got it working for me. Thanks for the response!
Bummed the latest isn't flexible enough to work with older versions, but I get it. Happy to help contribute when I can if you need any extra contributors.
Hi @jsatk,
I am glad that got things working for you. Please feel free to always send PR's! All contributions are super welcome!
I believe its hard to keep supporting all versions of prettier
but we should probably include the minimum CLI support version more explicitly on the README.md and docs. I Will make sure to follow up on that
Thanks so much @mitermayer.
Thanks @mitermayer
I had to install the latest vim-prettier version from vimawesome
then, I installed Prettier(v2.3.0)
Gladly said bye to those outputs at the top.
Thanks @mitermayer
I had to install the latest vim-prettier version from vimawesome
then, I installed Prettier(v2.3.0)
Gladly said bye to those outputs at the top.
This worked for me!
This just came up recently, so I'm really not sure what could be the root cause. I have been using the same prettier configuration. I'm installing this plugin through dein:
Whenever I save a
.ts
file or run:PrettierAsync
, my files are immediately prepended withIn order to get around this issue I've tried restoring and removing my global installation of
prettier
. It doesn't seem to matter, and I always get this text prepended to my file when I try runningvim-prettier
.