小编Gau*_*ani的帖子

Firebase 云函数传播运算符未通过 eslint 检查且上传失败

任何人都可以弄清楚我如何解决 linter 错误。这段代码已经过测试并且运行良好。唯一的问题是我无法将它部署在云功能基础架构上。

我确定 .eslintrc 文件有问题。任何人都可以帮助我了解如何使用传播运算符。

这是 linter 抛出错误的地方:

const rightChoices = _.map(snapshot.val(), (val, questionId) => {
  return { ...val, questionId};
})
Run Code Online (Sandbox Code Playgroud)

这是我的 .eslintrc 文件:

{
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
  "jsx": true,
  "experimentalObjectRestSpread": true
}
}
"plugins":[
"promise"
],
"extends": "eslint:recommended",
"rules": {
// Removed rule "disallow the use of console" from recommended eslint rules
"no-console": "off",

// Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
"no-regex-spaces": "off",

// Removed rule "disallow …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions eslintrc

6
推荐指数
2
解决办法
2082
查看次数