Support for this was recently added in the Emacs development tree, in response to the bug#27503 feature request, which in turn was inspired by a duplicate of this question.
The user option which controls this behaviour is js-indent-align-list-continuation
, and it affects all list-like structures:
js-indent-align-list-continuation
is a variable defined in js.el
.
Its value is t
Documentation:
Align continuation of non-empty ([{
lines in js-mode
.
So, for the desired effect:
(setq-default js-indent-align-list-continuation nil)
In order to avail of this option, however, you will need to either:
- compile and install the latest Emacs;
- wait for Emacs 26 to be released; or
- place a patched version of
js.el
in your load-path
.
Alternatively, you can override the current behaviour to match the future behaviour as per Colin Fraizer's answer to the aforementioned duplicate question.
js2-mode
? It's significantly more flexible than the built-injs-mode
. A quick grep reveals the user optionjs2-bounce-indent-p
may be of interest.