Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [javascript]

for the use (typically editing) of JavaScript code in Emacs.

1
vote
1answer
20 views

ES6 imports auto suggestion

I'm new to emacs and trying to setup emacs for ES6/React developement. I would like to have auto suggestions for es6 imports like lodash similar to vscode (as shown in screenshot). Is there a way to ...
2
votes
1answer
48 views

How to control JavaScript indentation?

I am coding in Node.js, each time I want to write something that looks like this: const product = Factory .model('App/Models/Product') .create() I get this as an output: const product = Factory ...
0
votes
1answer
122 views

eglot - javascript

I am trying to set up eglot on ubuntu and emacs 26.1. I have installed version 1.4 When I run M-x eglot I get: [eglot] I guess you want to run `javascript-typescript-stdio', but I can't find `...
1
vote
0answers
23 views

Migrate Webstorm Code Highlighting

I am currently using Webstorm as my daily driver but I am trying to look into Emacs and possibly transition. One of the most important things to me that I have spent the last 3 years on was to ...
1
vote
1answer
135 views

ELDoc and company-tern are not working properly in JS2-mode (.js buffer in node) and Javascript, in Emacs

In my Emacs configuration for JavaScript/ JS2-mode, specifically .js buffer in node: (1) company-tern and ELDoc are NOT working properly. For eg. when I type 'console.l', 'log' does not pop up, ...
0
votes
1answer
240 views

Configuring Flycheck to use a local ESLint

I was trying to get emacs to point to a version of eslint that isn't installed globally (but located in the node_modules of the directory one level up), so I followed this: Flycheck with file relative ...
1
vote
1answer
61 views

set js-indent-level from .eslintrc?

when I edit javascript, I'm usually actually editing someone else's code. Is there a way to dynamically set the value of js-indent-level from a .eslintrc file?
2
votes
0answers
113 views

How to generate TAGS tables for JavaScript with React?

I'd like to create TAGS tables for JavaScript ES6 code using React like the following: import React from 'react' import { observer } from 'mobx-react' import { Formik, Form, Field } from 'formik' ...
0
votes
1answer
89 views

flycheck tslint reports no-implicit-dependencies for everything

I'm editing TypeScript using Tide, successfully, except that it complains about every single import statement. For example: import { GraphQLSchema } from 'graphql'; I see an error in the minibuffer:...
2
votes
1answer
66 views

How to prevent Emacs from converting JavaScript symbols to HTML code?

When I insert a portion of JavaScript code within an HTML file, Emacs convert some basic JS symbols to their HTML code. For example when I type >, Emacs convert it automatically to > which ...
0
votes
2answers
71 views

How to prevent losing indentation when editing JavaScript code within HTML files in Emacs?

When I edit JavaScript code which exists in an HTML file, I lose code indentation whenever I press Enter. first line of code: second line of code # Press Enter here Result after pressing Enter: ...
1
vote
0answers
86 views

how to get tern-mode to show documentation in the mini-buffer when autocompleting?

For my javascript setup within emacs, I am using tern-mode with company, using the following config. when auto-completing, I only get an 'usage example at dot', and the 'method signature in the mini-...
2
votes
2answers
730 views

Javascript ES6, React, and EMACS

So, I'm finding myself writing React a lot, and not finding myself happy doing so in EMACS. I've been resorting to Visual Studio Code, which is a fine editor but suffers seriously by not being EMACS. ...
0
votes
0answers
107 views

better highlight syntax errors in javascript-IDE

I am using editing JavaScript in Emacs using the Javascript-IDE major mode. This is what I have in my .emacs file: (use-package js2-mode :mode "\\.jsx?\\'" :init (setq js2-highlight-level 3) ...
3
votes
1answer
153 views

Make emacs to use only tabs for JS indentation

I've set my tabs to 4 and haven't changed any JS indent settings. All the indents I found in the "JavaScript group" have values either 0 or 4, yet the following code describe('test Info', () => { ...
0
votes
1answer
59 views

Add a watch statement in Indium?

Is it possible to add a watch statement in Indium like you can in the node debugging utility? from Debugger | Node.js v9.10.1 Documentation: It is possible to watch expression and variable values ...
2
votes
1answer
211 views

Fixing wrong-type-argument to looking-at in Emacs 25 js-mode on large files

When using js-mode (or js2-mode) on Emacs 25.1 (in Debian 9) to edit some large files, any attempt to insert text after some "random" point in the file fails with an elisp stack trace: Debugger ...
0
votes
2answers
95 views

Adding global variable on flycheck

I tried to add this to my eslint global variable "globals": { "document": false, "navigator": false, "window": false, "rndr": false, "shrd": false, "path": true, "$": ...
0
votes
0answers
80 views

Emacs and JSlint

Is there a way to make Emacs flycheck run JSlint (not flymake, not JShint, and not eslint) on the current file?
2
votes
1answer
54 views

Align the values of a JavaScript map

Say that you have the following JavaScript map literal {a: 1, aoeu: 2} and want the values aligned for readability like {a: 1, aoeu: 2} Is this possible to do with emacs? I'm currently using ...
4
votes
1answer
377 views

What's the relationship between js-mode and js2-mode?

I saw there is a js-mode bundled in Emacs. I've also seen a js2-mode. However, I have also seen Emacs git log on js-mode refers to js2-mode bug reports. What is the relationship between them?
1
vote
1answer
158 views

Syntax highlighting inside HTML5 <script> tags

I was curious if there was a way to get highlighting/indentation for any JavaScript that's inside of HTML5 tags? I don't frequently use JavaScript but for a class I'm in we're working with it. I ...
1
vote
1answer
32 views

How to make RET insert a blank line and indent and put point on this line when point between `{}`?

In most JavaScript IDEs, there is a feature that pressing RET when point is between {}, results in an indented blank line with point on the end of this blank line, as shown in the following two ...
3
votes
1answer
1k views

Emacs as JavaScript IDE. What is the best package for this?

Windows 10, Emacs 25.1 I want to write many JavaScript files on Emacs. And as result I need comfortable mode to work with javascript. So as result I want to use Emacs as JavaScript IDE. The ...
2
votes
1answer
204 views

How to detect and match indentation size of current buffer

I'm working on a javascript project that has inconsistent tab sizes 2spaces vs 4spaces on the server and client. I'm using web-mode for javascript editing. I'm looking for a feature like SublimeTexts ...
17
votes
4answers
4k views

How to edit jsx (react) files in emacs?

I've use js2-mode but it don't indent html in javascript properly. I've found this repo https://github.com/jsx/jsx-mode.el but it's not for react, it's for some other jsx. What do you use for editing ...
0
votes
0answers
42 views

comint-mode problem with C++ style comments (and quotes)?

This is a rephrase of my SO question https://stackoverflow.com/questions/44147993, which didn't receive much attention in SO. Basically, I suspect that I enountered a problem with nodejs-repl.el (...
2
votes
1answer
1k views

How to enable type-check rules with flycheck-tslint

I want flycheck to use the tslint's --type-check flag to compile my typescript files. In order to see unused imports on the fly inside emacs. By tslint docs --type-check Enables the type ...
0
votes
1answer
222 views

smartparens with strict mode in javascript

I am trying to configure smartparens to work with javascript, my config looks like this: (use-package smartparens :ensure t :diminish smartparens-mode :commands (smartparens-mode ...
1
vote
1answer
259 views

Web-mode uses 1 space indent instead of 2

I have this config in my init.el: (setq-default indent-tabs-mode nil) (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) (defun my-web-mode-hook () "Hooks for Web mode." (setq web-mode-...
0
votes
1answer
252 views

How to disable warning in js2-mode: function does not always return a value?

Is it possible to disable warning for functions that not always return value in js2-mode?
0
votes
1answer
87 views

Mysterious command to send code to Mozilla?

I accidentally smashed my hand on the bottom right of my keyboard and got the following prompt in the echo area: (I was in the analyzeDiscussion() function in js-mode when this happened) Send ...
3
votes
2answers
531 views

Stop javascript-mode from lining up function parameters after newline

Using javascript-mode, functions are indented like this: console.log('Example', var1, var2); test('Example2', var1, var2); I'd like to change this so that ...
3
votes
0answers
1k views

flycheck eslint for javascript

I'm trying to setup a lint for javascript files. Here's the relevant setup I have. (use-package js2-mode :ensure t :init (progn (add-to-list 'auto-mode-alist '("\\.js?\\'" . js2-jsx-...
2
votes
2answers
226 views

Changing how argument lists are indented in JavaScript

Right now, my argument lists are indented by js-mode like this: some_long_function_name( one_argument, another_argument ); How can I get them to look like this: ...
0
votes
0answers
96 views

Evaluate entire buffer in skewer-mode

skewer-mode has been a very useful tool for me learning JavaScript. I constantly use skewer-eval-last-expression and skewer-eval-defun for debugging purposes, but I find that most of the time I want ...
1
vote
1answer
341 views

Unable to Set Javascript Indent on Spacemacs

I have a vanilla Spacemacs setup and in my user-config I have set js2-basic-offset to 2. I have also placed this before in my user-init with no luck as well. I can verify this in my window using SPC ...
0
votes
1answer
61 views

js2 mode doesn't recognize variable in “for in” statement

When I use a for in statement, js2 mode doesn't recognize the new variable: let foo = {bar: 1}; for(key in foo) { console.log(key); } It prints: Undeclared variable or function 'key'
0
votes
2answers
211 views

How to Debug Javascript in HTML in Webmode.el

I am new to Emacs webmode. I was wondering how to debug javascript embedded into my html page using webmode.el. The script is in the <script> tag. I'd like to see break lines and see the values ...
5
votes
1answer
555 views

Indent javascript arrow functions like regular anonymous functions

Using Emacs 25.1 and js-mode for javascript editing. Is it possible to change the indention rules in js-mode to customize the indention of arrow functions? Example of anonymous function indention: ...
0
votes
1answer
550 views

How to get two space indentation for JS/JSX?

Expected behavior (demonstrated in vim): http://zc.d.pr/1a7b1/2p5XiuwX I expect hitting Enter should indent the pointer at the correct level with two spaces in, matching the surrounding syntax, ...
6
votes
2answers
1k views

How to indent 4 spaces for case in switch in javascript mode

I'm using default javascript mode and the switch..case look like this: switch (component) { case 'action-message': result = actionMessage(response); break; case 'action-...
7
votes
3answers
1k views

How can I make emacs support javascript ES6 template string literals?

I want to use ES6 template string literals e.g.: `string text line 1 string text line 2 string text ${expression}` However emacs doesn't recognize that their contents are a string, so syntax ...
1
vote
1answer
465 views

web-mode for .js suffixed files

I have (somewhat) successfully installed and configured web-mode. But one thing doesn't work /w (react.js) JSX: I'm doing a project that requires the files to have the suffix '.js' and I'm trying to ...
0
votes
2answers
601 views

Embbed html/javascript in org-mode html export

Is it possible to embed an html file within an html exported from org-mode? I don't mean to "quote" the source of the file (which is possible with #+INCLUDE: "someFile.html" src html). My use case ...
5
votes
1answer
386 views

How do I make javascript-mode not turn all 8 spaces into tabs?

This is what javascript-mode generates with standard tabbing (I never hit the space key when making it). I'd like to have the files contain no tab characters. I can't seem to find any option in the ...
7
votes
1answer
2k views

How to get org-babel source block working with ES6-7?

I'm having difficulty getting org-babel to evaluate this block of code with emacs v24.5 node v5.0.0 babel-node v.6.6.5 #+BEGIN_SRC js :cmd "babel-node" let arr = [1, 2]; let [x, y] = ...
1
vote
1answer
317 views

Emacs indent AngularJS code to wrong level

It's really sad not to write well formatted angularJs code inside emacs, the image below shows what I am saying. What is happening inside the photo is that the code is already well formatted as it is,...
0
votes
0answers
49 views

Css mode break indent region for javascript-mode

I have css-mode and javascript-mode and if I open css file the indent-region-function is set to css-indent-region which break javascript-mode indent region, how can I fix that? the workaround is to ...
0
votes
0answers
42 views

Is there a way to colorize markdown coding partial

I want to colorize code snippet in markdown-mode. # foo.rb def foo do_something end And javascript code. // bar.js function bar(){ do_something(); } In markdown-mode the codes are colored by ...