Enforce usage of Array.isArray
wincent opened this issue · 1 comments
wincent commented
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 commented
Related Commerce PR: https://github.com/FabioDiegoMastrorilli/liferay-portal-ee/pull/8