Bug 1577853 - Reformat the .eslintrc.js file with Prettier draft
authorPaul Morris <paul@thunderbird.net>
Sat, 31 Aug 2019 08:56:13 -0400
changeset 78362 bf909e57750f8850d62d375edda6c0e785cfe095
parent 78361 18f4d457cfcb819021eba0fbf5d76f8b62ef3cb6
child 78363 365deb5d9f12b48d6068050b62c86c7f0db39a74
push id9209
push userpaul@paulwmorris.com
push dateSat, 31 Aug 2019 12:58:28 +0000
treeherdertry-comm-central@365deb5d9f12 [default view] [failures only]
bugs1577853
Bug 1577853 - Reformat the .eslintrc.js file with Prettier # ignore-this-changeset These changes were achieved by deleting the .eslintrc.js line from the .prettierignore file and running: |mach eslint .eslintrc.js --fix|
.eslintrc.js
.prettierignore
--- 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/**