程序问答   发布时间:2022-05-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了部署 firebase 应用程序时 eslint 错误的问题大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决部署 firebase 应用程序时 eslint 错误的问题?

开发过程中遇到部署 firebase 应用程序时 eslint 错误的问题的问题如何解决?下面主要结合日常开发的经验,给出你关于部署 firebase 应用程序时 eslint 错误的问题的解决方法建议,希望对你解决部署 firebase 应用程序时 eslint 错误的问题有所启发或帮助;

我刚接触 firebase 应用程序,不习惯 eslint 错误。

代码在代码编辑器中看起来不错,但是命令行拒绝部署我的应用程序并显示错误:11:65 error Parsing error: Unexpected token =>

我的代码看起来像我直接从 firebase 在线指南中获取的代码,此处引用:https://firebase.google.com/docs/functions/get-started?authuser=0

//  The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
'use Strict';

//  The Firebase admin SDK to access Firestore.
const admin = require('firebase-admin');
const functions = require('firebase-functions');
admin.initializeApp();

// Take the text parameter passed to this http endpoint and insert it into 
// Firestore under the path /messages/:documentID/original
exports.addmessage = functions.https.onrequest(async (req,res) => {
    // Grab the text parameter.
    const original = req.query.text;
    // Push the new messagE into Firestore using the Firebase admin SDK.
    const writeResult = await admin.firestore().collection('messages').add({original: original});
    // Send BACk a message that we've successfully written the message
    res.Json({result: `message with ID: ${writeResult.ID} added.`});
  });
  
  // Listens for new messages added to /messages/:documentID/original and creates an
  // uppercase version of the message to /messages/:documentID/uppercase
  exports.makeUppercase = functions.firestore.document('/messages/{documentID}')
      .onCreate((snap,context) => {
        // Grab the current value of what was written to Firestore.
        const original = snap.data().original;
  
        // Access the parameter `{documentID}` with `context.params`
        functions.logger.log('Uppercasing',context.params.documentID,original);
        
        const uppercase = original.toupperCase();
        
        // You must return a Promise when performing asynchronous tasks insIDe a Functions such as
        // wriTing to Firestore.
        // SetTing an 'uppercase' fIEld in Firestore document returns a Promise.
        return snap.ref.set({uppercasE},{merge: truE});
      });
  

谁能帮助我理解我做错了什么以及这个错误的原因?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的部署 firebase 应用程序时 eslint 错误的问题全部内容,希望文章能够帮你解决部署 firebase 应用程序时 eslint 错误的问题所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。