Bug 1577835 - Reformat the .eslintrc.js files with Prettier. r=mkmelin
authorPaul Morris <paul@thunderbird.net>
Sat, 31 Aug 2019 08:56:13 -0400
changeset 36584 8177b85d18db77c4787461cd6db9575ef9935aea
parent 36583 dfc10500bb00606a7ffb6dfc2a7df3f69523ec82
child 36585 b5ec222212844a228f2872b494596f4c8f441a31
push id394
push userclokep@gmail.com
push dateMon, 21 Oct 2019 20:22:01 +0000
reviewersmkmelin
bugs1577835
Bug 1577835 - Reformat the .eslintrc.js files with Prettier. r=mkmelin # ignore-this-changeset These changes were achieved by deleting the .eslintrc.js line from the .prettierignore file and running: |mach eslint --fix|
.eslintrc.js
.prettierignore
chat/protocols/xmpp/.eslintrc.js
mail/components/cloudfile/test/browser/.eslintrc.js
mail/components/enterprisepolicies/tests/browser/.eslintrc.js
mail/components/extensions/child/.eslintrc.js
mail/components/extensions/parent/.eslintrc.js
mail/components/extensions/test/browser/.eslintrc.js
mail/components/extensions/test/xpcshell/.eslintrc.js
mail/components/im/content/.eslintrc.js
mailnews/db/gloda/test/unit/.eslintrc.js
mailnews/extensions/newsblog/.eslintrc.js
mailnews/mime/jsmime/test/.eslintrc.js
mailnews/test/resources/.eslintrc.js
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -3,97 +3,102 @@
 const xpcshellTestConfig = require("eslint-plugin-mozilla/lib/configs/xpcshell-test.js");
 const browserTestConfig = require("eslint-plugin-mozilla/lib/configs/browser-test.js");
 
 /**
  * Some configurations have overrides, which can't be specified within overrides,
  * so we need to remove them.
  */
 function removeOverrides(config) {
-  config = {...config};
+  config = { ...config };
   delete config.overrides;
   return config;
 }
 
 const xpcshellTestPaths = [
   "**/test*/unit*/",
   "**/test*/xpcshell/",
   "chat/**/test*/",
 ];
 
-const browserTestPaths = [
-  "**/test*/**/browser/",
-];
+const browserTestPaths = ["**/test*/**/browser/"];
 
 module.exports = {
-  "root": true,
+  root: true,
 
   // We would like the same base rules as provided by
   // mozilla/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
-  "extends": [
-    "plugin:mozilla/recommended",
-  ],
+  extends: ["plugin:mozilla/recommended"],
 
   // When adding items to this file please check for effects on sub-directories.
-  "plugins": [
-    "html",
-    "mozilla",
-  ],
+  plugins: ["html", "mozilla"],
 
-  "rules": {
+  rules: {
     "func-names": ["error", "never"],
-    "no-multi-spaces": ["error", {
-      exceptions: {
-        "ArrayExpression": true,
-        "AssignmentExpression": true,
-        "ObjectExpression": true,
-        "VariableDeclarator": true,
+    "no-multi-spaces": [
+      "error",
+      {
+        exceptions: {
+          ArrayExpression: true,
+          AssignmentExpression: true,
+          ObjectExpression: true,
+          VariableDeclarator: true,
+        },
+        ignoreEOLComments: true,
       },
-      ignoreEOLComments: true,
-    }],
-    "semi-spacing": ["error", {"before": false, "after": true}],
+    ],
+    "semi-spacing": ["error", { before: false, after: true }],
     "space-in-parens": ["error", "never"],
-    "curly": ["error", "all"],
+    curly: ["error", "all"],
   },
 
   // To avoid bad interactions of the html plugin with the xml preprocessor in
   // eslint-plugin-mozilla, we turn off processing of the html plugin for .xml
   // files.
-  "settings": {
-    "html/xml-extensions": [ ".xhtml" ],
+  settings: {
+    "html/xml-extensions": [".xhtml"],
   },
 
-  "overrides": [{
-    // eslint-plugin-html handles eol-last slightly different - it applies to
-    // each set of script tags, so we turn it off here.
-    "files": "**/*.*html",
-    "rules": {
-      "eol-last": "off",
+  overrides: [
+    {
+      // eslint-plugin-html handles eol-last slightly different - it applies to
+      // each set of script tags, so we turn it off here.
+      files: "**/*.*html",
+      rules: {
+        "eol-last": "off",
+      },
     },
-  }, {
-    "files": "**/.eslintrc.js",
-    "env": {
-      "node": true,
+    {
+      files: "**/.eslintrc.js",
+      env: {
+        node: true,
+      },
+    },
+    {
+      ...removeOverrides(xpcshellTestConfig),
+      files: xpcshellTestPaths.map(path => `${path}**`),
+      rules: {
+        "func-names": "off",
+        "mozilla/import-headjs-globals": "error",
+      },
     },
-  }, {
-    ...removeOverrides(xpcshellTestConfig),
-    "files": xpcshellTestPaths.map(path => `${path}**`),
-    "rules": {
-      "func-names": "off",
-      "mozilla/import-headjs-globals": "error",
+    {
+      // If it is an xpcshell head file, we turn off global unused variable checks, as it
+      // would require searching the other test files to know if they are used or not.
+      // This would be expensive and slow, and it isn't worth it for head files.
+      // We could get developers to declare as exported, but that doesn't seem worth it.
+      files: xpcshellTestPaths.map(path => `${path}head*.js`),
+      rules: {
+        "no-unused-vars": [
+          "error",
+          {
+            args: "none",
+            vars: "local",
+          },
+        ],
+      },
     },
-  }, {
-    // If it is an xpcshell head file, we turn off global unused variable checks, as it
-    // would require searching the other test files to know if they are used or not.
-    // This would be expensive and slow, and it isn't worth it for head files.
-    // We could get developers to declare as exported, but that doesn't seem worth it.
-    "files": xpcshellTestPaths.map(path => `${path}head*.js`),
-    "rules": {
-      "no-unused-vars": ["error", {
-        "args": "none",
-        "vars": "local",
-      }],
+    {
+      ...browserTestConfig,
+      files: browserTestPaths.map(path => `${path}**`),
     },
-  }, {
-    ...browserTestConfig,
-    "files": browserTestPaths.map(path => `${path}**`),
-  }],
+  ],
 };
--- a/.prettierignore
+++ b/.prettierignore
@@ -2,13 +2,10 @@
 
 # These files are disabled due to parsing errors when using Prettier.
 # Bug 1560186
 *.html
 *.xhtml
 *.xul
 *.xml
 
-# Ignore .eslintrc.js for now.
-.eslintrc.js
-
 # Ignore SeaMonkey files.
 suite/**
--- a/chat/protocols/xmpp/.eslintrc.js
+++ b/chat/protocols/xmpp/.eslintrc.js
@@ -1,8 +1,8 @@
 "use strict";
 
 module.exports = {
-  "rules": {
+  rules: {
     // The following rules will not be enabled currently.
-    "complexity": "off",
+    complexity: "off",
   },
 };
--- a/mail/components/cloudfile/test/browser/.eslintrc.js
+++ b/mail/components/cloudfile/test/browser/.eslintrc.js
@@ -1,10 +1,10 @@
 "use strict";
 
 module.exports = {
-  "extends": "plugin:mozilla/browser-test",
+  extends: "plugin:mozilla/browser-test",
 
-  "rules": {
+  rules: {
     "func-names": "off",
     "mozilla/import-headjs-globals": "error",
   },
 };
--- a/mail/components/enterprisepolicies/tests/browser/.eslintrc.js
+++ b/mail/components/enterprisepolicies/tests/browser/.eslintrc.js
@@ -1,10 +1,10 @@
 "use strict";
 
 module.exports = {
-  "extends": "plugin:mozilla/browser-test",
+  extends: "plugin:mozilla/browser-test",
 
-  "rules": {
+  rules: {
     "func-names": "off",
     "mozilla/import-headjs-globals": "error",
   },
 };
--- a/mail/components/extensions/child/.eslintrc.js
+++ b/mail/components/extensions/child/.eslintrc.js
@@ -1,15 +1,15 @@
 "use strict";
 
 module.exports = {
-  "globals": {
+  globals: {
     // These are defined in the WebExtension script scopes by ExtensionCommon.jsm.
     // From toolkit/components/extensions/.eslintrc.js.
-    "ExtensionAPI": true,
-    "ExtensionCommon": true,
-    "extensions": true,
-    "ExtensionUtils": true,
+    ExtensionAPI: true,
+    ExtensionCommon: true,
+    extensions: true,
+    ExtensionUtils: true,
 
     // From toolkit/components/extensions/child/.eslintrc.js.
-    "EventManager": true,
+    EventManager: true,
   },
 };
--- a/mail/components/extensions/parent/.eslintrc.js
+++ b/mail/components/extensions/parent/.eslintrc.js
@@ -1,54 +1,54 @@
 "use strict";
 
 module.exports = {
-  "globals": {
+  globals: {
     // These are defined in the WebExtension script scopes by ExtensionCommon.jsm.
     // From toolkit/components/extensions/.eslintrc.js.
-    "ExtensionAPI": true,
-    "ExtensionCommon": true,
-    "ExtensionUtils": true,
-    "extensions": true,
-    "global": true,
-    "Services": true,
+    ExtensionAPI: true,
+    ExtensionCommon: true,
+    ExtensionUtils: true,
+    extensions: true,
+    global: true,
+    Services: true,
 
     // From toolkit/components/extensions/parent/.eslintrc.js.
-    "CONTAINER_STORE": true,
-    "DEFAULT_STORE": true,
-    "EventEmitter": true,
-    "EventManager": true,
-    "InputEventManager": true,
-    "PRIVATE_STORE": true,
-    "TabBase": true,
-    "TabManagerBase": true,
-    "TabTrackerBase": true,
-    "WindowBase": true,
-    "WindowManagerBase": true,
-    "WindowTrackerBase": true,
-    "getContainerForCookieStoreId": true,
-    "getCookieStoreIdForContainer": true,
-    "getCookieStoreIdForTab": true,
-    "isContainerCookieStoreId": true,
-    "isDefaultCookieStoreId": true,
-    "isPrivateCookieStoreId": true,
-    "isValidCookieStoreId": true,
+    CONTAINER_STORE: true,
+    DEFAULT_STORE: true,
+    EventEmitter: true,
+    EventManager: true,
+    InputEventManager: true,
+    PRIVATE_STORE: true,
+    TabBase: true,
+    TabManagerBase: true,
+    TabTrackerBase: true,
+    WindowBase: true,
+    WindowManagerBase: true,
+    WindowTrackerBase: true,
+    getContainerForCookieStoreId: true,
+    getCookieStoreIdForContainer: true,
+    getCookieStoreIdForTab: true,
+    isContainerCookieStoreId: true,
+    isDefaultCookieStoreId: true,
+    isPrivateCookieStoreId: true,
+    isValidCookieStoreId: true,
 
     // These are defined in ext-mail.js.
-    "ExtensionError": true,
-    "Tab": true,
-    "Window": true,
-    "convertFolder": true,
-    "convertMessage": true,
-    "folderPathToURI": true,
-    "folderURIToPath": true,
-    "getTabBrowser": true,
-    "makeWidgetId": true,
-    "messageListTracker": true,
-    "messageTracker": true,
-    "tabGetSender": true,
-    "tabTracker": true,
-    "windowTracker": true,
+    ExtensionError: true,
+    Tab: true,
+    Window: true,
+    convertFolder: true,
+    convertMessage: true,
+    folderPathToURI: true,
+    folderURIToPath: true,
+    getTabBrowser: true,
+    makeWidgetId: true,
+    messageListTracker: true,
+    messageTracker: true,
+    tabGetSender: true,
+    tabTracker: true,
+    windowTracker: true,
 
     // ext-browserAction.js
-    "browserActionFor": true,
+    browserActionFor: true,
   },
 };
--- a/mail/components/extensions/test/browser/.eslintrc.js
+++ b/mail/components/extensions/test/browser/.eslintrc.js
@@ -1,14 +1,14 @@
 "use strict";
 
 module.exports = {
-  "extends": "plugin:mozilla/browser-test",
+  extends: "plugin:mozilla/browser-test",
 
-  "env": {
-    "webextensions": true,
+  env: {
+    webextensions: true,
   },
 
-  "rules": {
+  rules: {
     "func-names": "off",
     "mozilla/import-headjs-globals": "error",
   },
 };
--- a/mail/components/extensions/test/xpcshell/.eslintrc.js
+++ b/mail/components/extensions/test/xpcshell/.eslintrc.js
@@ -1,16 +1,16 @@
 "use strict";
 
 module.exports = {
-  "extends": "plugin:mozilla/xpcshell-test",
+  extends: "plugin:mozilla/xpcshell-test",
 
-  "env": {
+  env: {
     // The tests in this folder are testing based on WebExtensions, so lets
     // just define the webextensions environment here.
-    "webextensions": true,
+    webextensions: true,
   },
 
-  "rules": {
+  rules: {
     "func-names": "off",
     "mozilla/import-headjs-globals": "error",
   },
 };
--- a/mail/components/im/content/.eslintrc.js
+++ b/mail/components/im/content/.eslintrc.js
@@ -1,23 +1,23 @@
 "use strict";
 
 module.exports = {
-  overrides: [{
-    files: [
-      "imconversation.xml",
-    ],
-    globals: {
-      AppConstants: true,
-      chatHandler: true,
-      fixIterator: true,
-      gChatTab: true,
-      Services: true,
+  overrides: [
+    {
+      files: ["imconversation.xml"],
+      globals: {
+        AppConstants: true,
+        chatHandler: true,
+        fixIterator: true,
+        gChatTab: true,
+        Services: true,
 
-      // chat/modules/imStatusUtils.jsm
-      Status: true,
+        // chat/modules/imStatusUtils.jsm
+        Status: true,
 
-      // chat/modules/imTextboxUtils.jsm
-      MessageFormat: true,
-      TextboxSize: true,
+        // chat/modules/imTextboxUtils.jsm
+        MessageFormat: true,
+        TextboxSize: true,
+      },
     },
-  }],
+  ],
 };
--- a/mailnews/db/gloda/test/unit/.eslintrc.js
+++ b/mailnews/db/gloda/test/unit/.eslintrc.js
@@ -1,18 +1,21 @@
 "use strict";
 
 module.exports = {
-  "extends": "plugin:mozilla/xpcshell-test",
+  extends: "plugin:mozilla/xpcshell-test",
 
-  "rules": {
+  rules: {
     "func-names": "off",
     "mozilla/import-headjs-globals": "error",
-    "no-unused-vars": ["error", {
-      "args": "none",
-      "vars": "all",
-    }],
+    "no-unused-vars": [
+      "error",
+      {
+        args: "none",
+        vars: "all",
+      },
+    ],
   },
 
-  "globals": {
-    "do_report_result": false,
+  globals: {
+    do_report_result: false,
   },
 };
--- a/mailnews/extensions/newsblog/.eslintrc.js
+++ b/mailnews/extensions/newsblog/.eslintrc.js
@@ -1,45 +1,48 @@
 "use strict";
 
 module.exports = {
-  "globals": {
-    "Feed": true,
-    "FeedEnclosure": true,
-    "FeedItem": true,
-    "FeedParser": true,
-    "FeedUtils": true,
-    "GetNumSelectedMessages": true,
-    "Log4Moz": true,
-    "MailServices": true,
-    "MsgHdrToMimeMessage": true,
-    "ReloadMessage": true,
-    "Services": true,
-    "gDBView": true,
-    "gMessageNotificationBar": true,
-    "getBrowser": true,
-    "onCheckItem": true,
-    "openContentTab": true,
+  globals: {
+    Feed: true,
+    FeedEnclosure: true,
+    FeedItem: true,
+    FeedParser: true,
+    FeedUtils: true,
+    GetNumSelectedMessages: true,
+    Log4Moz: true,
+    MailServices: true,
+    MsgHdrToMimeMessage: true,
+    ReloadMessage: true,
+    Services: true,
+    gDBView: true,
+    gMessageNotificationBar: true,
+    getBrowser: true,
+    onCheckItem: true,
+    openContentTab: true,
   },
 
-  "rules": {
+  rules: {
     // Warn about cyclomatic complexity in functions.
-    "complexity": ["error", 80],
+    complexity: ["error", 80],
 
     // Require braces around blocks that start a new line.
-    "curly": ["error", "multi-line"],
+    curly: ["error", "multi-line"],
 
     // Enforce valid JSDoc comments.
-    "valid-jsdoc": ["error", {
-      prefer: { return: "returns" },
-      preferType: {
-        "boolean": "Boolean",
-        "string": "String",
-        "number": "Number",
-        "object": "Object",
-        "function": "Function",
-        "map": "Map",
-        "set": "Set",
-        "date": "Date",
+    "valid-jsdoc": [
+      "error",
+      {
+        prefer: { return: "returns" },
+        preferType: {
+          boolean: "Boolean",
+          string: "String",
+          number: "Number",
+          object: "Object",
+          function: "Function",
+          map: "Map",
+          set: "Set",
+          date: "Date",
+        },
       },
-    }],
+    ],
   },
 };
--- a/mailnews/mime/jsmime/test/.eslintrc.js
+++ b/mailnews/mime/jsmime/test/.eslintrc.js
@@ -1,14 +1,17 @@
 "use strict";
 
 module.exports = {
-  "extends": "plugin:mozilla/xpcshell-test",
+  extends: "plugin:mozilla/xpcshell-test",
 
-  "rules": {
+  rules: {
     "func-names": "off",
     "mozilla/import-headjs-globals": "error",
-    "no-unused-vars": ["error", {
-      "args": "none",
-      "vars": "all",
-    }],
+    "no-unused-vars": [
+      "error",
+      {
+        args: "none",
+        vars: "all",
+      },
+    ],
   },
 };
--- a/mailnews/test/resources/.eslintrc.js
+++ b/mailnews/test/resources/.eslintrc.js
@@ -1,5 +1,5 @@
 "use strict";
 
 module.exports = {
-  "extends": "plugin:mozilla/xpcshell-test",
+  extends: "plugin:mozilla/xpcshell-test",
 };