It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Syntax errors when compiling js part of plugin.

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

1 vote
Answer accepted

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

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

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

Like Shannon Spaniol likes this

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
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you