Extension validation error

Hello, I’m loading a new extension into the directory, I can’t do it because of a validation error. Although there were no errors during the development of the extension.

Error: “There is a JavaScript syntax error in your code; validation cannot continue on this file.”

Fragment of code with error:

class Data
{

KEY_ID = “id”;

}

It looks a lot like validation doesn’t support class properties.

What could be the problem and how to fix it?

See

1 Like

The add-ons linter tends to lag behind Firefox in terms of what JS syntax is supported (see blog post).

According to this comment from October 2020, the tc39 proposal for class fields is still at stage 3, and we don’t think eslint will support it until it moves to stage 4.

Once the proposal moves to stage 4 and gets implemented by eslint, the add-ons linter will get the eslint update and start supporting class fields in about 1 - 2 weeks.

Okay, thanks, so I’m waiting …

Meanwhile you could just initialize the value of the class properties in the constructor instead of using class field syntax. So

constructor(...) {
  ...
  this.KEY_ID = "id";
  ...
}
1 Like

Now another problem has arisen. After uploading the file, an error occurs in the form before submitting it for review.

 Ensure this value has at most 50 characters (it has 61).
 Ensure this value has at most 50 characters (it has 51).

The text in this field is much shorter. One gets the impression that it is not this text that is checked, but the length of the text from the locale files.

What to do?

Hi @alexboxmy, you’re correct – all locales are considered in the character count check. Can you try shortening the text for the locales that exceed the limit and try again?

I have already solved the problem. It would be great if the error messages are clearer. Thank you