Where can I use ---fix in project?
383
Try this:
npm run lint -- --fix
Author by
Admin
Updated on December 19, 2022Comments
-
Admin over 1 year
Im getting 33 errors but I can fix with--fix . My question is where I pass this command?Hope anyone can help
✖ 35 problems (35 errors, 0 warnings) 33 errors and 0 warnings potentially fixable with the `--fix` option. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! functions@ lint: `eslint --ext .js,.ts .` 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. npm ERR! A complete log of this run can be found in:
This is my file whee the errors located.
import * as functions from "firebase-functions"; import * as admin from "firebase-admin"; admin.initializeApp(); export const onConversationCreated = functions.firestore. document("Conversations/{conversationID}").onCreate((snapshot, context) => { let data = snapshot.data(); let conversationID = context.params.conversationID; if (data) { let members = data.members; for (let index = 0; index < members.length; index++) { let uid = members[index]; let remainingUserIDs = members.filter((u:string) => u !== uid); remainingUserIDs.forEach((m:string) => { return admin.firestore().collection("meinprofilsettings").doc(m).get().then((_doc) => { let userData = _doc.data(); if (userData) { return admin.firestore().collection("meinprofilsettings").doc(uid).collection("Conversations").doc(m).create({ "conversationID": conversationID, "url": userData.url, "name": userData.username, "unseenCount": 0, }); } return null; }).catch(() => { return null; }); }); } } return null; });
and maybe anyone knows what's the 2 other errors meaning?
Im getting this errors when im running npm run lint -- --fix
npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /Users/name/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/Users/name/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /Users/name/.npm/_logs/2021-03-25T12_43_38_604Z-debug.log
-
Shivam Singla about 3 yearsWhat are the other errors?
-
Admin about 3 yearsI mean these to errors thats not fixable with --fix command
-
Shivam Singla about 3 yearsYeh, after fixing the auto-fixable errors, please paste those errors here
-
Admin about 3 yearsIm getting no error anymore but at my new function there's seems to be something wrong . Maybe you can check my post stackoverflow.com/questions/66807510/…
-
-
Admin about 3 yearsShould I pass this inside the terminal ?
-
Michal Žídek about 3 yearsYes, just like you run your
node app.js
or how you run your script. -
Admin about 3 yearsI get error when im trying to use this please check my latest post update
-
Shivam Singla about 3 yearsIn which directory, the first command was run and where are running the command with
--fix
-
Admin about 3 yearsAnd I just wanna update my script to firebase inside my project as a function with this command firebase deploy --only functions
-
Michal Žídek about 3 yearsI see that NPM cannot find package.json, can you spost structure of the files? package.json should be in same directory as you running the script @usinguser
-
Admin about 3 yearsplease check update hope this was what you mean if not please say what else
-
Admin about 3 yearsI See I already enter the correct picture ? Isnt there package json?
-
Shivam Singla about 3 years@usinguser Go to the project root and run-
cd functions && npm run lint -- --fix
-
Michal Žídek about 3 years@usinguser I would just move the index.ts to parent folder (same where the package.json is) and you are good to go, you can then create folder with your other stuff.
-
Admin about 3 yearsI think that was it but your first answer was better the without cd functions&&. I trying it first I have to enter my bill account without that it will not working. @Shivam Singla