summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/prefer-formatValues.rst
blob: 88eedee792bbb2506e62345e66e588c5781ff295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
prefer-formatValues
===================

Rejects multiple calls to document.l10n.formatValue in the same code block, to
reduce localization overheads.

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

.. code-block:: js

    {
      document.l10n.formatValue('foobar');
      document.l10n.formatValue('foobaz');
    }

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

.. code-block:: js

    document.l10n.formatValue('foobar');
    document.l10n.formatValues(['foobar', 'foobaz']);