Questions tagged [javascript]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
19 views

How to display js2-mode warnings

I am running Emacs 26.1 on Ubuntu 16.4. I am writing Javascript using js2-mode. When the linter underlines a line of code, I want to know what error or warning it has detected. For example, in this ...
1
vote
1answer
77 views

Cannot add general block header arguments in org mode

While I'm learning javascript following a book, I Like to take notes with org-mode. I use Indium and followed this instructions to handle it working It works well, and I get my work done, interacting ...
1
vote
0answers
17 views

tide-mode in org-edit-src-code

I want to activate tide-mode when using Javascript soruce code blocks, following this it works well with indium: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-js.html But I want to use ...
0
votes
0answers
67 views

How to set up Emacs Tide to use auto-complete for completion instead of company-mode?

I installed Tide in Emacs, and found it is pretty useful for writing JavaScript code. But one thing is that Tide has built-in support for company-mode to do completions. Since I am an auto-complete ...
2
votes
2answers
116 views

How to show all functions in a javascript file?

How to show all functions in a js file? I am using js2, but any solution will do. Additional info: I am expecting an occur style buffer. This can persist and be edited if necessary. Or searched. This ...
0
votes
0answers
16 views

Indium can't connect; EPERM: operation not permitted

I'm trying to set up the indium package for javascript, but I get the following error when I execute M-x indium-launch: Indium server error: EPERM: operation not permitted, stat 'c:\Users\1127861' ...
0
votes
0answers
25 views

Web-beautify JS code on Windows (js-beautify for unminimifying)

I'm trying to un-minimify JS code on Windows. I've installed web-beautify from MELPA. I also installed Node.js for Windows, which is a dependency of this package. I then ran npm -g install js-beautify ...
1
vote
1answer
51 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
81 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
242 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
24 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
202 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
510 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
82 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?
3
votes
0answers
186 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
152 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
80 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
94 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: ...
2
votes
2answers
1k 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. ...
3
votes
1answer
209 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
74 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
242 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
116 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
100 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
59 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
443 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
193 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
37 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
230 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 ...
19
votes
4answers
5k 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
44 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
269 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
321 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
280 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
96 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
574 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
285 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
103 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
401 views

Unable to Set Javascript Indent on Spacemacs

I have a vanilla Spacemacs setup, and in my .spacemacs file, the dotspacemacs/user-config definition I have added (setq js2-basic-offset 2) which should be sufficient to set the indent length as 2. I ...
0
votes
1answer
73 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
236 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
617 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
607 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
2k 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
509 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
667 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 ...