小能豆

Got Unsafe usage of ThrowStatement (no-unsafe-finally) in my Firebase functions

javascript

It’s been a while since I’ve changed to my Flutter Firebase functions code.

And today, I am blocked from deploying the new code because I get this error:

7:497 error Unsafe usage of ThrowStatement no-unsafe-finally

And over 120 of the likes in my code (such as Expected a 'break' statement before 'case'etc.).

By inspecting the code generated as follows:

function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

I understand that eslint sees the throw in the finally is the source of the issue it reports.

As I am using version 11.18.0 and that 12.4.5 is available, I wonder if this error would be fixed and whether upgrading could draw me into additional or others issues.

So, maybe I could start with a fix in eslintrc.js or you think is safe to go to npm install -g firebase-tools?


阅读 50

收藏
2023-12-02

共1个答案

小能豆

I have finally found a fix.

For some reasons, removing my dist folder is the solution.

And running npm run deploy again is now OK.

2023-12-02