Editor doesn't support Arrow Function class methods in JS

I have a project that I am using React in. I have it set up to use all proposed JS features (stage-0) with Babel. Everything is functional, but the editor shows an error Parsing Error: Unexpected token = when creating class methods with arrow functions.

image

IMO this is a low priority as it doesn’t break anything, but it would be nice to have fixed.

Hey @artjumble thanks for the request! I’ve moved it to Feature Ideas to go along with some other linting changes that we hope to work on in the future - be sure to add your vote!

Reminder: Still not fixed

It’s actually the problem with CodeMirror, the code linting used by Glitch projects.

hello, how are you.
am using vscode to build a website
(but it can not recognise arrow functions)

Hi @Matovu_Faizal, welcome!

I think you’re missing a comma after each event name, like ‘mouseenter’, so it should be:

left.addEventListener('mouseenter', () => container.classList.add('hover-left'))

Hope this helps! In future, it’s best to start a new thread if the topic is more than a year old :slight_smile:

2 Likes