由于Eslint错误,Vue Js没有部署到Firebase



我得到这个错误在过去的几个小时,我还没有能够解决它。我已经尝试了所有在线解决方案,包括在全球和项目中卸载斜面并再次安装它。不幸的是,最常见的答案并不适用于我的情况,因为我的包。Json文件并没有真正的文件结构。

Running command: npm --prefix "$RESOURCE_DIR" run lint
> lint
> eslint .

/Users/KingdomMac/Downloads/ermnl-dashboard-master/functions/index.js
22:71  error  Parsing error: Unexpected token =>
✖ 1 problem (1 error, 0 warnings)

Error: functions predeploy error: Command terminated with non-zero exit code1

我的包。json文件

{
"name": "vue-white-dashboard",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.3",
"@fortawesome/free-regular-svg-icons": "^5.15.3",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/vue-fontawesome": "^2.0.2",
"axios": "^0.21.1",
"chart.js": "^2.8.0",
"core-js": "^2.6.5",
"firebase": "^8.6.8",
"node-sass": "^4.9.0",
"vue": "^2.6.10",
"vue-chartjs": "^3.4.2",
"vue-click-outside": "^1.0.7",
"vue-clickaway": "^2.2.2",
"vue-github-buttons": "^3.1.0",
"vue-i18n": "^8.14.1",
"vue-router": "^3.0.3",
"vue-social-sharing": "^2.4.6",
"vue2-transitions": "^0.3.0",
"vuetify": "^2.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.11.0",
"@vue/cli-plugin-eslint": "^3.1.1",
"@vue/cli-service": "^3.5.3",
"@vue/eslint-config-prettier": "^5.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^8.1.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-vue": "^7.20.0",
"prettier": "^1.18.2",
"sass": "~1.32",
"sass-loader": "^10.0.0",
"vue-cli-plugin-vuetify": "~2.4.1",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.7.0"
}
}

还有我的。eslintrc.js文件

module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": "plugin:vue/essential",
"parserOptions": {
"ecmaVersion": 13
},
"plugins": [
"vue"
],
"rules": {
}
};

和我的index.js文件

const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();
const db = admin.firestore();
// exports.addAdminRole = functions.https.onCall((data, context) => {
//   // Get user and add custom claim (admin)
//   const customClaims = {
//     admin: true,
//   };
//   return admin.auth().getUserByEmail(data.email).then((user) => {
//     return admin.auth().setCustomUserClaims(user.uid, customClaims);
//   }).then((authUser) => {
//     return {
//       message: `Success! ${data.email} has been made an admin.`,
//     };
//   }).catch((error) => {
//     return error;
//   });
// });
exports.addUserRole = functions.auth.user().onCreate(async (authUser) => {
if (authUser.email) {
const customClaims = {
admin: true,
};
try {
let _ = await admin.auth().setCustomUserClaims(authUser.uid, customClaims);
return db.collection("roles").doc(authUser.uid).set({
email: authUser.email,
role: customClaims,
});
} catch (error) {
console.log(error);
}
}
});
exports.setUserRole = functions.https.onCall(async (data, context) => {
if (!context.auth.token.admin) return
try {
let _ = await admin.auth().setCustomUserClaims(data.uid, data.role)
return db.collection("roles").doc(data.uid).update({
role: data.role
})
} catch (error) {
console.log(error)
}
});

尝试在package.json中将"lint": "eslint ."更改为"lint": "eslint ",

相关内容

  • 没有找到相关文章

最新更新