#Prettier + pnpm

1 messages · Page 1 of 1 (latest)

unkempt helm
#

Is there no way to make prettier work with pnpm in astro? I was trying to find solutions but even with yarn it seems to format all astro files but not css from some reason.

winter swallow
#

How are you using Prettier, in the CLI or in the editor?

unkempt helm
#

@winter swallow - in the editor via extension.

winter swallow
#

With Prettier's extension or Astro's?

unkempt helm
#

I usually use Prettier's VSC extension globally on all projects. When initialising the repo with Astro, it seems like it uses the local prettier module though which formats Astro but not CSS.

rugged fog
#

Did you edit your user settings to use the Astro extension?

unkempt helm
#

I didn't edit any settings, when I tried pnpm, prettier automatically threw an error and no formatting was done on any files, despite local node_modules being loaded.

After initializing with yarn, .astro files are being formatted automatically, but CSS is not. I didn't edit any specific settings and just have a global config in my prettier extensions in VSC.

winter swallow
#

If you didn't edit any settings, I don't think your Prettier extension is formatting Astro files, they need to be included manually in the VS Code config

#

I'm not sure why the Prettier extension wouldn't format CSS files, but that seems unrelated to us

unkempt helm
#

I think whats happening is that its taking a local config, but disregards the global one. Thanks, I'll try to resolve it :/

winter swallow
#

In Astro 3 we're removing the dep on Prettier, so hopefully that would solve it too

unkempt helm
#

Thank you, actually some clues - I previously put Astro as the main formatter for VSCode. Putting back prettier started formatting all files aside of .astro. Now everything works except for the Astro specific files, so the problem is reverse.

#

dev dependency installed via pnpm > pnpm install -D prettier prettier-plugin-astro

#

Tried the workaround in the docs:
prettier --write . --plugin=prettier-plugin-astro but it also doesn't work 😦

winter swallow
#

You might need to specify .astro files manually in the glob due to a bug in Prettier 3