Skip to content

Commit

Permalink
fix: more false positives with RSVP.Promise.reject() in no-array-prot…
Browse files Browse the repository at this point in the history
…otype-extensions
  • Loading branch information
bmish committed Jul 29, 2022
1 parent fd83412 commit 1a8806c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rules/no-array-prototype-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions tests/lib/rules/no-array-prototype-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down

0 comments on commit 1a8806c

Please sign in to comment.