Rubymine syntax highlighting in js.erb files with ES6

Answered

I think there is a bug when parsing .js.erb files when we want ES6 format.

We want to reference a class library in a gem so we are using .erb so we can do

import "<%= MyHelper.helperfunction('path/to/Feature.js') %>";

So, if our code snippet looks like this (example.js.erb) it reports an error where `data=> {` is :

import "<%= MyHelper.helperfunction('path/to/Feature.js') %>";

export default class MyClass extends Feature {
static get defaultConfig() {
return {
features: {
eventTooltip: {
template: data => {
const sd = DateHelper.format(data.eventRecord.startDate, 'LL');
const ed = DateHelper.format(data.eventRecord.endDate, 'LL');
}
}
}
}
}
}

 

When we have it (as example.js) we don't get any error:

import Feature from 'Feature';

export default class MyClass extends Feature {
static get defaultConfig() {
return {
features: {
eventTooltip: {
template: data => {
const sd = DateHelper.format(data.eventRecord.startDate, 'LL');
const ed = DateHelper.format(data.eventRecord.endDate, 'LL');
}
}
}
}
}
}

 

 

2 comments
Comment actions Permalink

Hello,

it seems to be a known problem, please add your vote and follow https://youtrack.jetbrains.com/issue/RUBY-24197

0
Comment actions Permalink

Thanks Olga, I've added a comment there.

0

Please sign in to leave a comment.