下面是javascript代码
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文件夹
{
"jshint.options": {
"esversion": 8
}
}
我使用的是JSLint,我的编辑器是visual studio code 1.47.2
下面是我得到的错误
Expected '(' before '('. (expected_a_before_b) jslint(expected_a_before_b) [3,8]
这个jshint错误的原因可能是什么?
发布于 2020-07-27 23:48:13
看起来是因为JSLint不支持async/await
。
这是an issue that was raised和a patch submitted to fix it,但它还没有被合并,奇怪的是,当bug的作者决定“我不再关心了”时,bug被关闭了--奇怪的b/c Evgeny通常在JSLint邮件列表中非常活跃和有帮助。
我认为您的选择是尝试那个补丁,而不是使用async/await
,或者,不幸的是,至少在目前,更改linters。你也可以在JSLint上提交一个新的问题,基本上重复了之前在没有解决方案的情况下关闭的问题。
https://stackoverflow.com/questions/63118184
复制相似问题