summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-01-08 10:36:28 -0500
committercjihrig <cjihrig@gmail.com>2019-01-11 16:17:33 -0500
commitcf9bcdeabe1cac2c19785183e9f34e1a01cb9047 (patch)
treeaf0462a36f0eaeb777d6d8c5c2ec58c56b601af1 /tools
parentc69ea3b1d5e258cd8234b9d5f771e132f0c4a23c (diff)
downloadandroid-node-v8-cf9bcdeabe1cac2c19785183e9f34e1a01cb9047.tar.gz
android-node-v8-cf9bcdeabe1cac2c19785183e9f34e1a01cb9047.tar.bz2
android-node-v8-cf9bcdeabe1cac2c19785183e9f34e1a01cb9047.zip
tools: lint for use of internalBinding()
Use of process.binding() has largely been replaced by internalBinding(). This commit updates the custom crypto check ESLint rule to check for both process.binding() and internalBinding(). Refs: https://github.com/nodejs/node/pull/24952 PR-URL: https://github.com/nodejs/node/pull/25395 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/eslint-rules/rules-utils.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/eslint-rules/rules-utils.js b/tools/eslint-rules/rules-utils.js
index 0e89a71545..315e7ca0ad 100644
--- a/tools/eslint-rules/rules-utils.js
+++ b/tools/eslint-rules/rules-utils.js
@@ -33,14 +33,15 @@ module.exports.isCommonModule = function(node) {
/**
* Returns true if any of the passed in modules are used in
- * binding calls.
+ * process.binding() or internalBinding() calls.
*/
module.exports.isBinding = function(node, modules) {
- if (node.callee.object) {
- return node.callee.object.name === 'process' &&
- node.callee.property.name === 'binding' &&
- modules.includes(node.arguments[0].value);
- }
+ const isProcessBinding = node.callee.object &&
+ node.callee.object.name === 'process' &&
+ node.callee.property.name === 'binding';
+
+ return (isProcessBinding || node.callee.name === 'internalBinding') &&
+ modules.includes(node.arguments[0].value);
};
/**