no-more-globals.rst (933B)
1 no-more-globals 2 =============== 3 4 This rule is used to discourage people from adding ever more global variables to 5 files where the rule is run. 6 7 For any file ``example.js`` where the rule is applied, the rule will read 8 an allowlist of globals from a sibling ``example.js.globals`` file. The rule 9 will warn for any globals defined in ``example.js`` that are not listed in the 10 ``globals`` file, and will also warn for any items on the allowlist in 11 the ``globals`` file that are no longer present in ``example.js``, encouraging 12 people to remove them from the ``globals`` list. 13 14 If you see errors from this rule about new globals, **do not just add items to 15 the allowlist**. Instead, work to find a way to run your code so that it does 16 not add to the list of globals. 17 18 If you see errors when removing globals, simply remove them from the allowlist 19 to make sure it is up-to-date and things do not inadvertently end up getting 20 put back in.