Bug 1350298 - Enable ESLint of nsContextMenu.js, fixing the last issues. Also enable it for finding globals for the browser-window environment. r?jaws
MozReview-Commit-ID: Cl8AFvzR6o8
--- a/.eslintignore
+++ b/.eslintignore
@@ -50,17 +50,16 @@ xulrunner/**
# b2g exclusions (pref files).
b2g/app/b2g.js
b2g/graphene/graphene.js
b2g/locales/en-US/b2g-l10n.js
# browser/ exclusions
browser/app/**
browser/branding/**/firefox-branding.js
-browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.js
browser/base/content/test/general/file_csp_block_all_mixedcontent.html
browser/base/content/test/urlbar/file_blank_but_not_blank.html
browser/base/content/newtab/**
browser/components/downloads/**
# Test files that are really json not js, and don't need to be linted.
browser/components/sessionstore/test/unit/data/sessionstore_valid.js
browser/components/sessionstore/test/unit/data/sessionstore_invalid.js
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -291,16 +291,18 @@ module.exports = {
},
"globals": {
"BroadcastChannel": false,
// Specific to Firefox (Chrome code only).
"ChromeWindow": false,
"ChromeWorker": false,
"ChromeUtils": false,
"Components": false,
+ "CSSPrimitiveValue": false,
+ "CSSValueList": false,
"dump": true,
// Specific to Firefox
// eslint-disable-next-line max-len
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/InternalError
"InternalError": true,
"KeyEvent": false,
"openDialog": false,
"MenuBoxObject": false,
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
@@ -18,17 +18,17 @@ var path = require("path");
var helpers = require("../helpers");
var globals = require("../globals");
const rootDir = helpers.getRootDir(module.filename);
// These are scripts not included in global-scripts.inc, but which are loaded
// via overlays.
const EXTRA_SCRIPTS = [
- //"browser/base/content/nsContextMenu.js",
+ "browser/base/content/nsContextMenu.js",
"toolkit/content/contentAreaUtils.js",
"browser/components/places/content/editBookmarkOverlay.js",
"browser/components/downloads/content/downloads.js",
"browser/components/downloads/content/indicator.js",
// This gets loaded into the same scopes as browser.js via browser.xul and
// placesOverlay.xul.
"toolkit/content/globalOverlay.js",
// Via editMenuOverlay.xul
@@ -111,10 +111,11 @@ function mapGlobals(fileGlobals) {
var globalObjects = {};
for (let global of fileGlobals) {
globalObjects[global.name] = global.writable;
}
return globalObjects;
}
module.exports = {
- globals: mapGlobals(getScriptGlobals())
+ globals: mapGlobals(getScriptGlobals()),
+ browserjsScripts: getGlobalScriptsIncludes().concat(EXTRA_SCRIPTS)
};
--- a/tools/lint/eslint/eslint-plugin-mozilla/package.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json
@@ -1,11 +1,11 @@
{
"name": "eslint-plugin-mozilla",
- "version": "0.2.33",
+ "version": "0.2.34",
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
"keywords": [
"eslint",
"eslintplugin",
"eslint-plugin",
"mozilla",
"firefox"
],