Async/await support

I'm getting red lines for es7 features.

When I just open the webstorm, it looks fine, but if I don't use webstorm and leave it in the background for 20 minutes or so, strangely, I get those red lines.

 

ps. The project is already set as ECMASCRIPT 6.

ps². The syntax is being used correctly. As I said when I just open, everything looks fine.

1
37 comments
Avatar
Permanently deleted user

I have the same problem. Tried everything suggested in this thread.

SNIPPET:

(async () => {

    const browser = await puppeteer.launch();

    const page = await browser.newPage();

    await page.goto('https://example.com');

    await page.screenshot({path: 'example.png'});

    await browser.close();

})();

Build #WS-182.4129.32, built on August 21, 2018

File .js

Error Massage:

The language version

File | Invalidate caches, Restart.

 

0

Works fine for me using the same syntax:

 

Is it the only project you have opened? Does the issue persist after caches invalidation?

 

As for syntax error shown in runtime, please check your Node.js version: async functions are not supported by Node versions older than version 7.6

1
Avatar
Permanently deleted user

After node upgrade the program runs without SyntaxError. But i am still getting red lines even after File | Invalidate caches, Restart

Yes I have opened only one project.

0

what error messages can you see? Please hover over the highlighted strings and take a screenshot of error tooltips.

Also, please check if you have specific language versions set for subfolders (press the ellipsis button next to language version field to open the JavaScript Language Versions dialog)

1
Avatar
Permanently deleted user

Here they are:



0

So these are JSHint errors, not WebStorm own inspections.

JSHint doesn't yet provide async/await support. It's planned for JSHint 2.10 - see https://github.com/jshint/jshint/pull/3273

You can use ignore directive to calm down JSHint

/* jshint ignore:start */
(async () => {

const browser = await puppeteer.launch();

const page = await browser.newPage();

await page.goto('https://example.com');

await page.screenshot({path: 'example.png'});

await browser.close();

})();
/* jshint ignore:end */

But I'd strongly recommend using more up-to-date linters, like ESLint, that support ES6+ features and are far more flexible

2
Avatar
Permanently deleted user

Thank you Elena! It works now!

1

Please sign in to leave a comment.