summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/valid-services-property.rst
blob: c6c61abac275f0873d89b3621d8686b6d45319f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
valid-services-property
=======================

Ensures that accesses of properties of items accessed via the ``Services``
object are valid.

This rule requires a full build to run, and is not turned on by default. To run
this rule manually, use:

.. code-block:: console

    MOZ_OBJDIR=objdir-ff-opt ./mach eslint --rule="mozilla/valid-services-property: error" *

Examples of incorrect code for this rule:
-----------------------------------------

Assuming ``foo`` is not defined within ``Ci.nsISearchService``.

.. code-block:: js

    Services.search.foo();

Examples of correct code for this rule:
---------------------------------------

Assuming ``bar`` is defined within ``Ci.nsISearchService``.

.. code-block:: js

    Services.search.bar();