testing/eslint/eslint-plugin-mozilla/docs/import-headjs-globals.rst
author Michael Ratcliffe <mratcliffe@mozilla.com>
Mon, 02 May 2016 00:22:31 +0100
changeset 297757 b4564c057f93c736521672ffa54b23d9b4c92b94
parent 281868 testing/eslint-plugin-mozilla/docs/import-headjs-globals.rst@59c5826c1280c0568705b04842e34815da52d6d2
permissions -rw-r--r--
Bug 1265082 - ESLint jobs are apparently hitting the network r=me,dustin,pbro,jryans So a few changes here: - node_modules is downloaded using tooltool so that we dont need to rely on external infrastructure. - We have a npm-shrinkwrap.json file that version locks all of our node packages. - eslint, eslint-plugin-mozilla etc. are now all installed locally. In reality this means that we don't hit the network and we don't force users into installing global packages. ./mach eslint --setup has also been improved. We install packages locally and display the path of the user's eslint binary (useful for configuring editors). eslint-plugin-mozilla has been moved from testing/eslint-plugin-mozilla to /testing/eslint/eslint-plugin-mozilla. The node_modules directory for eslint and other plugins is located in testing/eslint/. MozReview-Commit-ID: 4SFSxzka6BS

.. _import-headjs-globals:

=====================
import-headjs-globals
=====================

Rule Details
------------

Import globals from head.js and from any files that were imported by
head.js (as far as we can correctly resolve the path).

The following file import patterns are supported:

-  ``Services.scriptloader.loadSubScript(path)``
-  ``loader.loadSubScript(path)``
-  ``loadSubScript(path)``
-  ``loadHelperScript(path)``
-  ``import-globals-from path``

If path does not exist because it is generated e.g.
``testdir + "/somefile.js"`` we do our best to resolve it.

The following patterns are supported:

-  ``Cu.import("resource://devtools/client/shared/widgets/ViewHelpers.jsm");``
-  ``loader.lazyImporter(this, "name1");``
-  ``loader.lazyRequireGetter(this, "name2"``
-  ``loader.lazyServiceGetter(this, "name3"``
-  ``XPCOMUtils.defineLazyModuleGetter(this, "setNamedTimeout", ...)``
-  ``loader.lazyGetter(this, "toolboxStrings"``
-  ``XPCOMUtils.defineLazyGetter(this, "clipboardHelper"``