Skip to content

Commit

Permalink
Simplify no-console implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Feb 8, 2023
1 parent 0ced110 commit 7110266
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/rules/best-practises/no-console.js
Expand Up @@ -39,7 +39,7 @@ class NoConsoleLogChecker extends BaseChecker {
}

ImportDirective(node) {
if (this.isAnImport(node)) {
if (this.isConsoleImport(node)) {
this.error(node, 'Unexpected import of console file')
}
}
Expand All @@ -59,12 +59,11 @@ class NoConsoleLogChecker extends BaseChecker {
)
}

isAnImport(node) {
isConsoleImport(node) {
return (
node.type === 'ImportDirective' &&
(node.path === 'hardhat/console.sol' ||
node.path === 'forge-std/console.sol' ||
node.path === 'forge-std/console2.sol')
node.path === 'hardhat/console.sol' ||
node.path === 'forge-std/console.sol' ||
node.path === 'forge-std/console2.sol'
)
}
}
Expand Down

0 comments on commit 7110266

Please sign in to comment.