Do we need Babel to use arrow functions?

Hi,

I'd like to use some node.js LTS native syntax like the arrow functions but WebStorm keeps returning "expression expected" error (like in this thread https://intellij-support.jetbrains.com/hc/en-us/community/posts/207006395).
Do we need to use Babel for that? I don't use Babel and arrow function are well supported in node.js 4.4.2 http://node.green/#arrow-functions .

Cheers

4 comments

No. WebStorm doesn't need Babel to understand ES6 code, it uses its own parser for this. Please make sure to set 'JavaScript language version' in Preferences/Languages & Frameworks/JavaScript accordingly, to either 'ECMAScript 6' or 'JSX Harmony'.

0

Thanks for the quick reply.

 

Well I don't understand. Why when I check Preferences/Languages & Frameworks/JavaScript to "ECMAScript 6"

WebStorm shows the following message when I come back to the file ?

I probably missed something.

0

it's OK - WebStorm just offers you to set up a compiler for your ES6 file. If you don't need it, just click Dismiss - this won't affect code parsing in any way

0

Yes I dismissed it, and everything looks just fine. It's just a bit disturbing.

 

Thanks a lot for your help.

0

Please sign in to leave a comment.