Skip to content

Commit

Permalink
Don't have return /** comment */ lines
Browse files Browse the repository at this point in the history
This breaks espree AST generation with automatic semicolon insertion and
becomes

```
return
/** comment */
thing;
```
  • Loading branch information
dfreedm committed Sep 7, 2017
1 parent e45e5bb commit c802b8b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
3 changes: 2 additions & 1 deletion lib/legacy/class.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
*/
function mixinBehaviors(behaviors, klass) {
if (!behaviors) {
return /** @type {HTMLElement} */(klass);
klass = /** @type {HTMLElement} */(klass); // eslint-disable-line no-self-assign
return klass;
}
// NOTE: ensure the bahevior is extending a class with
// legacy element api. This is necessary since behaviors expect to be able
Expand Down
9 changes: 6 additions & 3 deletions lib/legacy/legacy-element-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@
* @return {Array<Node>} List of effctive child nodes.
*/
getEffectiveChildNodes() {
return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).getEffectiveChildNodes();
const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(this));
return domApi.getEffectiveChildNodes();
}

/**
Expand All @@ -491,7 +492,8 @@
* @return {Array<Node>} List of distributed elements that match selector.
*/
queryDistributedElements(selector) {
return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).queryDistributedElements(selector);
const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(this));
return domApi.queryDistributedElements(selector);
}

/**
Expand Down Expand Up @@ -581,9 +583,10 @@
* @suppress {invalidCasts}
*/
getContentChildren(slctr) {
return /** @type {Array<HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) {
let children = /** @type {Array<HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) {
return (n.nodeType === Node.ELEMENT_NODE);
}));
return children;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions lib/legacy/polymer.dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@
let name = properties[i];
Object.defineProperty(proto, name, {
get: function() {
return /** @type {DomApi} */ (this).node[name];
const domApi = /** @type {DomApi} */(this);
return domApi.node[name];
},
configurable: true
});
Expand All @@ -217,7 +218,8 @@
let name = properties[i];
Object.defineProperty(proto, name, {
get: function() {
return /** @type {DomApi} */ (this).node[name];
const domApi = /** @type {DomApi} */(this);
return domApi.node[name];
},
set: function(value) {
/** @type {DomApi} */ (this).node[name] = value;
Expand Down
3 changes: 2 additions & 1 deletion lib/mixins/template-stamp.html
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@
applyTemplateContent(this, node, info);
applyEventListener(this, node, info);
}
return /** @type {!StampedTemplate} */(dom);
dom = /** @type {!StampedTemplate} */(dom); // eslint-disable-line no-self-assign
return dom;
}

/**
Expand Down
8 changes: 5 additions & 3 deletions lib/utils/flattened-nodes-observer.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@
*/
static getFlattenedNodes(node) {
if (isSlot(node)) {
return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true});
node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign
return node.assignedNodes({flatten: true});
} else {
return Array.from(node.childNodes).map(node => {
return Array.from(node.childNodes).map((node) => {
if (isSlot(node)) {
return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true});
node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign
return node.assignedNodes({flatten: true});
} else {
return [node];
}
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/gestures.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@
_findOriginalTarget: function(ev) {
// shadowdom
if (ev.composedPath) {
return /** @type {EventTarget} */(ev.composedPath()[0]);
const target = /** @type {EventTarget} */(ev.composedPath()[0]);
return target;
}
// shadydom
return ev.target;
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/templatize.html
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@
klass.prototype.__dataHost = template;
klass.prototype.__templatizeOwner = owner;
klass.prototype.__hostProps = templateInfo.hostProps;
return /** @type {function(new:TemplateInstanceBase)} */(klass);
klass = /** @type {function(new:TemplateInstanceBase)} */(klass); //eslint-disable-line no-self-assign
return klass;
},

/**
Expand Down

0 comments on commit c802b8b

Please sign in to comment.