-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
duaraghav8
committed
Apr 26, 2018
1 parent
e41b557
commit 66b2c45
Showing
6 changed files
with
69 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* @fileoverview Ensure that no empty blocks {} exist | ||
* @fileoverview Ensure that no empty blocks exist | ||
* @author Raghav Dua <[email protected]> | ||
*/ | ||
|
||
|
@@ -42,17 +42,17 @@ module.exports = { | |
} | ||
|
||
function inspectBlockStatement(emitted) { | ||
let node = emitted.node; | ||
const { node } = emitted, { body } = node; | ||
|
||
/** | ||
* Allow Function declarations to have empty bodies. | ||
* Fallback functions - supported in Solidity v4 and above. | ||
*/ | ||
if (emitted.exit || context.getSourceCode().getParent(node).type === "FunctionDeclaration") { | ||
// Allow Function & Constructor declarations to have empty bodies. | ||
if ( | ||
emitted.exit || | ||
["FunctionDeclaration", "ConstructorDeclaration"].includes(context.getSourceCode().getParent(node).type) | ||
) { | ||
return; | ||
} | ||
|
||
if (node.body && node.body.constructor.name === "Array" && !node.body.length) { | ||
if (body && body.constructor.name === "Array" && !body.length) { | ||
report(node); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters