Where can I use ---fix in project?

383

Try this:

npm run lint -- --fix
Share:
383
Admin
Author by

Admin

Updated on December 19, 2022

Comments

  • Admin
    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
    

    Heres the first pictureenter image description here And the other.

    enter image description here

    • Shivam Singla
      Shivam Singla about 3 years
      What are the other errors?
    • Admin
      Admin about 3 years
      I mean these to errors thats not fixable with --fix command
    • Shivam Singla
      Shivam Singla about 3 years
      Yeh, after fixing the auto-fixable errors, please paste those errors here
    • Admin
      Admin about 3 years
      Im 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
    Admin about 3 years
    Should I pass this inside the terminal ?
  • Michal Žídek
    Michal Žídek about 3 years
    Yes, just like you run your node app.js or how you run your script.
  • Admin
    Admin about 3 years
    I get error when im trying to use this please check my latest post update
  • Shivam Singla
    Shivam Singla about 3 years
    In which directory, the first command was run and where are running the command with --fix
  • Admin
    Admin about 3 years
    And I just wanna update my script to firebase inside my project as a function with this command firebase deploy --only functions
  • Michal Žídek
    Michal Žídek about 3 years
    I 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
    Admin about 3 years
    please check update hope this was what you mean if not please say what else
  • Admin
    Admin about 3 years
    I See I already enter the correct picture ? Isnt there package json?
  • Shivam Singla
    Shivam Singla about 3 years
    @usinguser Go to the project root and run- cd functions && npm run lint -- --fix
  • Michal Žídek
    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
    Admin about 3 years
    I 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