Skip to content

Commit 4d3c3f0

Browse files
committed
tools: enable no-unsafe-finally
This enables the `no-unsafe-finally` eslint rule to make sure we have a proper control flow in try / catch. PR-URL: nodejs#18745 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d8d84ee commit 4d3c3f0

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ rules:
152152
}]
153153
no-tabs: error
154154
no-trailing-spaces: error
155+
no-unsafe-finally: error
155156
object-curly-spacing: [error, always]
156157
one-var-declaration-per-line: error
157158
operator-linebreak: [error, after]

test/common/index.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -504,21 +504,13 @@ exports.canCreateSymLink = function() {
504504
const whoamiPath = path.join(process.env['SystemRoot'],
505505
'System32', 'whoami.exe');
506506

507-
let err = false;
508-
let output = '';
509-
510507
try {
511-
output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
508+
const output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
509+
return output.includes('SeCreateSymbolicLinkPrivilege');
512510
} catch (e) {
513-
err = true;
514-
} finally {
515-
if (err || !output.includes('SeCreateSymbolicLinkPrivilege')) {
516-
return false;
517-
}
511+
return false;
518512
}
519513
}
520-
521-
return true;
522514
};
523515

524516
exports.getCallSite = function getCallSite(top) {

0 commit comments

Comments
 (0)