I'm editing JSX files with web-mode and our project doesn't use semicolons at the end of the line.
Whenever I press enter at the end of the line, web-mode is auto-indenting two spaces because the semicolon is missing. How can I prevent this?
I've seen that this question has the same problem, but it didn't help me solve this.
As far as I know, there aren't any web-mode specific indentation rules in my emacs init.el, but to be on the safe side, here are all my web-mode settings:
(add-hook 'web-mode-hook
(lambda ()
(if (or (equal web-mode-content-type "jsx") (equal web-mode-content-type "javascript"))
(flymake-jslint-load))))
(add-hook 'web-mode-hook
(lambda ()
;; short circuit js mode and just do everything in jsx-mode
(if (equal web-mode-content-type "javascript")
(web-mode-set-content-type "jsx")
(message "now set to: %s" web-mode-content-type))
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)))
(require 'flycheck)
(flycheck-add-mode 'javascript-eslint 'web-mode)
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
'(javascript-jshint)))
Update! I just realized that this happens in lines ending with functions, but not with lines that only have variable assignments. Here's a sample:
console.log()
cursor is here when I press enter
var blub = 2
cursor is here when I press enter.
Now I'm really confused.
Thanks! --chris
web-mode-javascript-indendation|call,statement,srting,args-beginning
(etc.) functions. This way, it would be easier for me to review and we could image to add a flag to use your functions or mines. – fxbois Mar 11 '16 at 8:31