diff --git a/src/core/namespaceValidator.js b/src/core/namespaceValidator.js index e39f69a0f0..b1141840b5 100644 --- a/src/core/namespaceValidator.js +++ b/src/core/namespaceValidator.js @@ -12,16 +12,17 @@ export default function namespaceValidator( // go deep let namespace = namespaces.get(node.object.name); const namepath = [node.object.name]; + const returnChecker = 510; // callbacks return this value if they want THIS function to stop executing // while property is namespace and parent is member expression, keep validating while (namespace instanceof Exports && node.type === 'MemberExpression') { if (node.computed) { - if (onComputed(node) === 'return') { + if (onComputed(node, returnChecker) === returnChecker) { return; } } if (onNamespaceNotFound) { - if (onNamespaceNotFound(node, namespace, namepath) === 'return') { + if (onNamespaceNotFound(node, namespace, namepath, returnChecker) === returnChecker) { return; } } diff --git a/src/rules/namespace.js b/src/rules/namespace.js index eb99131129..f000105c85 100644 --- a/src/rules/namespace.js +++ b/src/rules/namespace.js @@ -118,25 +118,25 @@ module.exports = { } function onComputed(context, allowComputed){ - return function innerOnComputed(node) { + return function innerOnComputed(node, returnChecker) { if (!allowComputed) { context.report( node.property, `Unable to validate computed reference to imported namespace '${dereference.object.name}'.`, ); } - return 'return'; + return returnChecker; }; } function onNamespaceNotFound(context) { - return function inner(node, namespace, namepath) { + return function inner(node, namespace, namepath, returnChecker) { if (!namespace.has(node.property.name)) { context.report( node.property, makeMessage(node.property, namepath), ); - return 'return'; + return returnChecker; } }; } diff --git a/src/rules/no-deprecated.js b/src/rules/no-deprecated.js index c0ec408165..18abc29555 100644 --- a/src/rules/no-deprecated.js +++ b/src/rules/no-deprecated.js @@ -122,7 +122,7 @@ module.exports = { function onComputed() { // ignore computed parts for now - return 'return'; + return arguments[2]; } namespaceValidator(