diff --git a/lib/rules/methods.js b/lib/rules/methods.js index 1cb0245880..075087f042 100644 --- a/lib/rules/methods.js +++ b/lib/rules/methods.js @@ -8,7 +8,7 @@ import {NON_METEOR} from '../util/environment' import {getExecutors} from '../util' -import {isMeteorCall, getPropertyName, refersTo, hasContext} from '../util/ast' +import {isMeteorCall, isMeteorProp, getPropertyName, refersTo, hasContext} from '../util/ast' // ----------------------------------------------------------------------------- // Rule Definition @@ -117,6 +117,11 @@ module.exports = getMeta => context => { return { NewExpression: function (node) { + + if (!isMeteorProp(node.callee, 'Error')) { + return + } + const executors = getExecutors(env, context.getAncestors()) if (executors.size === 0) { return diff --git a/package.json b/package.json index 454e8e3bc2..7db6c725ca 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "colors": "1.1.2", "coveralls": "2.11.4", "cz-conventional-changelog": "1.1.4", - "eslint": "1.7.2", + "eslint": "1.7.3", "ghooks": "0.3.2", "istanbul": "0.4.0", "mocha": "2.3.3", diff --git a/tests/lib/rules/methods.js b/tests/lib/rules/methods.js index 3f131d020c..76fdb05f99 100644 --- a/tests/lib/rules/methods.js +++ b/tests/lib/rules/methods.js @@ -14,6 +14,7 @@ const rule = require('../../../dist/rules/methods') const RuleTester = require('eslint').RuleTester const commonValidCode = [ + 'new Meteor.foo()', 'Meteor.call("foo")', 'Meteor.call("foo", true)', 'Meteor.apply("foo", [], function () {})',