Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1933 from eslint/issue1930
Update: no-empty to check TryStatement.handler (fixes #1930)
  • Loading branch information
nzakas committed Mar 7, 2015
2 parents bc0f24f + 9524c8d commit c8bd53d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rules/no-empty.js
Expand Up @@ -17,10 +17,11 @@ module.exports = function(context) {
var ancestors = context.getAncestors(),
parent = ancestors[ancestors.length - 1],
parentType = parent.type,
hasHandler = !!(parent.handler || (parent.handlers && parent.handlers.length)),
isFinallyBlock = (parentType === "TryStatement") && (parent.finalizer === node);

if (/Function|CatchClause/.test(parentType) ||
(isFinallyBlock && !parent.handlers.length)) {
(isFinallyBlock && !hasHandler)) {
return;
}

Expand Down

0 comments on commit c8bd53d

Please sign in to comment.