user3339691
user3339691

Reputation: 475

my npm-lint is throwing error "missing script: lint"

I am trying to run npm run locally, and ran npm init, that created package.json. Here is my package.json

    "name": "ironic-ui",
    "version": "1.0.0",
    "description": "======================== Team and repository tags    ========================",
    "main": "test-shim.js",
    "directories": {
    "doc": "doc"
   },
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
   },
    "repository": {
    "type": "git",
    "url": "https://git.openstack.org/openstack/ironic-ui"
  },
    "author": "",
    "license": "ISC"
 }

Is there missing something? Or do i need to install something more? I am getting an error "Missing script: lint" Thanks

Upvotes: 19

Views: 52274

Answers (9)

Jonathan Sanchez
Jonathan Sanchez

Reputation: 9444

Should not be removing eslint, instead should try to configure it to make it work to your preferences.

However, if you need to remove it because of time or other constraint

  1. From firebase.json delete "npm --prefix \"$RESOURCE_DIR\" run lint"
  2. From Package.json delete "lint": "eslint .", (should be within the scripts:)
  3. Also from Package.json delete these devDependencies
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0"`
  1. Delete this file from repo `.eslintrc.js
  2. Then run npm i

then you should be able to run firebase deploy

Upvotes: 11

Robin
Robin

Reputation: 1

Editing package.json from "lint": "eslint .", to "lint": "eslint", worked for me.

Upvotes: 0

Abrham Daniel
Abrham Daniel

Reputation: 49

For me i was just running the command without entering the function folder so it was not finding it i was just running this function on the project folder. So run cd function in your cmd if your are just in the project folder then run the command again but if the script is not in your package.json as mentioned above or you said no to eslint/lint when you initialized your firebase project lint wont work but others command that exist in your scripts work.

Upvotes: 0

Jefftopia
Jefftopia

Reputation: 2165

I ran into this issue when after setting up a firebase functions project inside a project that already had a firebase function elsewhere. It seems that firebase init doesn't necessarily know which project to set as "source" in firebase.json.

In my case, firebase.json simply pointed to the wrong source dir. I corrected it to point the my intended directory - issue solves.

Note: In my case, linting was desired, so removing linting was not the solution.

Upvotes: 1

If you want to remove eslint from your Firebase Functions project, you can go to firebase.json and delete the line npm --prefix \"$RESOURCE_DIR\" run lint (inside predeploy). After this, you can delete the .eslintrc.json file inside your functions project

Upvotes: 8

phone mhan
phone mhan

Reputation: 61

I got the same problem.

I deleted functions folder, .firebaserc and firebase.json.

Then reinstalled firebase-tools

npm install -g firebase-tools

After firebase init, chose functions, it asked

Do you want to use ESLint to catch probable .....?.

I typed No.

It worked fine for me.

Upvotes: 6

mafiurs
mafiurs

Reputation: 159

Add this script to your package.json file: "lint": "./node_modules/.bin/eslint ."

Upvotes: 13

Ziad
Ziad

Reputation: 73

I get the exact same problem when I do: firebase deploy --only functions (-- only functions is optional), it redirects me to

npm --prefix %RESOURCE_DIR% run lint

It worked fine for me when I removed lint, thus having:

npm --prefix %RESOURCE_DIR% run

only.

Upvotes: 0

roxxypoxxy
roxxypoxxy

Reputation: 3121

You need to setup linter and add lint command in your package.json Many linter are available. Assuming you setup eslint https://www.npmjs.com/package/eslint

it would look something like this

// package.json
{ 
  //...
  "scripts": {
    "lint": "eslint.js"
  }
}

Upvotes: 14

Related Questions