From acdfc1e097dbe9c984aad72c4aba94463341e599 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 8 Feb 2016 14:04:17 -0800 Subject: [PATCH] Test with ESLint enabled Fix linter errors --- .travis.yml | 1 + package.json | 2 +- src/lib/annotations/annotations.html | 778 +++++----- src/lib/array-splice.html | 10 +- src/lib/bind/accessors.html | 8 +- src/lib/collection.html | 10 +- src/lib/custom-style.html | 1 - src/lib/dom-api-effective-nodes-observer.html | 532 ++++--- src/lib/dom-api-shady.html | 18 +- src/lib/dom-innerHTML.html | 262 ++-- src/lib/dom-module.html | 4 +- src/lib/dom-tree-api.html | 36 +- src/lib/render-status.html | 8 +- src/lib/style-defaults.html | 181 ++- src/lib/style-extends.html | 202 +-- src/lib/style-properties.html | 6 +- src/lib/template/dom-repeat.html | 26 +- src/lib/template/templatizer.html | 8 +- src/micro/attributes.html | 5 +- src/micro/properties.html | 6 +- src/mini/shady.html | 16 +- src/standard/annotations.html | 2 +- src/standard/gestures.html | 2 +- src/standard/notify-path.html | 1265 +++++++++-------- src/standard/utils.html | 4 +- src/standard/x-styling.html | 3 +- 26 files changed, 1696 insertions(+), 1700 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d3a1a947a..0bc7a8487e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ before_script: - npm install -g bower - bower install script: +- gulp lint - xvfb-run wct - "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi" env: diff --git a/package.json b/package.json index 9ce05ebc5b..58036b0e19 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "scripts": { "build": "gulp", - "test": "wct", + "test": "gulp lint && wct", "test-build": "gulp switch && wct && gulp restore" }, "repository": { diff --git a/src/lib/annotations/annotations.html b/src/lib/annotations/annotations.html index d3762755a4..de871dac3c 100644 --- a/src/lib/annotations/annotations.html +++ b/src/lib/annotations/annotations.html @@ -1,389 +1,389 @@ - - - - + + + + diff --git a/src/lib/array-splice.html b/src/lib/array-splice.html index f51279a717..8c4da1546d 100644 --- a/src/lib/array-splice.html +++ b/src/lib/array-splice.html @@ -10,7 +10,7 @@ \ No newline at end of file + diff --git a/src/lib/bind/accessors.html b/src/lib/bind/accessors.html index 66175deae6..9973981348 100644 --- a/src/lib/bind/accessors.html +++ b/src/lib/bind/accessors.html @@ -23,7 +23,7 @@ _notifyChange: function(source, event, value) { value = value === undefined ? this[source] : value; event = event || Polymer.CaseMap.camelToDashCase(source) + '-changed'; - this.fire(event, {value: value}, + this.fire(event, {value: value}, {bubbles: false, cancelable: false, _useCache: true}); }, @@ -221,8 +221,8 @@ } else { // TODO(sorvell): even though we have a `value` argument, we *must* // lookup the current value of the property. Multiple listeners and - // queued events during configuration can theoretically lead to - // divergence of the passed value from the current value, but we + // queued events during configuration can theoretically lead to + // divergence of the passed value from the current value, but we // really need to track down a specific case where this happens. value = target[property]; if (!isStructured) { @@ -256,7 +256,7 @@ //if (node._prepParentProperties || !node._propertyInfo || (p && p.notify)) { this._addNotifyListener(node, inst, info.event, info.changedFn); //} - }; + } }, // TODO(sorvell): note, adding these synchronously may impact performance, diff --git a/src/lib/collection.html b/src/lib/collection.html index 997b3a5f3a..91d6ca4954 100644 --- a/src/lib/collection.html +++ b/src/lib/collection.html @@ -50,7 +50,7 @@ }, removeKey: function(key) { - if (key = this._parseKey(key)) { + if ((key = this._parseKey(key))) { this._removeFromMap(this.store[key]); delete this.store[key]; } @@ -95,7 +95,7 @@ }, setItem: function(key, item) { - if (key = this._parseKey(key)) { + if ((key = this._parseKey(key))) { var old = this.store[key]; if (old) { this._removeFromMap(old); @@ -110,7 +110,7 @@ }, getItem: function(key) { - if (key = this._parseKey(key)) { + if ((key = this._parseKey(key))) { return this.store[key]; } }, @@ -140,7 +140,7 @@ key = this.getKey(s.removed[j]); keyMap[key] = keyMap[key] ? null : -1; } - for (var j=0; j (function() { - var nativeShadow = Polymer.Settings.useNativeShadow; var propertyUtils = Polymer.StyleProperties; var styleUtil = Polymer.StyleUtil; var cssParse = Polymer.CssParse; diff --git a/src/lib/dom-api-effective-nodes-observer.html b/src/lib/dom-api-effective-nodes-observer.html index f98de7d456..9eb3fe7ea6 100644 --- a/src/lib/dom-api-effective-nodes-observer.html +++ b/src/lib/dom-api-effective-nodes-observer.html @@ -1,268 +1,264 @@ - - - \ No newline at end of file + + + diff --git a/src/lib/dom-api-shady.html b/src/lib/dom-api-shady.html index b15bfac7cd..7c4da0b23b 100644 --- a/src/lib/dom-api-shady.html +++ b/src/lib/dom-api-shady.html @@ -93,7 +93,7 @@ if (root) { // note: we always need to see if an insertion point is added // since this saves logical tree info; however, invalidation state - // needs + // needs var ipAdded = this._maybeAddInsertionPoint(node, this.node); // invalidate insertion points IFF not already invalid! if (!root._invalidInsertionPoints) { @@ -107,14 +107,14 @@ // if not distributing and not adding to host, do a fast path addition var handled = this._maybeDistribute(node) || this.node.shadyRoot; - // if shady is handling this node, + // if shady is handling this node, // the actual dom may not be removed if the node or fragment contents // remain undistributed so we ensure removal here. // NOTE: we only remove from existing location iff shady dom is involved. // This is because a node fragment is passed to the native add method // which expects to see fragment children. Regular elements must also - // use this check because not doing so causes separation of - // attached/detached and breaks, for example, + // use this check because not doing so causes separation of + // attached/detached and breaks, for example, // dom-if's attached/detached checks. if (handled) { if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { @@ -137,7 +137,7 @@ */ removeChild: function(node) { if (TreeApi.Logical.getParentNode(node) !== this.node) { - throw Error('The node to be removed is not a child of this node: ' + + throw Error('The node to be removed is not a child of this node: ' + node); } if (!this._removeNode(node)) { @@ -154,7 +154,7 @@ return node; }, - // Try to remove node: update logical info and perform distribution iff + // Try to remove node: update logical info and perform distribution iff // needed. Return true if the removal has been handled. // note that it's possible for both the node's host and its parent // to require distribution... both cases are handled here. @@ -214,7 +214,7 @@ } // memo-ize result for performance but only memo-ize a false-y // result if node is in the document. This avoids a problem where a root - // can be cached while an element is inside a fragment. + // can be cached while an element is inside a fragment. // If this happens and we cache the result, the value can become stale // because for perf we avoid processing the subtree of added fragments. if (root || document.documentElement.contains(node)) { @@ -298,7 +298,7 @@ }, _nodeNeedsDistribution: function(node) { - return node && node.shadyRoot && + return node && node.shadyRoot && DomApi.hasInsertionPoint(node.shadyRoot); }, @@ -587,7 +587,7 @@ return this.node.textContent; } else { var tc = []; - for (var i = 0, cn = this.childNodes, c; c = cn[i]; i++) { + for (var i = 0, cn = this.childNodes, c; (c = cn[i]); i++) { if (c.nodeType !== Node.COMMENT_NODE) { tc.push(c.textContent); } diff --git a/src/lib/dom-innerHTML.html b/src/lib/dom-innerHTML.html index 755eb4a388..09c8f3b957 100644 --- a/src/lib/dom-innerHTML.html +++ b/src/lib/dom-innerHTML.html @@ -1,131 +1,131 @@ - - + + diff --git a/src/lib/dom-module.html b/src/lib/dom-module.html index f1f9355a43..468e55bf24 100644 --- a/src/lib/dom-module.html +++ b/src/lib/dom-module.html @@ -45,7 +45,7 @@ * @param {String} id The id at which to register the dom-module. */ register: function(id) { - var id = id || this.id || + id = id || this.id || this.getAttribute('name') || this.getAttribute('is'); if (id) { this.id = id; @@ -103,7 +103,7 @@ var doc = script && script.ownerDocument || document; // find all dom-modules var modules = doc.querySelectorAll('dom-module'); - // minimize work by going backwards and stopping if we find an + // minimize work by going backwards and stopping if we find an // upgraded module. for (var i= modules.length-1, m; (i >=0) && (m=modules[i]); i--) { if (m.__upgraded__) { diff --git a/src/lib/dom-tree-api.html b/src/lib/dom-tree-api.html index 3fb61da781..ccf0dea031 100644 --- a/src/lib/dom-tree-api.html +++ b/src/lib/dom-tree-api.html @@ -11,20 +11,20 @@ \ No newline at end of file + diff --git a/src/lib/style-defaults.html b/src/lib/style-defaults.html index 1ffedc183c..c015da7462 100644 --- a/src/lib/style-defaults.html +++ b/src/lib/style-defaults.html @@ -1,91 +1,90 @@ - - - - + + + + diff --git a/src/lib/style-extends.html b/src/lib/style-extends.html index 414f1ba2a0..97d71abc5d 100644 --- a/src/lib/style-extends.html +++ b/src/lib/style-extends.html @@ -1,101 +1,101 @@ - - - - + + + + diff --git a/src/lib/style-properties.html b/src/lib/style-properties.html index 544a0be984..74436cdc68 100644 --- a/src/lib/style-properties.html +++ b/src/lib/style-properties.html @@ -71,7 +71,7 @@ var m, rx = this.rx.VAR_ASSIGN; var cssText = rule.parsedCssText; var any; - while (m = rx.exec(cssText)) { + while ((m = rx.exec(cssText))) { // note: group 2 is var, 3 is mixin properties[m[1]] = (m[2] || m[3]).trim(); any = true; @@ -103,7 +103,7 @@ collectPropertiesInCssText: function(cssText, props) { var m; - while (m = this.rx.VAR_CAPTURE.exec(cssText)) { + while ((m = this.rx.VAR_CAPTURE.exec(cssText))) { props[m[1]] = true; var def = m[2]; if (def && def.match(this.rx.IS_VAR)) { @@ -155,7 +155,7 @@ valueForProperties: function(property, props) { var parts = property.split(';'); for (var i=0, p, m; i=0 ; i--) { + for (i=removedIdxs.length-1; i>=0 ; i--) { var idx = removedIdxs[i]; // Removed idx may be undefined if item was previously filtered out if (idx !== undefined) { @@ -583,7 +582,7 @@ }); // Insertion-sort new instances into place (from pool or newly created) var start = 0; - for (var i=0; i diff --git a/src/micro/properties.html b/src/micro/properties.html index 60257e2c90..bd3b928d9d 100644 --- a/src/micro/properties.html +++ b/src/micro/properties.html @@ -116,7 +116,7 @@ if (info) { return info; } - }; + } } return info || Polymer.nob; }, @@ -138,7 +138,7 @@ // union properties, behaviors.properties, and propertyEffects _prepPropertyInfo: function() { this._propertyInfo = {}; - for (var i=0, p; i < this.behaviors.length; i++) { + for (var i=0; i < this.behaviors.length; i++) { this._addPropertyInfo(this._propertyInfo, this.behaviors[i].properties); } this._addPropertyInfo(this._propertyInfo, this.properties); @@ -174,7 +174,7 @@ } } } - }, + } }); diff --git a/src/mini/shady.html b/src/mini/shady.html index c06bc2fda4..9bc70164e6 100644 --- a/src/mini/shady.html +++ b/src/mini/shady.html @@ -77,12 +77,12 @@ this.shadyRoot._isShadyRoot = true; this.shadyRoot._dirtyRoots = []; // capture insertion point list - var i$ = this.shadyRoot._insertionPoints = !this._notes || + var i$ = this.shadyRoot._insertionPoints = !this._notes || this._notes._hasContent ? this.shadyRoot.querySelectorAll('content') : []; // save logical tree info - // a. for shadyRoot - // b. for insertion points (fallback) + // a. for shadyRoot + // b. for insertion points (fallback) // c. for parents of insertion points TreeApi.Logical.saveChildNodes(this.shadyRoot); for (var i=0, c; i < i$.length; i++) { @@ -119,7 +119,7 @@ */ distributeContent: function(updateInsertionPoints) { if (this.shadyRoot) { - this.shadyRoot._invalidInsertionPoints = + this.shadyRoot._invalidInsertionPoints = this.shadyRoot._invalidInsertionPoints || updateInsertionPoints; // Distribute the host that's the top of this element's distribution // tree. Distributing that host will *always* distibute this element. @@ -164,7 +164,7 @@ // compose self if (this._useContent) { // note: it's important to mark this clean before distribution - // so that attachment that provokes additional distribution (e.g. + // so that attachment that provokes additional distribution (e.g. // adding something to your parentNode) works this.shadyRoot._distributionClean = true; if (DomApi.hasInsertionPoint(this.shadyRoot)) { @@ -331,7 +331,7 @@ for (var i=0, d=0, s; (i - - + + + diff --git a/src/standard/utils.html b/src/standard/utils.html index 8f8f5fe9a9..f223b558e9 100644 --- a/src/standard/utils.html +++ b/src/standard/utils.html @@ -144,7 +144,7 @@ getEffectiveTextContent: function() { var cn = this.getEffectiveChildNodes(); var tc = []; - for (var i=0, c; c = cn[i]; i++) { + for (var i=0, c; (c = cn[i]); i++) { if (c.nodeType !== Node.COMMENT_NODE) { tc.push(Polymer.dom(c).textContent); } @@ -215,7 +215,7 @@ fire: function(type, detail, options) { options = options || Polymer.nob; var node = options.node || this; - var detail = (detail === null || detail === undefined) ? {} : detail; + detail = (detail === null || detail === undefined) ? {} : detail; var bubbles = options.bubbles === undefined ? true : options.bubbles; var cancelable = Boolean(options.cancelable); var useCache = options._useCache; diff --git a/src/standard/x-styling.html b/src/standard/x-styling.html index 8e0ef8ba00..e50ff8579e 100644 --- a/src/standard/x-styling.html +++ b/src/standard/x-styling.html @@ -19,7 +19,6 @@ var propertyUtils = Polymer.StyleProperties; var styleTransformer = Polymer.StyleTransformer; - var styleUtil = Polymer.StyleUtil; var styleDefaults = Polymer.StyleDefaults; var nativeShadow = Polymer.Settings.useNativeShadow; @@ -77,7 +76,7 @@ _findStyleHost: function() { var e = this, root; - while (root = Polymer.dom(e).getOwnerRoot()) { + while ((root = Polymer.dom(e).getOwnerRoot())) { if (Polymer.isInstance(root.host)) { return root.host; }