Bug 1263637 - eslint 2 warnings for WebExtensions code, r?kmag draft
authorBob Silverberg <bsilverberg@mozilla.com>
Mon, 18 Apr 2016 09:08:05 -0400
changeset 352742 5482291a0c2ed68539eff76399845fbf901cfc4a
parent 352654 4bc053de842538e99e56927b3c03fdc539374a16
child 518722 4510895d348c1d25af5409dc097056b6475b918f
push id15773
push userbmo:bob.silverberg@gmail.com
push dateMon, 18 Apr 2016 15:58:32 +0000
reviewerskmag
bugs1263637
milestone48.0a1
Bug 1263637 - eslint 2 warnings for WebExtensions code, r?kmag MozReview-Commit-ID: CNLX3xjIoNV
python/mach_commands.py
testing/docker/lint/Dockerfile
toolkit/components/extensions/.eslintrc
toolkit/components/extensions/Schemas.jsm
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -219,17 +219,17 @@ class MachCommands(MachCommandBase):
         npmPath = self.getNodeOrNpmPath("npm")
         if not npmPath:
             return 1
 
         # Install eslint 1.10.3.
         # Note that that's the version currently compatible with the mozilla
         # eslint plugin.
         success = self.callProcess("eslint",
-                                   [npmPath, "install", "eslint@2.7.0", "-g"])
+                                   [npmPath, "install", "eslint@2.8.0", "-g"])
         if not success:
             return 1
 
         # Install eslint-plugin-mozilla.
         success = self.callProcess("eslint-plugin-mozilla",
                                    [npmPath, "link"],
                                    "testing/eslint-plugin-mozilla")
         if not success:
--- a/testing/docker/lint/Dockerfile
+++ b/testing/docker/lint/Dockerfile
@@ -1,17 +1,17 @@
 FROM          node:4.2
 MAINTAINER    Dave Townsend <dtownsend@oxymoronical.com>
 
 RUN useradd -d /home/worker -s /bin/bash -m worker
 WORKDIR /home/worker
 
 # install necessary npm packages
 RUN           npm install -g taskcluster-vcs@2.3.12
-RUN           npm install -g eslint@2.7.0
+RUN           npm install -g eslint@2.8.0
 RUN           npm install -g eslint-plugin-html@1.4.0
 RUN           npm install -g eslint-plugin-react@4.2.3
 
 # Set variable normally configured at login, by the shells parent process, these
 # are taken from GNU su manual
 ENV           HOME          /home/worker
 ENV           SHELL         /bin/bash
 ENV           USER          worker
--- a/toolkit/components/extensions/.eslintrc
+++ b/toolkit/components/extensions/.eslintrc
@@ -423,17 +423,17 @@
 
     // Disallow padding within blocks.
     "padded-blocks": [1, "never"],
 
     // Don't require quotes around object literal property names.
     "quote-props": 0,
 
     // Double quotes should be used.
-    "quotes": [1, "double", "avoid-escape"],
+    "quotes": [1, "double", {"avoidEscape": true, "allowTemplateLiterals": true}],
 
     // Require use of the second argument for parseInt().
     "radix": 2,
 
     // Enforce spacing after semicolons.
     "semi-spacing": [2, {"before": false, "after": true}],
 
     // Don't require to sort variables within the same declaration block.
--- a/toolkit/components/extensions/Schemas.jsm
+++ b/toolkit/components/extensions/Schemas.jsm
@@ -540,17 +540,18 @@ class ObjectType extends Type {
 
     return this;
   }
 
   checkBaseType(baseType) {
     return baseType == "object";
   }
 
-  normalize(value, context) {
+  // FIXME: Bug 1265371 - Refactor normalize and parseType in Schemas.jsm to reduce complexity
+  normalize(value, context) { // eslint-disable-line complexity
     let v = this.normalizeBase("object", value, context);
     if (v.error) {
       return v;
     }
     value = v.value;
 
     if (this.isInstanceOf) {
       if (Object.keys(this.properties).length ||
@@ -1065,17 +1066,18 @@ this.Schemas = {
     let ns = this.namespaces.get(namespaceName);
     if (!ns) {
       ns = new Map();
       this.namespaces.set(namespaceName, ns);
     }
     ns.set(symbol, value);
   },
 
-  parseType(path, type, extraProperties = []) {
+  // FIXME: Bug 1265371 - Refactor normalize and parseType in Schemas.jsm to reduce complexity
+  parseType(path, type, extraProperties = []) { // eslint-disable-line complexity
     let allowedProperties = new Set(extraProperties);
 
     // Do some simple validation of our own schemas.
     function checkTypeProperties(...extra) {
       let allowedSet = new Set([...allowedProperties, ...extra, "description", "deprecated", "preprocess"]);
       for (let prop of Object.keys(type)) {
         if (!allowedSet.has(prop)) {
           throw new Error(`Internal error: Namespace ${path.join(".")} has invalid type property "${prop}" in type "${type.id || JSON.stringify(type)}"`);