|
|
|
|
|
by rayalez
2143 days ago
|
|
Did anyone manage to make a good Emacs config for effective React webdev? I'm really missing graphql and styled components syntax highlighting and generally a bugless properly working webdev mode. Currently it keeps messing up indentation and losing syntax highlighting. I tried moving to VS code, and I saw how amazing an editor designed for webdev can be. But despite all the issues, I'm still much more productive in emacs, so I went back. I really wish it was possible to setup emacs for modern webdev, but I haven't found a way yet. Any tips/advice? |
|
""" Disclosure: I'm the author of rjsx-mode)
The best setup I've found is to use js2-mode for .js and rjsx-mode for .jsx, which parse the buffer for syntax highlighting, local refactoring (with js2r) and basic linting. For typescript, use typescript-mode. Flow support is quite bad ATM
nvm.el replaces the shell scripts from nvm.
Add a jsconfig.json to your project root and enable tide-mode for completion. This has worked far better than tern-mode, which some people recommend.
For fuller linting than what js2/rjsx offer, use flycheck. Eslint support is built-in, so it should just work, I think.
[2018 update: I prefer using tslint, which you can accomplish with:
(flycheck-add-mode 'typescript-tslint 'js2-mode)
(flycheck-add-mode 'typescript-tslint 'rjsx-mode)]
Finally, for build management, I use prodigy to run webpack, babel, ts, etc.