带有异步的 firebase 函数 https.onRequest 失败 eslint

firebase function https.onRequest with async fails eslint

我有 firebase 功能

exports.oauth = functions.https.onRequest(async (request, response) => {

eslint 抛出如下错误

  11:69  error  Parsing error: Unexpected token =>

✖ 1 problem (1 error, 0 warnings)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

这里有什么问题?

Cloud Functions 目前运行节点 6,它不支持 ECMAScript 2017 中的 async/await 语法。如果你想使用 async/await,你应该使用 TypeScript 或其他可以转换为等价物的东西在节点 6 上运行的代码。