ECMAScript 6 support in PhpStorm 2016

2020-02-10 13:14发布

问题:

I recently pulled in the latest Laravel 5.3. In the gulp.js file, there is the newer ES6 arrow function syntax:

elixir(mix => {
    mix.sass('app.scss')
       .webpack('app.js');
});

PhpStorm 2016.2 shows this code error on that:

Expression statement is not assignment or call.

Additionally, the code auto-formatter mucks everything up when it encounters this because it sees it as an error.

How do I get PhpStorm to stop showing that as an error?

回答1:

Go to Settings > Languages & Frameworks > JavaScript

Then change JavaScript language version to ECMAScript 6



回答2:

MacOs: Menu > PhpStorm> Preferences > Languages & Frameworks > JavaScript and change JavaScript language version to ECMAScript 6