4 ms·
Reposting[1] my Emacs setup for JS, which I've found very effective. (Seemed more effective than my coworker's VSCode setup) """ (Disclosure: I'm the author o
by fovc 8y ago
Reposting[1] my Emacs setup for JS, which I've found very effective. (Seemed more effective than my coworker's VSCode setup)
"""
(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.
Feel free to ping me if you need more help
"""
One thing I didn't mention then was using mocha.el for mocha/jest, along with indium for debugging. I couldn't get realgud set up properly, but had no issues with indium, including for typescript/babel code.
[1] https://news.ycombinator.com/item?id=14884940 https://news.ycombinator.com/item?id=14884940
- bryanwb 8y agoThis is super helpful. would you mind posting your prodigy configuration? It seems like an excellent tool to run tasks like `yarn develop` If you have any special config for indium, I would love to see that too.
- fovc 8y agoSure thing. Here's the JS-related prodigy stuff: ``` (prodigy-define-service :name "webpack" :cwd "~/project/" :init-async (lambda (done) (nvm-use-for "~/project/" done)) :command "npm" :args '("run" "build" "--" "--watch") :ready-message "Build Finished") (prodigy-define-service :name "tsc" :cwd "~/project/" :init-async (lambda (done) (nvm-use-for "~/project/" done)) :command "npm" :args '("run" "compile" "--watch") :ready-message "Watching for file changes.") (prodigy-define-service :name "server" :env '(("PORT" "6789") ;; etc. ) :cwd "~/project/" :init-async (lambda (done) (nvm-use-for "~/project/" done)) :command "npm" :args '("run" "serve-dev") :ready-message "Listening on 6789") ```