Bug 1263637 - eslint 2 warnings for WebExtensions code, r?kmag
MozReview-Commit-ID: CNLX3xjIoNV
--- 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)}"`);