Here is javascript code
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://www.google.com/')
const title = await page.title()
console.log(title)
await browser.close()
})()
my settings.json inside .vscode folder
{
"jshint.options": {
"esversion": 8
}
}
I am using JSLint and my editor is visual studio code 1.47.2
Here is the error I am getting
Expected '(' before '('. (expected_a_before_b) jslint(expected_a_before_b) [3,8]
What could be the cause of this jshint error?
Looks like it's because JSLint doesn't support async/await
.
Here's an issue that was raised, and a patch submitted to fix it, but it hasn't been merged and the bug, strangely, was closed when the bug's author decided, "I don't care anymore" -- strange b/c Evgeny is usually pretty active and helpful on the JSLint mailing list.
I think your options are to try that patch, not use async/await
, or, unfortunately, at least for the time being, change linters. You could also file a new issue at JSLint that essentially repeats the earlier one that was closed without a resolution.