mooz / js2-mode

Improved JavaScript editing mode for GNU Emacs
GNU General Public License v3.0
1.33k stars 186 forks source link

An indentation problem with `const` and chaining #539

Closed mbork closed 5 years ago

mbork commented 5 years ago

When declaring a const variable which is assigned a value of a long, chained expression, the default indentation is wrong (compared to a let declaration):

let a = /regex/
    .test('regex hello');

const a = /regex/
      .test('regex hello');

I would expect (and prefer) this:

let a = /regex/
    .test('regex hello');

const a = /regex/
    .test('regex hello');

(Eslint agrees.)

I tried various values of js2-pretty-multiline-declarations, but to no avail, apparently that setting is related to a different situation.

dgutov commented 5 years ago

First of all, see https://github.com/mooz/js2-mode#bugs about indentation problems.

In the Emacs bug report you are going to file, please add some extra info as for why it should be indented this way. Is this an ESLint default? Does it have a relevant configuration option?

mbork commented 5 years ago

Hi Dmitry, and thanks for the fast response! I will do as you told me (sorry, I missed that information) soon. Hence, I'm closing this issue.