BackToPlebbit69 · 2022-08-09 22:38
The only option I've been able to use is 'Prettier.js' which only works after saving a given .js file for a React component I would be working on.
Does anyone have any Emacs configs that utilize something like aggressive-indent for JSX type syntax?
I ask because I need some help with formatting web development projects with Emacs easily.
flaviusmaximus7 · 2022-08-09 22:43
Are you using lsp-mode? If so, you can ask the server to format the buffer for you.
TheFrenchPoulp · 2022-08-09 23:23
Back when I was working with JSX, I found rjsx-mode and aggressive-indent-mode to work just fine
These days I rely exclusively on Prettier on save using typescript-mode together with tree-sitter's TSX syntax
MonsieurPi · 2022-08-10 13:29
What's the issue with formatting on save? If it's freezes, you should try apheleia
orzechod · 2022-08-10 17:50
I've been building out [tsi.el](https://github.com/orzechowskid/tsi.el) \- an emacs minor mode which performs indentation based on a CST returned by tree-sitter. among other languages it should support JSX/TSX. please give it a try if you haven't already, and if you have tried it and it did not meet your needs then I'd love to hear why not!
BackToPlebbit69 · 2022-08-10 18:46
u/flaviusmaximus7
How would you do that? Do you have an Emacs config that does this that you can share?
u/MonsieurPi
I want it to be indented in live-time without having to save. More or less how a real IDE would do, aka something like VS Code, etc.
u/orzechod
How do you install your package with 'use-package'?
u/TheFrenchPoulp
Can you please share your old Emacs config with this in mind?
orzechod · 2022-08-11 01:47
> How do you install your package with 'use-package'?
you can use the `:straight` option to pass the straight.el recipe to use-package.