Bug 1440379 - Tidy up ESlint no-unused-vars definitions wrt Ci/Cu/Cr/Cc usage for varsIgnorePattern. r=florian

MozReview-Commit-ID: HmliR8iNRDq

--HG--
extra : rebase_source : 483ae0b54b9e781cceac2accdfb2255d725ace6a
This commit is contained in:
Mark Banner 2018-02-22 16:55:36 +00:00
parent 6e7897e220
commit 6afe18b30a
21 changed files with 34 additions and 38 deletions

View File

@ -62,7 +62,7 @@ module.exports = {
"no-unused-vars": ["error", {
"args": "none",
"vars": "local",
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS"
"varsIgnorePattern": "^EXPORTED_SYMBOLS$"
}]
}
}, {

View File

@ -203,7 +203,7 @@ async function getAllTheFiles(extension) {
}
let urisGreD = await generateURIsFromDirTree(appDirGreD, [extension]);
let urisXCurProcD = await generateURIsFromDirTree(appDirXCurProcD, [extension]);
return Array.from(new Set(urisGreD.concat(appDirXCurProcD)));
return Array.from(new Set(urisGreD.concat(urisXCurProcD)));
}
add_task(async function checkAllTheProperties() {

View File

@ -15,7 +15,7 @@ module.exports = {
"no-sequences": "error",
"no-shadow": "error",
"no-throw-literal": "error",
"no-unused-vars": ["error", { "varsIgnorePattern": "^EXPORTED_SYMBOLS$" }],
"no-unused-vars": ["error", { "args": "after-used", "varsIgnorePattern": "^EXPORTED_SYMBOLS$", "vars": "all" }],
"padded-blocks": ["error", "never"],
"semi-spacing": ["error", {"before": false, "after": true}],
"space-in-parens": ["error", "never"],

View File

@ -3,9 +3,9 @@
module.exports = {
"rules": {
"no-unused-vars": ["error", {
"args": "none",
"vars": "all",
"varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
"args": "none"
"varsIgnorePattern": "^EXPORTED_SYMBOLS$",
}]
}
};

View File

@ -44,7 +44,9 @@ module.exports = {
"no-unused-expressions": "error",
// No declaring variables that are never used
"no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
"no-unused-vars": ["error", {
"args": "none", "vars": "all", "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
}],
// No using variables before defined
"no-use-before-define": "error",

View File

@ -7,9 +7,9 @@ module.exports = {
"rules": {
"no-unused-vars": ["error", {
"args": "none",
"vars": "all",
"varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
"args": "none"
"varsIgnorePattern": "^EXPORTED_SYMBOLS$",
}]
}
};

View File

@ -215,7 +215,7 @@ module.exports = {
"no-undefined": "off",
// Disallow global and local variables that aren't used, but allow unused
// function arguments.
"no-unused-vars": ["error", {"vars": "all", "args": "none"}],
"no-unused-vars": ["error", {"args": "none", "vars": "all"}],
// Allow using variables before they are defined.
"no-use-before-define": "off",
// We use var-only-at-top-level instead of no-var as we allow top level

View File

@ -4,8 +4,6 @@
*/
function run_test() {
const { "classes": Cc, "interfaces": Ci, "utils": Cu } = Components;
ChromeUtils.import("resource://gre/modules/Services.jsm");
const INDEXEDDB_HEAD_FILE = "xpcshell-head-parent-process.js";

View File

@ -12,12 +12,10 @@
*/
var EXPORTED_SYMBOLS = ["EnsureFxAccountsWebChannel"];
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; /* global Components */
ChromeUtils.import("resource://gre/modules/Accounts.jsm"); /* global Accounts */
ChromeUtils.import("resource://gre/modules/Services.jsm"); /* global Services */
ChromeUtils.import("resource://gre/modules/WebChannel.jsm"); /* global WebChannel */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
ChromeUtils.import("resource://gre/modules/Accounts.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/WebChannel.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const log = ChromeUtils.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("FxAccounts");
@ -34,7 +32,7 @@ const COMMAND_SYNC_PREFERENCES = "fxaccounts:sync_preferences";
const PREF_LAST_FXA_USER = "identity.fxaccounts.lastSignedInUserHash";
XPCOMUtils.defineLazyGetter(this, "strings",
() => Services.strings.createBundle("chrome://browser/locale/aboutAccounts.properties")); /* global strings */
() => Services.strings.createBundle("chrome://browser/locale/aboutAccounts.properties"));
ChromeUtils.defineModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
ChromeUtils.defineModuleGetter(this, "Prompt", "resource://gre/modules/Prompt.jsm");

View File

@ -8,7 +8,7 @@
*/
var EXPORTED_SYMBOLS = [
"ACTIONS", "Addons", "Addresses", "Bookmarks",
"ACTIONS", "Addons", "Addresses", "Bookmarks", "CreditCards",
"Formdata", "History", "Passwords", "Prefs",
"Tabs", "TPS", "Windows"
];

View File

@ -92,7 +92,9 @@ module.exports = {
"no-unused-expressions": "error",
// No declaring variables that are never used
"no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
"no-unused-vars": ["error", {
"args": "none", "vars": "all", "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
}],
// No using variables before defined
"no-use-before-define": "error",

View File

@ -1,12 +1,4 @@
"use strict";
const {
classes: Cc,
interfaces: Ci,
utils: Cu,
results: Cr,
} = Components;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");

View File

@ -27,7 +27,6 @@ module.exports = {
"no-sequences": "error",
"no-shadow": "error",
"no-throw-literal": "error",
"no-unused-vars": "error",
"padded-blocks": ["error", "never"],
"quotes": ["error", "double", "avoid-escape"],
"semi-spacing": ["error", {"before": false, "after": true}],

View File

@ -41,7 +41,8 @@ module.exports = {
"no-unused-expressions": "error",
"no-unused-vars": ["error", {
args: "none",
varsIgnorePattern: "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
vars: "all",
varsIgnorePattern: "^EXPORTED_SYMBOLS$",
}],
"no-use-before-define": ["error", {
functions: false,

View File

@ -42,7 +42,8 @@ module.exports = {
"no-unused-expressions": "error",
"no-unused-vars": ["error", {
args: "none",
varsIgnorePattern: "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
vars: "all",
varsIgnorePattern: "^EXPORTED_SYMBOLS$",
}],
"no-use-before-define": ["error", {
functions: false,

View File

@ -143,7 +143,6 @@ add_task(async function test_aggregation() {
const SCALAR_FULL_NAME = "telemetry.cheattest.dynamic.test_aggregation";
Services.telemetry.scalarAdd(SCALAR_FULL_NAME, 1);
let processCreated = TestUtils.topicObserved(CONTENT_CREATED);
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank", forceNewProcess: true },
async function(browser) {
// Accumulate from the content process into both dynamic scalars.

View File

@ -7,6 +7,10 @@ module.exports = {
// be removed & synced with the mozilla/recommended value.
"complexity": ["error", {"max": 68}],
"no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
"no-unused-vars": ["error", {
"args": "none",
"vars": "all",
"varsIgnorePattern": "^EXPORTED_SYMBOLS$"
}],
}
};

View File

@ -78,7 +78,7 @@ module.exports = {
"no-unused-vars": ["error", {
"args": "none",
"vars": "all",
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS"
"varsIgnorePattern": "^EXPORTED_SYMBOLS$"
}]
}
}],
@ -355,7 +355,7 @@ module.exports = {
"no-unused-vars": ["error", {
"args": "none",
"vars": "local",
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS"
"varsIgnorePattern": "^EXPORTED_SYMBOLS$"
}],
// No using variables before defined

View File

@ -1,6 +1,6 @@
{
"name": "eslint-plugin-mozilla",
"version": "0.9.0",
"version": "0.9.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "eslint-plugin-mozilla",
"version": "0.9.0",
"version": "0.9.1",
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
"keywords": [
"eslint",

View File

@ -205,7 +205,7 @@
"Timer.jsm": ["setTimeout", "setTimeoutWithTarget", "clearTimeout", "setInterval", "setIntervalWithTarget", "clearInterval"],
"tokenserverclient.js": ["TokenServerClient", "TokenServerClientError", "TokenServerClientNetworkError", "TokenServerClientServerError"],
"ToolboxProcess.jsm": ["BrowserToolboxProcess"],
"tps.jsm": ["ACTIONS", "TPS"],
"tps.jsm": ["ACTIONS", "Addons", "Addresses", "Bookmarks", "CreditCards", "Formdata", "History", "Passwords", "Prefs", "Tabs", "TPS", "Windows"],
"Translation.jsm": ["Translation", "TranslationTelemetry"],
"Traversal.jsm": ["TraversalRules", "TraversalHelper"],
"UpdateTelemetry.jsm": ["AUSTLMY"],