New JavaScript syntax support in add-on developer tools

It’s been a year since we last added support for new JavaScript syntax to the add-ons linter. In that time we’ve used it to validate over 150,000 submissions to AMO totalling hundreds of millions of lines of code. But it has been a year, and with both Javascript and Firefox are constantly and quickly evolving, the list of JavaScript features Firefox supports and what the AMO linter allows have drifted apart.

This drift is not an accident; Firefox and AMO don’t keep the same cadence on supported features, and this is deliberate. Upcoming JavaScript features are spread across different EcmaScript proposal stages, meaning different features are always in different stages of readiness. While Firefox often trials promising new JavaScript features that aren’t “finished” yet (stage 4 in the ECMAScript process) to better test their implementations and drive early adoption, the AMO team takes a different approach intended to minimize friction developers might face moving their addons between browsers. To that end, the AMO team only adds support for “finished”, stage 4 features to the linter.

This hybrid approach works well for everyone; while Firefox continues to push the web ecosystem forward, AMO is making it easier for add-on developers to move laterally within that ecosystem.

Today, we’re happy to announce that our linter has been updated to ESLint v8 for JavaScript validation. This upgrades linter support to ECMAScript 2022 syntax, including features like public field declaration and top-level await that add-on developers will find particularly useful.

If you’d like to know more about how these tools work, and maybe help us improve them, bug reports and new contributors are always welcome. Thank you for being a part of Mozilla, and the add-ons developer community.

3 comments on “New JavaScript syntax support in add-on developer tools”

  1. a wrote on

    >This hybrid approach works well for everyone;

    As a webextension developer I disagree. It’s very annoying to write code that gets compiled fine by my toolchain, is executed fine by my testsuite and browser but ends up triggering hard to debug failures due to the extension linter not understanding the syntax being used.

  2. Eu wrote on

    We need mv3 support… In less than a month chrome will not accept new extensions in mv2. Many of developers updated extensions to mv3 and can’t support 2 different versions 🙁

    1. Philipp Kewisch wrote on

      Hey Eu, MV3 support is definitely in the works. Please do follow this blog for more updates!