I do not like to work in React, but their prettier autoformatting is SOOO good. I've been really wishing there was something as fast and good available working with ERB files. And now thanks to Adam Zapaśnik there is!
It's a prettier plugin build on top of prettier-ruby. To install it and have it work inside VS Code do the following:
It's a prettier plugin build on top of prettier-ruby. To install it and have it work inside VS Code do the following:
yarn add -D prettier @prettier/plugin-ruby prettier-plugin-erb
And add this to your settings.json
"[erb]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
That's all!
There are a few bugs but in general, it works blazingly fast in comparison with any other tool and makes use of the very great prettier ecosystem.