Syntax errors when compiling js part of plugin.

Alexander Verzakov September 6, 2019

Hi.
This making me crazy. I try to create js that fill data in cascading select list. I use IDEA for comiling and early there was ES5.1 version of JS. In new standart ES6 they change rules to work with objects so older code return only indexes of options in select list. I try to rewrite code accoding to requirements of ES6 but it creates only syntax errors and i don't understand their source.

window.onload = function(){

if((document.getElementById("select_options_coded")!= null)) {
const options = JSON.parse(document.getElementById("select_options_coded").value);
const optionsMap = new Map(Object.entries(options));

for (const key of optionsMap.keys()) {
console.log(key);
}
}
};

 This is simplified part of script. It get values from hidden field on page and deploy it Map. Then in for loop i need to iterate entries to create options. but in packaging i get

[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling javascript using YUI
[ERROR] syntax error
for (const key of optionsMap.keys()) {
[ERROR] syntax error
console.log(key);
[ERROR] syntax error
};

i also trey consructions like Object.entries() but with the same result.
 What is hell going on?

Help me please.

2 answers

1 accepted

2 votes
Answer accepted
Alexander Verzakov September 9, 2019

First i need to change loop to .forEach construction

optionsMap.forEach(function(value, key, map){
console.log("KEY: " + key + " VALUE: " + value);
});

 Secondary
Need to invalidate cache/restart in IDEA.

0 votes
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 9, 2019

Alexander,

Thank you for contacting us! I'm having a look at this issue, but it's not clear what exactly you want to do. It appears that you might be trying to develop something for Jira?

If that is the case, I recommend that you try your question in our Atlassian Developer Community. The users there are more familiar with developing for Atlassian products, as the users on this community are mostly just end-users.

Let me know if you have any trouble raising your question there.

Regards,

Shannon

Alexander Verzakov September 9, 2019

Thank you for your answer. I resolve this by myself.

Like Shannon S likes this
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2019

Thank you for sharing your resolution, Alexander! I'm sure it can help other users in the future should they receive this error.

Take care, and have a pleasant rest of your week.

Regards,

Shannon

Suggest an answer

Log in or Sign up to answer