this post was submitted on 28 Nov 2023
1 points (100.0% liked)

Emacs

310 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I recently picked up a new project that uses React. Out of the box, my configuration doesn't seem to be doing very well -- indentation is erratic (sometimes thrown off by JSX), no lsp-rename, and generally things are slow.

Are there any generally recommended approaches for React development with Emacs? Language server, minor modes, tree-sitter, etc? There seem to be a lot of options and modes available.

The codebase is currently JavaScript and JSX, but I'm considering Typescript and TSX down the line. Should I just default to the TypeScript tooling?

you are viewing a single comment's thread
view the rest of the comments
[–] dpassen1@alien.top 1 points 9 months ago (3 children)

I use:

Along with something for eslint in flymake

[–] harsh_mistress@alien.top 1 points 9 months ago

using much of the same combo and I'm happy with it, except I'm using the vtsls LSP.

This is an LSP wrapper around TypeScript extension bundled with VSCode. All features and performance are nearly the same.

it's pretty snappy with (fset #'jsonrpc--log-event #'ignore)

[–] FitPandaFu@alien.top 1 points 9 months ago (1 children)

add-node-modules-to-path is broken since npm dropped support for the npm bin command.

[–] dpassen1@alien.top 1 points 9 months ago

That's not great. I bet the project I was using it on is quite old. In the meantime, as stated https://www.reddit.com/r/emacs/comments/1865s7b/recommended_setup_for_react_development/kb7kej1/ envrc and layout node seems to work for me!

[–] dpassen1@alien.top 1 points 9 months ago

Looks like adding layout node to .envrc (direnv) would remove the need for add-node-modules-to-path for me