Skip to content

Comments

refactor(node): move throw error out of finally block to pass no-unsafe-finally#810

Merged
ry merged 1 commit intodenoland:mainfrom
magurotuna:fix-unsafe-throw
Mar 21, 2021
Merged

refactor(node): move throw error out of finally block to pass no-unsafe-finally#810
ry merged 1 commit intodenoland:mainfrom
magurotuna:fix-unsafe-throw

Conversation

@magurotuna
Copy link
Member

This code should violate no-unsafe-finally, but due to a bug of deno_lint, no lint error happens at the moment.
(This bug is fixed in denoland/deno_lint#641)
In fact, if we run ESLint with no-unsafe-finally enabled, the following output is emitted:

  111:16  error  Unsafe usage of ThrowStatement  no-unsafe-finally

✖ 1 problem (1 error, 0 warnings)

It looks like this if (error) throw error; could be moved out of the finally block. This patch did so to work around no-unsafe-finally.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ry ry merged commit ecfccd6 into denoland:main Mar 21, 2021
@magurotuna magurotuna deleted the fix-unsafe-throw branch March 21, 2021 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants