はじめに
firebase deploy --only functionsしたらエラーError: functions predeploy error:になってしまい、出来なかったが解決した。(というか諦めた。)
環境の情報
OS
macOS Big Sur 11.3
注意
最新の状態を確認して下さい。
参考さまはこちら
最終更新日
2023年7月12日
状況
% firebase deploy --only functions
すると
バキッとエラーになってしまう。
=== Deploying to 'myproject'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> lint
> eslint .
Oops! Something went wrong! :(
ESLint: 8.44.0
ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.
The config "prettier" was referenced from the config file in "/いろんなeslint-plugin.js".
If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.
Error: functions predeploy error: Command terminated with non-zero exit code 2
プラグインとか、依存関係など調べてチクチク入れたり直したけど、直らず。
結論
firebase.json
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
下
Firebaseのデプロイ時には、ESLintを無効して使わない。
"predeploy"の値を空の文字列に変える。
これにより、firebase deploy --only functionsを実行する際にESLintのステップがスキップされる。
firebase.json
"predeploy": [
""
]
注意
デプロイ時にLint処理を無効にすることは、エラーやコード品質の問題がデプロイ前に検出されなくなってしまう。
コードの品質を保証し、問題を事前に検出するためには有効にしたほうが良かったり。