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

See also:
* The relevant bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1695435
* docs for use-isInstance rule: 
https://firefox-source-docs.mozilla.org/code-quality/lint/linters/eslint-plugin-mozilla/use-isInstance.html
* the 2021 intent-to-unship: 
https://groups.google.com/g/mozilla.dev.platform/c/PSEPdL0MbvM/m/9Y_fOnt5AAAJ

-- 
You received this message because you are subscribed to the Google Groups 
"dev-platform@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dev-platform+unsubscr...@mozilla.org.
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/f9b63ce8-d0bf-4f35-bd1d-d09b09fe6ab4n%40mozilla.org.

Reply via email to