After following the steps outlined in the firebase documentation to convert my cloud functions project to TypeScript (see https://firebase.google.com/docs/functions/typescript), I encountered an error when attempting to deploy using 'firebase deploy --only functions'.
Below is the stacktrace of the error:
deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint (here is my project path)
> tslint -p tslint.json
Invalid option for project: tslint.json
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `tslint -p tslint.json`
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:
npm ERR! /Users/macbook/.npm/_logs/2020-12-08T17_25_16_433Z-debug.log
This is my tsconfig.json configuration:
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017",
"types": ["node"],
"allowJs": true
},
"compileOnSave": true,
"include": [
"src"
]
}
Here is my package.json file:
{
"name": "functions",
"main": "./src/index.ts",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "./node_modules/.bin/tslint -p tslint.json",
"build": "./node_modules/.bin/tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "12"
},
"dependencies": {
"cors": "^2.8.5",
"firebase-admin": "^9.4.1",
"firebase-functions": "^3.13.0",
"googleapis": "^39.2.0",
"request": "^2.88.2",
"tslint": "^6.1.3",
"typedi": "^0.8.0",
"typescript": "^4.1.2"
},
"devDependencies": {
"@types/node": "^14.14.10",
"firebase-functions-test": "^0.1.7"
},
"private": true
}