nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: ember-cli/eslint-plugin-ember
Pull request #160 (2017-11-06 15:55:53)

ignore tagged templates for avoid-leaking-state-in-ember-objects rule
Fixes https://github.com/ember-cli/eslint-plugin-ember/issues/159


Patch:
diff --git a/lib/rules/avoid-leaking-state-in-ember-objects.js b/lib/rules/avoid-leaking-state-in-ember-objects.js
index d1376eb0..13c0be38 100644
--- a/lib/rules/avoid-leaking-state-in-ember-objects.js
+++ b/lib/rules/avoid-leaking-state-in-ember-objects.js
@@ -21,7 +21,9 @@ const isAllowed = function (property) {
     utils.isLiteral(value) ||
     utils.isIdentifier(value) ||
     utils.isCallExpression(value) ||
-    utils.isBinaryExpression(value);
+    utils.isBinaryExpression(value) ||
+    utils.isTemplateLiteral(value) ||
+    utils.isTaggedTemplateExpression(value);
 };
 
 
diff --git a/lib/utils/utils.js b/lib/utils/utils.js
index 5789f998..b4c8d21e 100644
--- a/lib/utils/utils.js
+++ b/lib/utils/utils.js
@@ -17,6 +17,7 @@ module.exports = {
   isCallWithFunctionExpression,
   isThisExpression,
   isConditionalExpression,
+  isTemplateLiteral,
   isTaggedTemplateExpression,
   isGlobalCallExpression,
   getSize,
@@ -225,6 +226,16 @@ function isTaggedTemplateExpression(node) {
   return node !== undefined && node.type === 'TaggedTemplateExpression';
 }
 
+/**
+ * Check whether or not a node is a TemplateLiteral.
+ *
+ * @param {Object} node The node to check.
+ * @returns {boolean} Whether or not the node is a TemplateLiteral.
+ */
+function isTemplateLiteral(node) {
+  return node !== undefined && node.type === 'TemplateLiteral';
+}
+
 /**
  * Check if given call is a global call
  *


Test patch:
diff --git a/tests/lib/rules/avoid-leaking-state-in-ember-objects.js b/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
index a053a5dc..7c90d8d1 100644
--- a/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
+++ b/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
@@ -89,6 +89,12 @@ eslintTester.run('avoid-leaking-state-in-ember-objects', rule, {
     {
       code: "export default Foo.extend({ fullName: 'a' + 'b' });"
     },
+    {
+      code: 'export default Foo.extend({ test: hbs`lorem ipsum` });'
+    },
+    {
+      code: 'export default Foo.extend({ test: `lorem ipsum` });'
+    }
   ],
   invalid: [
     {
Repository: ember-cli/eslint-plugin-ember
Pull request #226 (2018-02-08 17:43:58)

Use correct name of observer prototype extension
The prototype extension for creating an observer is `observes()` not `observe()`.


Patch:
diff --git a/docs/rules/no-function-prototype-extensions.md b/docs/rules/no-function-prototype-extensions.md
index 82d6c48a..03b614c3 100644
--- a/docs/rules/no-function-prototype-extensions.md
+++ b/docs/rules/no-function-prototype-extensions.md
@@ -2,13 +2,13 @@
 
 ### Rule name: `no-function-prototype-extensions`
 
-Use computed property syntax, observer syntax or module hooks instead of `.property()`, `.observe()` or `.on()` in Ember modules.
+Use computed property syntax, observer syntax or module hooks instead of `.property()`, `.observes()` or `.on()` in Ember modules.
 
 ```javascript
 export default Component.extend({
     // BAD
     abc: function() { /* custom logic */ }.property('xyz'),
-    def: function() { /* custom logic */ }.observe('xyz'),
+    def: function() { /* custom logic */ }.observes('xyz'),
     ghi: function() { /* custom logic */ }.on('didInsertElement'),
 
     // GOOD
diff --git a/lib/rules/no-function-prototype-extensions.js b/lib/rules/no-function-prototype-extensions.js
index aeb0e9c8..d6698b35 100644
--- a/lib/rules/no-function-prototype-extensions.js
+++ b/lib/rules/no-function-prototype-extensions.js
@@ -19,7 +19,7 @@ module.exports = {
   create(context) {
     const message = 'Don\'t use Ember\'s function prototype extensions';
 
-    const functionPrototypeExtensionNames = ['property', 'observe', 'on'];
+    const functionPrototypeExtensionNames = ['property', 'observes', 'on'];
 
     const isFunctionPrototypeExtension = function (property) {
       return utils.isIdentifier(property) &&


Test patch:
diff --git a/tests/lib/rules/no-function-prototype-extensions.js b/tests/lib/rules/no-function-prototype-extensions.js
index d099c489..dee19482 100644
--- a/tests/lib/rules/no-function-prototype-extensions.js
+++ b/tests/lib/rules/no-function-prototype-extensions.js
@@ -82,7 +82,7 @@ eslintTester.run('no-function-prototype-extensions', rule, {
       }],
     },
     {
-      code: 'export default Controller.extend({test: function() {}.observe("abc")});',
+      code: 'export default Controller.extend({test: function() {}.observes("abc")});',
       parserOptions: { ecmaVersion: 6, sourceType: 'module' },
       errors: [{
         message: 'Don\'t use Ember\'s function prototype extensions',
Repository: ember-cli/eslint-plugin-ember
Pull request #230 (2018-02-19 13:52:10)

Fix for no-side-effect to make it compatible with use-ember-get-and-set 


Patch:
diff --git a/lib/rules/no-side-effects.js b/lib/rules/no-side-effects.js
index a58f0e84..7cbea83b 100644
--- a/lib/rules/no-side-effects.js
+++ b/lib/rules/no-side-effects.js
@@ -36,6 +36,13 @@ module.exports = {
             fnExpressions.forEach((fnExpression) => {
               const fnCallee = fnExpression.expression.callee;
 
+              if (
+                utils.isIdentifier(fnCallee) &&
+                fnCallee.name === 'set') {
+                report(fnExpression);
+                return;
+              }
+
               if (
                 utils.isMemberExpression(fnCallee) &&
                 utils.isThisExpression(fnCallee.object) &&


Test patch:
diff --git a/tests/lib/rules/no-side-effects.js b/tests/lib/rules/no-side-effects.js
index 2e23d102..91619a20 100644
--- a/tests/lib/rules/no-side-effects.js
+++ b/tests/lib/rules/no-side-effects.js
@@ -24,6 +24,12 @@ eslintTester.run('no-side-effects', rule, {
       errors: [{
         message: 'Don\'t introduce side-effects in computed properties',
       }],
+    }, {
+      code: 'prop: computed("test", function() {set(this, "testAmount", test.length); return "";})',
+      parserOptions: { ecmaVersion: 6, sourceType: 'module' },
+      errors: [{
+        message: 'Don\'t introduce side-effects in computed properties',
+      }],
     },
   ],
 });
Repository: ember-cli/eslint-plugin-ember
Pull request #245 (2018-03-23 22:24:10)

[avoid-leaking-state-in-ember-objects] Expose default ignored properties
This PR exposes `DEFAULT_IGNORED_PROPERTIES` on the rule `ember/avoid-leaking-state-in-ember-objects` so that users' `.eslintrc.js` files can go from this:

```js
// ...
rules: {
  'ember/avoid-leaking-state-in-ember-objects': ['error', [
    'classNames',
    'classNameBindings',
    'actions',
    'concatenatedProperties',
    'mergedProperties',
    'positionalParams',
    'attributeBindings',
    'queryParams',
    'attrs',
    'shortcuts',
    'include',
  ],
  // ...
},
// ...
```

To this:

```js
const { DEFAULT_IGNORED_PROPERTIES } = require('eslint-plugin-ember/lib/rules/avoid-leaking-state-in-ember-objects');
//...
rules: {
  'ember/avoid-leaking-state-in-ember-objects': ['error', [
    ...DEFAULT_IGNORED_PROPERTIES,
    'shortcuts',
    'include',
  ],
  // ...
},
// ...
```


Patch:
diff --git a/lib/rules/avoid-leaking-state-in-ember-objects.js b/lib/rules/avoid-leaking-state-in-ember-objects.js
index dde58b90..227aaf4a 100644
--- a/lib/rules/avoid-leaking-state-in-ember-objects.js
+++ b/lib/rules/avoid-leaking-state-in-ember-objects.js
@@ -48,6 +48,8 @@ module.exports = {
     }],
   },
 
+  DEFAULT_IGNORED_PROPERTIES,
+
   create(context) {
     const ignoredProperties = context.options[0] || DEFAULT_IGNORED_PROPERTIES;
 


Test patch:
diff --git a/tests/lib/rules/avoid-leaking-state-in-ember-objects.js b/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
index d6097fe1..cb3b5b87 100644
--- a/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
+++ b/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
@@ -9,6 +9,22 @@ const RuleTester = require('eslint').RuleTester;
 // Tests
 // ------------------------------------------------------------------------------
 
+describe('imports', () => {
+  it('should expose the default ignored properties', () => {
+    expect(rule.DEFAULT_IGNORED_PROPERTIES).toEqual([
+      'classNames',
+      'classNameBindings',
+      'actions',
+      'concatenatedProperties',
+      'mergedProperties',
+      'positionalParams',
+      'attributeBindings',
+      'queryParams',
+      'attrs',
+    ]);
+  });
+});
+
 const eslintTester = new RuleTester({
   parserOptions: {
     ecmaVersion: 6,
Repository: ember-cli/eslint-plugin-ember
Pull request #353 (2018-12-14 23:02:40)

Fix error thrown when avoid-leaking-state-in-ember-objects comes upon…
… a spread operator.

@Turbo87 
@rwjblue 


Patch:
diff --git a/lib/rules/avoid-leaking-state-in-ember-objects.js b/lib/rules/avoid-leaking-state-in-ember-objects.js
index 01b3b6dd..daed51a4 100644
--- a/lib/rules/avoid-leaking-state-in-ember-objects.js
+++ b/lib/rules/avoid-leaking-state-in-ember-objects.js
@@ -66,7 +66,9 @@ module.exports = {
         const properties = ember.getModuleProperties(node);
 
         properties
-          .filter(property => ignoredProperties.indexOf(property.key.name) === -1)
+          .filter(property =>
+            property.key && ignoredProperties.indexOf(property.key.name) === -1
+          )
           .forEach((property) => {
             if (!isAllowed(property)) {
               report(property);


Test patch:
diff --git a/tests/lib/rules/avoid-leaking-state-in-ember-objects.js b/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
index cb3b5b87..8730cc1b 100644
--- a/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
+++ b/tests/lib/rules/avoid-leaking-state-in-ember-objects.js
@@ -27,7 +27,7 @@ describe('imports', () => {
 
 const eslintTester = new RuleTester({
   parserOptions: {
-    ecmaVersion: 6,
+    ecmaVersion: 2018,
     sourceType: 'module'
   }
 });
@@ -120,6 +120,9 @@ eslintTester.run('avoid-leaking-state-in-ember-objects', rule, {
     {
       code: 'export default Foo.extend({ foo: !true });'
     },
+    {
+      code: 'export default Foo.extend({ ...props });'
+    },
   ],
   invalid: [
     {
Repository: ember-cli/eslint-plugin-ember
Pull request #362 (2018-12-24 05:24:50)

assert-arg-order: Fix rule for `Ember.assert()` case
Detect incorrect usages of `Ember.assert()` (in addition to just `assert()`) for rule `assert-arg-order`.

Turbo87: @bmish can you explain what this PR does in the PR description?
bmish: @Turbo87 @rwjblue thanks for the review! I would definitely like to follow-up separately to try to detect that `assert()` is actually coming from:
```
import { assert } from '@ember/debug';
```
or 
```
import Ember from 'ember';
const { assert } = Ember;
```
In the meantime, I simplified the logic in this PR by switching to `emberUtils.isModule()`, and it's ready to go still.

Patch:
diff --git a/lib/rules/assert-arg-order.js b/lib/rules/assert-arg-order.js
index 1f8d2c1f..6ce5f020 100644
--- a/lib/rules/assert-arg-order.js
+++ b/lib/rules/assert-arg-order.js
@@ -1,6 +1,7 @@
 'use strict';
 
 const utils = require('../utils/utils');
+const emberUtils = require('../utils/ember');
 
 //------------------------------------------------------------------------------
 // Rule Definition
@@ -43,8 +44,8 @@ function isAssertFunctionWithReversedArgs(node) {
 }
 
 function isAssertFunction(node) {
-  const callee = node.callee;
-  return utils.isCallExpression(node) && utils.isIdentifier(callee) && callee.name === 'assert';
+  // Detect `Ember.assert()` or `assert()`.
+  return emberUtils.isModule(node, 'assert');
 }
 
 function isString(node) {


Test patch:
diff --git a/tests/lib/rules/assert-arg-order.js b/tests/lib/rules/assert-arg-order.js
index 1526f843..f46c89c4 100644
--- a/tests/lib/rules/assert-arg-order.js
+++ b/tests/lib/rules/assert-arg-order.js
@@ -22,12 +22,24 @@ ruleTester.run('assert-arg-order', rule, {
     {
       code: "myFunction(true, 'My string.');"
     },
+    {
+      code: "Ember.myFunction(true, 'My string.');"
+    },
+    {
+      code: "OtherClass.assert(true, 'My string.');"
+    },
     {
       code: "assert('My description.');"
     },
+    {
+      code: "Ember.assert('My description.');"
+    },
     {
       code: "assert('My description.', true);"
     },
+    {
+      code: "Ember.assert('My description.', true);"
+    },
     {
       code: "const CONDITION = true; assert('My description.', CONDITION);"
     },
@@ -43,6 +55,10 @@ ruleTester.run('assert-arg-order', rule, {
       code: "assert(true, 'My description.');",
       errors: [{ message: ERROR_MESSAGE, type: 'CallExpression' }]
     },
+    {
+      code: "Ember.assert(true, 'My description.');",
+      errors: [{ message: ERROR_MESSAGE, type: 'CallExpression' }]
+    },
     {
       code: 'assert(true, `My ${123} description.`);', // eslint-disable-line no-template-curly-in-string
       errors: [{ message: ERROR_MESSAGE, type: 'CallExpression' }]
Repository: ember-cli/eslint-plugin-ember
Pull request #366 (2018-12-30 01:00:33)

no-invalid-debug-function-arguments: Fix false positives
Update rule to ignore unrelated function calls underneath one of the debug functions.

For example, we want to ignore calls that look like:
* `assert.ok(...)`
* `assert.equal(...)`

We only care about calls that look like: 
* `assert(...)`
* `Ember.assert(...)`


Patch:
diff --git a/lib/rules/no-invalid-debug-function-arguments.js b/lib/rules/no-invalid-debug-function-arguments.js
index c0700311..5cfd21bc 100644
--- a/lib/rules/no-invalid-debug-function-arguments.js
+++ b/lib/rules/no-invalid-debug-function-arguments.js
@@ -54,7 +54,10 @@ function isDebugFunction(node) {
 }
 
 function getDebugFunction(node) {
-  return DEBUG_FUNCTIONS.find(debugFunction => emberUtils.isModule(node, debugFunction));
+  return DEBUG_FUNCTIONS.find(debugFunction =>
+    emberUtils.isModule(node, debugFunction) &&
+      (!node.callee.property || node.callee.property.name === debugFunction)
+  );
 }
 
 function isString(node) {


Test patch:
diff --git a/tests/lib/rules/no-invalid-debug-function-arguments.js b/tests/lib/rules/no-invalid-debug-function-arguments.js
index df3f0dc5..05339433 100644
--- a/tests/lib/rules/no-invalid-debug-function-arguments.js
+++ b/tests/lib/rules/no-invalid-debug-function-arguments.js
@@ -56,6 +56,12 @@ const VALID_USAGES_FOR_EACH_DEBUG_FUNCTION = flatten(DEBUG_FUNCTIONS.map(debugFu
   },
   {
     code: `const DESCRIPTION = 'description'; const CONDITION = true; ${debugFunction}(DESCRIPTION, CONDITION);`
+  },
+  {
+    code: `${debugFunction}.unrelatedFunction(true, 'My description.');`
+  },
+  {
+    code: `Ember.${debugFunction}.unrelatedFunction(true, 'My description.');`
   }
 ]));
Repository: ember-cli/eslint-plugin-ember
Pull request #398 (2019-03-23 18:42:05)

no-unnecessary-route-path-option: fix error when `path` is `undefined`
This error could show up when typing a new route definition as the `path` would momentarily be `undefined`.

```
TypeError: Cannot read property 'substring' of undefined
```


Patch:
diff --git a/lib/rules/no-unnecessary-route-path-option.js b/lib/rules/no-unnecessary-route-path-option.js
index 54537cc3..3ebf6865 100644
--- a/lib/rules/no-unnecessary-route-path-option.js
+++ b/lib/rules/no-unnecessary-route-path-option.js
@@ -65,6 +65,10 @@ function getPropertyByKeyName(objectExpression, keyName) {
 }
 
 function pathMatchesRouteName(path, routeName) {
+  if (!path || !routeName) {
+    return false;
+  }
+
   const pathWithoutOptionalLeadingSlash = path.substring(0, 1) === '/' ? path.substring(1) : path;
   return pathWithoutOptionalLeadingSlash === routeName;
 }


Test patch:
diff --git a/tests/lib/rules/no-unnecessary-route-path-option.js b/tests/lib/rules/no-unnecessary-route-path-option.js
index b6c498bb..1e3e57d3 100644
--- a/tests/lib/rules/no-unnecessary-route-path-option.js
+++ b/tests/lib/rules/no-unnecessary-route-path-option.js
@@ -16,6 +16,7 @@ ruleTester.run('no-unnecessary-route-path-option', rule, {
   valid: [
     'this.route("blog");',
     'this.route("blog", function() {});',
+    'this.route("blog", { path: undefined });',
     'this.route("blog", { path: "" });',
     'this.route("blog", { path: "/" });',
     'this.route("blog", { path: "blog-posts" });',
Repository: ember-cli/eslint-plugin-ember
Pull request #460 (2019-08-08 20:28:39)

Add null check in `new-module-imports` rule
This would fix https://github.com/ember-cli/eslint-plugin-ember/issues/459


Patch:
diff --git a/lib/utils/new-module.js b/lib/utils/new-module.js
index 9dca2bc3..16e8f074 100644
--- a/lib/utils/new-module.js
+++ b/lib/utils/new-module.js
@@ -156,6 +156,11 @@ function getFullNames(prefix, node) {
 function isInitImportedFrom(node, module) {
   const { name } = node.init;
   const pp = node.parent.parent;
+
+  if (!pp || !pp.body) {
+    return false;
+  }
+
   return pp.body.some(n => {
     function containsInitSpecifier(specifiers) {
       return specifiers.some(s => {


Test patch:
diff --git a/tests/lib/rules/new-module-imports.js b/tests/lib/rules/new-module-imports.js
index b2d849c7..2ef09b36 100644
--- a/tests/lib/rules/new-module-imports.js
+++ b/tests/lib/rules/new-module-imports.js
@@ -49,6 +49,10 @@ eslintTester.run('new-module-imports', rule, {
       `,
       parserOptions: { ecmaVersion: 6, sourceType: 'module' },
     },
+    {
+      code: `export const Ember = 1;`,
+      parserOptions: { ecmaVersion: 6, sourceType: 'module' },
+    },
   ],
   invalid: [
     {
Repository: ember-cli/eslint-plugin-ember
Pull request #461 (2019-08-08 23:05:09)

Add null check in `new-module-imports` rule (again)
Fixes this test case:

```
new-module-imports › valid › for (let i = 0; i < 10; i++) { }

    TypeError: pp.body.some is not a function
    Occurred while linting <input>:1

      162 |   }
      163 |
    > 164 |   return pp.body.some(n => {
          |                  ^
      165 |     function containsInitSpecifier(specifiers) {
      166 |       return specifiers.some(s => {
      167 |         return s.local.name === name;

      at some (lib/utils/new-module.js:164:18)
      at isInitImportedFrom (lib/rules/new-module-imports.js:59:44)
```

Same issue as in #459. Caused by #450.

@dcyriller the null check does not seem like a great fix, even though it solves the immediate problem. Can you please investigate if there is a better fix for this?


Patch:
diff --git a/lib/utils/new-module.js b/lib/utils/new-module.js
index 16e8f074..5d2a73b1 100644
--- a/lib/utils/new-module.js
+++ b/lib/utils/new-module.js
@@ -157,7 +157,7 @@ function isInitImportedFrom(node, module) {
   const { name } = node.init;
   const pp = node.parent.parent;
 
-  if (!pp || !pp.body) {
+  if (!pp || !pp.body || !pp.body.some) {
     return false;
   }
 


Test patch:
diff --git a/tests/lib/rules/new-module-imports.js b/tests/lib/rules/new-module-imports.js
index 2ef09b36..391fa5a0 100644
--- a/tests/lib/rules/new-module-imports.js
+++ b/tests/lib/rules/new-module-imports.js
@@ -53,6 +53,10 @@ eslintTester.run('new-module-imports', rule, {
       code: `export const Ember = 1;`,
       parserOptions: { ecmaVersion: 6, sourceType: 'module' },
     },
+    {
+      code: `for (let i = 0; i < 10; i++) { }`,
+      parserOptions: { ecmaVersion: 6, sourceType: 'module' },
+    },
   ],
   invalid: [
     {
Repository: ember-cli/eslint-plugin-ember
Pull request #463 (2019-08-09 18:14:33)

Fix false positives for import statements with `use-ember-data-rfc-395-imports` rule
After enabling the `use-ember-data-rfc-395-imports` rule, I found that I was getting errors for imports from `ember-data-model-fragments` and `ember-data-factory-guy`.

Here's my attempt to fix it!


Patch:
diff --git a/lib/rules/use-ember-data-rfc-395-imports.js b/lib/rules/use-ember-data-rfc-395-imports.js
index 392a918e..fc52a2d0 100644
--- a/lib/rules/use-ember-data-rfc-395-imports.js
+++ b/lib/rules/use-ember-data-rfc-395-imports.js
@@ -99,7 +99,7 @@ module.exports = {
           return;
         }
 
-        if (node.source.value.startsWith('ember-data')) {
+        if (node.source.value === 'ember-data' || node.source.value.startsWith('ember-data/')) {
           context.report(node, message);
         }
       },


Test patch:
diff --git a/tests/lib/rules/use-ember-data-rfc-395-imports.js b/tests/lib/rules/use-ember-data-rfc-395-imports.js
index 8558c465..189983e2 100644
--- a/tests/lib/rules/use-ember-data-rfc-395-imports.js
+++ b/tests/lib/rules/use-ember-data-rfc-395-imports.js
@@ -25,6 +25,7 @@ ruleTester.run('use-ember-data-rfc-395-imports', rule, {
      });
     `,
     `import LOL from 'who-knows-but-definitely-not-ember-data';
+     import Fragment from 'ember-data-model-fragments/fragment';
 
      const { Model } = LOL;
     `,
Repository: ember-cli/eslint-plugin-ember
Pull request #584 (2019-11-10 20:10:20)

Fix some asserts and add tests for them


Patch:
diff --git a/lib/utils/ember.js b/lib/utils/ember.js
index 5667302f..13e5504c 100644
--- a/lib/utils/ember.js
+++ b/lib/utils/ember.js
@@ -182,6 +182,7 @@ function isEmberCoreModule(context, node, moduleName) {
     }
   } else {
     assert(
+      false,
       'Function should only be called on a `CallExpression` (classic class) or `ClassDeclaration` (native class)'
     );
   }
@@ -522,6 +523,7 @@ function isEmberObjectImplementingUnknownProperty(node) {
     );
   } else {
     assert(
+      false,
       'Function should only be called on a `CallExpression` (classic class) or `ClassDeclaration` (native class)'
     );
   }


Test patch:
diff --git a/tests/lib/utils/ember-test.js b/tests/lib/utils/ember-test.js
index 497af93c..b3998e13 100644
--- a/tests/lib/utils/ember-test.js
+++ b/tests/lib/utils/ember-test.js
@@ -151,6 +151,14 @@ describe('isEmberCoreModule', () => {
     const node = context.ast.body[0].expression;
     expect(emberUtils.isEmberCoreModule(context, node, 'Route')).toBeTruthy();
   });
+
+  it('throws when called on wrong type of node', () => {
+    const context = new FauxContext('const x = 123;');
+    const node = context.ast.body[0];
+    expect(() => emberUtils.isEmberCoreModule(context, node, 'Route')).toThrow(
+      'Function should only be called on a `CallExpression` (classic class) or `ClassDeclaration` (native class)'
+    );
+  });
 });
 
 describe('isEmberComponent', () => {
@@ -553,8 +561,8 @@ describe('isEmberProxy', () => {
   });
 
   it('should not detect random code', () => {
-    const context = new FauxContext('const x = 123;');
-    const node = context.ast.body[1];
+    const context = new FauxContext('someFunctionCall();');
+    const node = context.ast.body[0].expression;
     expect(emberUtils.isEmberProxy(context, node)).toBeFalsy();
   });
 });
@@ -1159,4 +1167,11 @@ describe('isEmberObjectImplementingUnknownProperty', () => {
       .body[0];
     expect(emberUtils.isEmberObjectImplementingUnknownProperty(node)).toBeFalsy();
   });
+
+  it('throws when called on wrong type of node', () => {
+    const node = babelEslint.parse('const x = 123;').body[0];
+    expect(() => emberUtils.isEmberObjectImplementingUnknownProperty(node)).toThrow(
+      'Function should only be called on a `CallExpression` (classic class) or `ClassDeclaration` (native class)'
+    );
+  });
 });