# Code with arrow function

**URL:** <https://discourse.mozilla.org/t/code-with-arrow-function/60019>\
**Category:** addons.mozilla.org\
**Created:** [May 14, 2020, 7:36pm UTC](https://discourse.mozilla.org/t/code-with-arrow-function/60019 "2020-05-14T19:36:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![telesphore](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/telesphore/32/37276_2.png) [@telesphore](https://discourse.mozilla.org/u/telesphore)\
**Post date:** [May 14, 2020, 7:36pm UTC](https://discourse.mozilla.org/t/code-with-arrow-function/60019/1 "2020-05-14T19:36:13Z")

</div>

Hello,  
I wrote an extension with arrow function and class fields. Everything is working in Firefox but I can’t submit my addon as the validator does not support this syntax.  
It’s very annoying as the code works, extension is already published on chrome store…

When will the validator be upgraded?  
Is there a way to bypass it in this case?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [May 14, 2020, 8:21pm UTC](https://discourse.mozilla.org/t/code-with-arrow-function/60019/2 "2020-05-14T20:21:05Z")

</div>

Arrow functions aren’t the issue, but class fields are. There are multiple issues filed on it, like [False positives in syntax validation (Valid Class Field Syntax is rejected by the linter) · Issue #2758 · mozilla/addons-linter · GitHub](https://github.com/mozilla/addons-linter/issues/2758)

Sadly issues with the syntax support of the validator come up again and again ☹

---

<div class="post-metadata">

**Author:** ![telesphore](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/telesphore/32/37276_2.png) [@telesphore](https://discourse.mozilla.org/u/telesphore)\
**Post date:** [May 14, 2020, 8:39pm UTC](https://discourse.mozilla.org/t/code-with-arrow-function/60019/3 "2020-05-14T20:39:10Z")

</div>

I think it’s the issue, I have some classes with only arrow function and the validator fails on them too  
Why mozilla stays in this situation? This is very bad 😕 No wonder google chrome goes up…

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [May 14, 2020, 9:37pm UTC](https://discourse.mozilla.org/t/code-with-arrow-function/60019/4 "2020-05-14T21:37:00Z")

</div>

If you use an arrow function to define a class method, unless you define it in the constructor (which is by the way a mighty fine way to do it for now, if you don’t like babel), will require the usage of a class field. As such, not the arrow function is the issue, but the class field syntax. If you were to define the same arrow function as a class member but in the constructor, the validator would be just fine with it.
