Hi people,
If you are currently writing/maintaining chrome-privileged scripts then this post is for you. If not you can ignore this.
The mozilla/use-Instance ESLint rule will soon be improved to strictly reject any use of `instanceof` call against DOM interface within chrome scripts. This is because we traditionally used [Symbol.hasInstance] to allow cross-context instanceof and we want to unship it to make it standard-compliant. Unfortunately it is nontrivial to pick and replace the faulty instanceof uses, so we decided to replace all the uses with the equivalent chrome-only isInstance() function.
Non-privileged scripts e.g. mochitest files and general websites will not be affected.
Rejected: foo instanceof Node
Preferred: Node.isInstance(foo)
You can opt-out if you strictly need the context-strict standard instanceof with the following comment:
// eslint-disable-next-line mozilla/use-isInstance
foo instanceof Node
* the 2021 intent-to-unship:
https://groups.google.com/g/mozilla.dev.platform/c/PSEPdL0MbvM/m/9Y_fOnt5AAAJ