From 1a8806c1e8a952d1dfde84eb158f5da6d9551ea3 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Fri, 29 Jul 2022 12:34:34 -0400 Subject: [PATCH] fix: more false positives with RSVP.Promise.reject() in no-array-prototype-extensions --- lib/rules/no-array-prototype-extensions.js | 3 +++ tests/lib/rules/no-array-prototype-extensions.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/lib/rules/no-array-prototype-extensions.js b/lib/rules/no-array-prototype-extensions.js index 98fb1c5f0b..8ca3b6c173 100644 --- a/lib/rules/no-array-prototype-extensions.js +++ b/lib/rules/no-array-prototype-extensions.js @@ -66,6 +66,9 @@ const KNOWN_NON_ARRAY_FUNCTION_CALLS = new Set([ // RSVP.reject 'RSVP.reject', + 'RSVP.Promise.reject', + 'Ember.RSVP.reject', + 'Ember.RSVP.Promise.reject', // *storage.clear() 'window.localStorage.clear', diff --git a/tests/lib/rules/no-array-prototype-extensions.js b/tests/lib/rules/no-array-prototype-extensions.js index c698028ff1..bb307d6aac 100644 --- a/tests/lib/rules/no-array-prototype-extensions.js +++ b/tests/lib/rules/no-array-prototype-extensions.js @@ -48,17 +48,23 @@ ruleTester.run('no-array-prototype-extensions', rule, { 'Promise.reject();', 'Promise.reject("some reason");', 'reject();', + 'this.reject();', // Global non-array class (RSVP.reject) 'RSVP.reject();', 'RSVP.reject("some reason");', + 'RSVP.Promise.reject();', + 'Ember.RSVP.reject();', + 'Ember.RSVP.Promise.reject();', // Global non-array class (*storage.clear) 'window.localStorage.clear();', 'window.sessionStorage.clear();', 'localStorage.clear();', 'sessionStorage.clear();', + 'sessionStorage?.clear();', 'clear();', + 'this.clear();', // Global non-array class (location.replace) 'window.document.location.replace(url)',