Bug 1488263 - Enable eslint in mailnews/extensions/newsblog, Part 2: eslint changes. r=jorgk
authoralta88
Sat, 01 Sep 2018 22:21:43 -0600
changeset 32976 35b4619745680791f5f13f43dd446166270ff30c
parent 32975 0b3d20e86288e4064481902b56d7905a7f6d904b
child 32977 40d5e3c09200ccc610c0a4ea5c22a8a0f5e9e4d5
push id386
push userclokep@gmail.com
push dateTue, 23 Oct 2018 00:48:12 +0000
reviewersjorgk
bugs1488263
Bug 1488263 - Enable eslint in mailnews/extensions/newsblog, Part 2: eslint changes. r=jorgk
.eslintignore
mailnews/.eslintrc.js
mailnews/extensions/newsblog/.eslintrc.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -19,19 +19,38 @@ testing/**
 # We ignore all these directories by default, until we get them enabled.
 # If you are enabling a directory, please add directory specific exclusions
 # below.
 build/**
 chat/**
 editor/**
 im/**
 ldap/**
-mailnews/**
 suite/**
 
+# mailnews exclusions
+mailnews/addrbook/*
+mailnews/base/*
+mailnews/build/*
+mailnews/compose/*
+mailnews/db/*
+mailnews/imap/*
+mailnews/import/*
+mailnews/intl/*
+mailnews/jsaccount/*
+mailnews/local/*
+mailnews/mapi/*
+mailnews/mime/*
+mailnews/news/*
+mailnews/test/*
+
+# mailnews/extensions exclusions
+mailnews/extensions/*
+!mailnews/extensions/newsblog
+
 # mail exclusions
 mail/app/**
 mail/base/**
 mail/branding/**
 mail/config/**
 mail/extensions/**
 mail/installer/**
 mail/locales/**
new file mode 100644
--- /dev/null
+++ b/mailnews/.eslintrc.js
@@ -0,0 +1,37 @@
+"use strict";
+
+module.exports = {
+  "globals": {
+    "Log4Moz": true,
+    "MailServices": true,
+    "MsgHdrToMimeMessage": true,
+    "ReloadMessage": true,
+    "Services": true,
+    "gDBView": true,
+    "getBrowser": true,
+  },
+
+  "rules": {
+    // Require trailing commas for easy list extension and consistent style.
+    "comma-dangle": ["error", "always-multiline"],
+
+    // Require braces around blocks that start a new 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",
+      },
+    }],
+  },
+
+};
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/newsblog/.eslintrc.js
@@ -0,0 +1,20 @@
+"use strict";
+
+module.exports = { // eslint-disable-line no-undef
+  "globals": {
+    "Feed": true,
+    "FeedEnclosure": true,
+    "FeedItem": true,
+    "FeedParser": true,
+    "FeedUtils": true,
+    "GetNumSelectedMessages": true,
+    "gMessageNotificationBar": true,
+    "onCheckItem": true,
+    "openContentTab": true,
+  },
+
+  "rules": {
+    // Warn about cyclomatic complexity in functions.
+    "complexity": ["error", 70],
+  },
+};