Skip to content

fix: align breaking of instanceof with binary expression in assignments#945

Merged
jtkiesel merged 1 commit into
jhipster:mainfrom
jtkiesel:fix/instanceof-ternary-break
Jun 22, 2026
Merged

fix: align breaking of instanceof with binary expression in assignments#945
jtkiesel merged 1 commit into
jhipster:mainfrom
jtkiesel:fix/instanceof-ternary-break

Conversation

@jtkiesel

Copy link
Copy Markdown
Contributor

What changed with this PR:

Breaking of instanceof expressions in assignment expressions is aligned with that of binary expressions. This aligns behavior more closely with Prettier JS/TS, as it treats instanceof expressions as binary expressions.

Example

Input

aaaaaaaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbb instanceof
  Cccccccccccccccccccc cccccccccccccccccccc;

aaaaaaaaaa = bbbbbbbbbb instanceof Cccccccccc cccccccccc
  ? dddddddddd
  : eeeeeeeeee;

var aaaaaaaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbb instanceof
  Cccccccccccccccccccc cccccccccccccccccccc;

var aaaaaaaaaa = bbbbbbbbbb instanceof Cccccccccc cccccccccc
  ? dddddddddd
  : eeeeeeeeee;

Output

aaaaaaaaaaaaaaaaaaaa =
  bbbbbbbbbbbbbbbbbbbb instanceof Cccccccccccccccccccc cccccccccccccccccccc;

aaaaaaaaaa =
  bbbbbbbbbb instanceof Cccccccccc cccccccccc ? dddddddddd : eeeeeeeeee;

var aaaaaaaaaaaaaaaaaaaa =
  bbbbbbbbbbbbbbbbbbbb instanceof Cccccccccccccccccccc cccccccccccccccccccc;

var aaaaaaaaaa =
  bbbbbbbbbb instanceof Cccccccccc cccccccccc ? dddddddddd : eeeeeeeeee;

Relative issues or prs:

Closes #891

@jtkiesel jtkiesel merged commit 6e3b21b into jhipster:main Jun 22, 2026
6 checks passed
@jtkiesel jtkiesel deleted the fix/instanceof-ternary-break branch June 22, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.9.2] Difference with Prettier for JS

1 participant