Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode

From: Fabian Brosda <[email-masked]>
Date: Fri, 28 Mar 2025 11:53:49 +0100

Hi Vincenzo,

>> great that there is already an updated patch. I did test it and it looks
>> good for functions, conditionals, loops.  Regarding arrow functions (or
>> variable declarations in general), the result is different, then with
>> js-mode, but personally I think the result looks more consistent in
>> js-ts-mode.
> Could you please show me this difference?

The examples are not really complex, just a few maybe a bit unusual
cases I could think of.  You can find the gist containing the js-mode
and js-ts-mode (including your latest patch) version and a diff here:

https://gist.github.com/fbrosda/11870561bb009be87b719d5b9a7aa625

A short summary:

- Declaring a variable and assigning an arrow function, the braces are
  not indented in js-ts-mode, but indented to the start of the variable
  in js-mode (also compare the difference between let and const)
- Similar cases, when having a line break in a variable declaration.
  js-ts-mode uses the fixed indentation js-indent-level, while js-mode
  indents to the start of the variable name.  Observe the difference
  between const and let. I personally prefer the js-ts-mode, so that
  const and let, if you mix the two. But at least in my code, this is
  normally used very rarely, so both versions are fine.
- switch-cases have a few differences. For switch with the { on a
  separate line, it is imo wrong in js-mode to indent the case
  statements, as the blocks inside the case are not further indented.
  Switches inside a function break in js-ts-mode, as they have a nega

Hope this helps.

Fabian