klembot / chapbook

A simple, readable story format for Twine 2.
https://klembot.github.io/chapbook
MIT License
80 stars 24 forks source link

eslint-config-prettier but no prettier? #183

Open aleclarson opened 4 months ago

aleclarson commented 4 months ago

Should prettier be a dev dependency? Or am I misunderstanding the purpose of eslint-config-prettier. Either way, the lack of auto-indentation is troubling me 😅

klembot commented 4 months ago

@aleclarson The purpose of eslint-config-prettier, so far as I know, is to prevent eslint defaults from clashing with what Prettier does. I should port over the GH action which runs Prettier on PRs... my preference would be for people to set up Prettier in whatever editor they use instead of having a task to run it manually. But this isn't a strongly-held opinion.

aleclarson commented 4 months ago

IIUC, the Prettier VSC extension doesn't run if prettier isn't installed in the project.

This setup is working well for me: https://github.com/aleclarson/chapbook/commit/3515fe8b18019138476b9d8a3154baa44f93ce86

It adds VSC workspace settings to Chapbook, enabling format-on-save behavior with ESLint running on save too. I needed Format Code Action VSC extension to get ESLint auto-fixing after Prettier. Also had to add some missing lint rules.

klembot commented 4 months ago

@aleclarson Well, my own experience with VS Code is that it formats my code using Prettier without having it in package.json. Never really looked into this very deeply, but I'm using the official extension, and I think I remember having to tell VS Code to use Prettier as the formatter for the file extensions.

greyelf commented 4 months ago

having to tell VS Code to use Prettier as the formatter for the file extensions.

Not doing this is a common cause for Prettier (among others like modules/extension) not working. :)