===================== Mozilla ESLint Plugin ===================== Environments ============ These environments are available by specifying a comment at the top of the file, e.g. /* eslint-env mozilla/chrome-worker */ There are also built-in ESLint environments available as well: http://eslint.org/docs/user-guide/configuring#specifying-environments browser-window -------------- Defines the environment for scripts that are in the main browser.xul scope ( note: includes the places-overlay environment). places-overlay -------------- Defines the environment for scripts that are in a scope where placesOverlay.xul is included. chrome-worker ------------- Defines the environment for chrome workers. This differs from normal workers by the fact that `ctypes` can be accessed as well. frame-script ------------ Defines the environment for frame scripts. Rules ===== avoid-Date-timing ----------------- Rejects grabbing the current time via Date.now() or new Date() for timing purposes when the less problematic performance.now() can be used instead. The performance.now() function returns milliseconds since page load. To convert that to milliseconds since the epoch, use: performance.timing.navigationStart + performance.now() Often timing relative to the page load is adequate and that conversion may not be necessary. avoid-removeChild ----------------- Rejects using element.parentNode.removeChild(element) when element.remove() can be used instead. balanced-listeners ------------------ Checks that for every occurence of 'addEventListener' or 'on' there is an occurence of 'removeEventListener' or 'off' with the same event name. import-browser-window-globals ----------------------------- For scripts included in browser-window, this will automatically inject the browser-window global scopes into the file. import-content-task-globals --------------------------- For files containing ContentTask.spawn calls, this will automatically declare the frame script variables in the global scope. ContentTask is only available to test files, so by default the configs only specify it for the mochitest based configurations. This saves setting the file as a mozilla/frame-script environment. Note: due to the way ESLint works, it appears it is only easy to declare these variables on a file global scope, rather than function global. This may mean that they are incorrectly allowed, but given they are test files, this should be detected during testing. import-globals -------------- Checks the filename of imported files e.g. ``Cu.import("some/path/Blah.jsm")`` adds Blah to the global scope. Note: uses modules.json for a list of globals listed in each file. import-globals-from ------------------- Parses a file for globals defined in various unique Mozilla ways. When a "import-globals-from " comment is found in a file, then all globals from the file at will be imported in the current scope. This will also operate recursively. This is useful for scripts that are loaded as