liferay/eslint-config-liferay

Enforce usage of Array.isArray

wincent opened this issue · 1 comments

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.