# Eslint: Expected { after 'while' condition

**URL:** <https://meta.discourse.org/t/eslint-expected-after-while-condition/236003>\
**Category:** Development\
**Created:** [August 12, 2022, 4:19pm UTC](https://meta.discourse.org/t/eslint-expected-after-while-condition/236003 "2022-08-12T16:19:52Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [August 12, 2022, 4:19pm UTC](https://meta.discourse.org/t/eslint-expected-after-while-condition/236003/1 "2022-08-12T16:19:52Z")

</div>

I forked [Formatting toolbar](https://meta.discourse.org/t/formatting-toolbar/40649) to add some very custom formatting stuff.

It has [discourse-formatting-toolbar/assets/javascripts/lib/discourse-markdown/formatting\_bbcode.js at master · MonDiscourse/discourse-formatting-toolbar · GitHub](https://github.com/MonDiscourse/discourse-formatting-toolbar/blob/master/assets/javascripts/lib/discourse-markdown/formatting_bbcode.js#L1-L6)

My code looks like this:

```javascript
function replaceTitle(text) {
  while (
    text !==
    (text = text.replace(/\[title\](.+?)\[\/title\]/gi, function (match, p) {
      return `<div class="job-title">${p}</div>`;
    }))
  );
  return text;
}

```

But `eslint` complains:

```
    9:3 error Expected { after 'while' condition curly

```

I tried moving that `while` and stuff after it onto a single line (the formatting here is applied by vscode and usually works with the other plugins I manage), but that didn’t help either.

Can someone provide me with a clue?

EDIT: Well, it turns out that I don’t actually need that function, but I would still like to know what the problem is.

---

_[View the full topic](https://meta.discourse.org/t/eslint-expected-after-while-condition/236003)._
