From 459a6d5fa7f8acd124b70eb4d7a5acdb3793eddb Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 4 Feb 2016 22:51:26 -0800 Subject: [PATCH 1/2] Fix crash on real-world code Trying to add this to `standard` and caught a crash. --- rules/always-catch.js | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/always-catch.js b/rules/always-catch.js index 17bd5ad6..43a2bf4e 100644 --- a/rules/always-catch.js +++ b/rules/always-catch.js @@ -14,6 +14,7 @@ module.exports = function (context) { if (node.expression.type === 'CallExpression' && node.expression.callee.type === 'MemberExpression' && node.expression.callee.object.type === 'CallExpression' && + node.expression.callee.object.callee.type === 'MemberExpression' && node.expression.callee.object.callee.property.name === 'then' ) { if (node.expression.callee.property.name !== 'catch') { From 458e823b85208fe9a6a86197acc8ff314bd3df03 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 4 Feb 2016 23:16:06 -0800 Subject: [PATCH 2/2] Fix another crash on real-world code --- rules/param-names.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/param-names.js b/rules/param-names.js index 59b4c041..a4489d9e 100644 --- a/rules/param-names.js +++ b/rules/param-names.js @@ -4,7 +4,7 @@ module.exports = function (context) { if (node.callee.name === 'Promise' && node.arguments.length === 1) { var params = node.arguments[0].params - if (!params.length) { return } + if (!params || !params.length) { return } if (params[0].name !== 'resolve') { return context.report(node, 'Promise constructor parameters must be named resolve, reject')