From be5629265095615511f5b53a2a5c43a16343c775 Mon Sep 17 00:00:00 2001 From: Pat Herlihy Date: Tue, 26 Nov 2019 08:31:44 -0500 Subject: [PATCH] Fix the `custom-error-definition` rule to support constructors without a body. --- rules/custom-error-definition.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rules/custom-error-definition.js b/rules/custom-error-definition.js index e2b4ce56cf..f710fa8091 100644 --- a/rules/custom-error-definition.js +++ b/rules/custom-error-definition.js @@ -80,6 +80,12 @@ const customErrorDefinition = (context, node) => { } const constructorBodyNode = constructor.value.body; + + // Verify the constructor has a body + if (!constructorBodyNode) { + return; + } + const constructorBody = constructorBodyNode.body; const superExpression = constructorBody.find(isSuperExpression);