===================== Mozilla ESLint Plugin ===================== This is the documentation of Mozilla ESLint PLugin. Environments ============ The plugin implements the following environments: .. toctree:: :maxdepth: 2 eslint-plugin-mozilla/environment Rules ===== The plugin implements the following rules: .. toctree:: :maxdepth: 1 eslint-plugin-mozilla/avoid-Date-timing eslint-plugin-mozilla/no-define-cc-etc eslint-plugin-mozilla/no-throw-cr-literal eslint-plugin-mozilla/no-useless-parameters eslint-plugin-mozilla/reject-chromeutils-import-params eslint-plugin-mozilla/use-chromeutils-import avoid-removeChild ----------------- Rejects using element.parentNode.removeChild(element) when element.remove() can be used instead. balanced-listeners ------------------ Checks that for every occurrence of 'addEventListener' or 'on' there is an occurrence of 'removeEventListener' or 'off' with the same event name. consistent-if-bracing --------------------- Checks that if/elseif/else bodies are braced consistently, so either all bodies are braced or unbraced. Doesn't enforce either of those styles though. 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