Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Enforce usage of Array.isArray #139

Closed
wincent opened this issue Feb 4, 2020 · 1 comment · Fixed by #144
Closed

Enforce usage of Array.isArray #139

wincent opened this issue Feb 4, 2020 · 1 comment · Fixed by #144

Comments

@wincent
Copy link
Contributor

wincent commented Feb 4, 2020

We want people to do Array.isArray(x) instead of x instanceof Array because:

  • It's shorter.
  • instanceof Array is, perhaps surprisingly, unreliable.

Found a few of these during code review of the Commerce project, so we may as well automate this. Array.isArray enjoys broad browser support, and we should be able to autofix this.

There is no built-in ESLint rule for this, but it should be easy to implement.

@wincent wincent added the feature label Feb 4, 2020
@wincent
Copy link
Contributor Author

wincent commented Feb 4, 2020

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant