Thomas David Kehoe
Thomas David Kehoe

Reputation: 10930

Where does Firebase specify using ESLint?

When running firebase init functions it asks

Do you want to use ESLint to catch probable bugs and enforce style?

Apparently this preference is set in some file somewhere. What is this file? How do I change it say that I don't want to use ESLint? No, running firebase init functions again and telling it that I didn't want to use ESLint didn't get the message across.

In my project root directory I see in package.json:

"devDependencies": {
    "eslint": "^5.9.0",
    "eslint-config-google": "^0.11.0",
    "eslint-config-standard": "^12.0.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-node": "^8.0.0",
    "eslint-plugin-promise": "^4.0.1",
    "eslint-plugin-standard": "^4.0.0"
  }

Is that the file? Also in my project root directory I looked at firebase.json, .firebaserc, and .eslintrc.json, these files doesn't say anything about ESLint. In my functions folder there's a package.json but it doesn't say anything about ESLint.

Upvotes: 3

Views: 2955

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599111

This is put in the package.json as part of the scripts section.

From a quick test I did, the linting is defined in functions/package.json:

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  ...

If I look in the firebase.json in my project's root, I see:

{
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ]
  }
}

So there it is configured to lint and build before each deploy.

Upvotes: 3

Related Questions