1
0
Fork 0
firefox/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/use-cc-etc.rst
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

26 lines
748 B
ReStructuredText

use-cc-etc
======================
This requires using ``Cc`` rather than ``Components.classes``, and the same for
``Components.interfaces``, ``Components.results`` and ``Components.utils``.
This has a slight performance advantage by avoiding the use of the dot.
Examples of incorrect code for this rule:
-----------------------------------------
.. code-block:: js
let foo = Components.classes['bar'];
let bar = Components.interfaces.bar;
Components.results.NS_ERROR_ILLEGAL_INPUT;
Components.utils.reportError('fake');
Examples of correct code for this rule:
---------------------------------------
.. code-block:: js
let foo = Cc['bar'];
let bar = Ci.bar;
Cr.NS_ERROR_ILLEGAL_INPUT;
Cu.reportError('fake');