-
-
Save vitorbal/dfabb2fda24cd47e3d7986a215749b01 to your computer and use it in GitHub Desktop.
eslint-ast-selectors
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
module.exports = { | |
create(context) { | |
return { | |
// This will be called for all FunctionDeclaration nodes | |
"FunctionDeclaration": function(functionDeclarationNode) { | |
// ...your custom logic goes here | |
}, | |
} | |
}; |
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
module.exports = { | |
create(context) { | |
return { | |
"FunctionDeclaration": function(node) { | |
// First, exclude all function declarations that don't have | |
// more than 3 parameters | |
if (node.params.length <= 3) { | |
return; | |
} | |
// Now we can do our custom logic on functions with > 3 params | |
// .. custom logic goes here | |
} | |
} | |
}; |
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
module.exports = { | |
create(context) { | |
return { | |
"FunctionDeclaration[params.length>3]": function(node) { | |
// ...custom logic goes here | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment