Clean up lint under polygerrit-ui

This change cleans up all lint errors reported by gjslint,
with the exception of third-party code in the gr-linked-text
element and everything under bower_components:

$ gjslint --custom_jsdoc_tags event --check_html \
    -e bower_components,gr-linked-text -r app
Skipping 577 file(s).
181 files checked, no errors found.

Change-Id: I080d58bdd33b2d4b8dd22a717f06eebd7bbfb63d
This commit is contained in:
Logan Hanks
2016-06-15 11:57:36 -07:00
parent bc96b43fc2
commit d2497fbd09
21 changed files with 162 additions and 128 deletions

View File

@@ -49,18 +49,44 @@ limitations under the License.
},
ssh: {
commands: {
'Checkout': 'git fetch ssh://andybons@localhost:29418/test-project refs/changes/05/5/1 && git checkout FETCH_HEAD',
'Cherry Pick': 'git fetch ssh://andybons@localhost:29418/test-project refs/changes/05/5/1 && git cherry-pick FETCH_HEAD',
'Format Patch': 'git fetch ssh://andybons@localhost:29418/test-project refs/changes/05/5/1 && git format-patch -1 --stdout FETCH_HEAD',
'Pull': 'git pull ssh://andybons@localhost:29418/test-project refs/changes/05/5/1'
'Checkout':
'git fetch ' +
'ssh://andybons@localhost:29418/test-project ' +
'refs/changes/05/5/1 && git checkout FETCH_HEAD',
'Cherry Pick':
'git fetch ' +
'ssh://andybons@localhost:29418/test-project ' +
'refs/changes/05/5/1 && git cherry-pick FETCH_HEAD',
'Format Patch':
'git fetch ' +
'ssh://andybons@localhost:29418/test-project ' +
'refs/changes/05/5/1 ' +
'&& git format-patch -1 --stdout FETCH_HEAD',
'Pull':
'git pull ' +
'ssh://andybons@localhost:29418/test-project ' +
'refs/changes/05/5/1'
}
},
http: {
commands: {
'Checkout': 'git fetch http://andybons@localhost:8080/a/test-project refs/changes/05/5/1 && git checkout FETCH_HEAD',
'Cherry Pick': 'git fetch http://andybons@localhost:8080/a/test-project refs/changes/05/5/1 && git cherry-pick FETCH_HEAD',
'Format Patch': 'git fetch http://andybons@localhost:8080/a/test-project refs/changes/05/5/1 && git format-patch -1 --stdout FETCH_HEAD',
'Pull': 'git pull http://andybons@localhost:8080/a/test-project refs/changes/05/5/1'
'Checkout':
'git fetch ' +
'http://andybons@localhost:8080/a/test-project ' +
'refs/changes/05/5/1 && git checkout FETCH_HEAD',
'Cherry Pick':
'git fetch ' +
'http://andybons@localhost:8080/a/test-project ' +
'refs/changes/05/5/1 && git cherry-pick FETCH_HEAD',
'Format Patch':
'git fetch ' +
'http://andybons@localhost:8080/a/test-project ' +
'refs/changes/05/5/1 && ' +
'git format-patch -1 --stdout FETCH_HEAD',
'Pull':
'git pull ' +
'http://andybons@localhost:8080/a/test-project ' +
'refs/changes/05/5/1'
}
}
}

View File

@@ -216,7 +216,8 @@ limitations under the License.
element.$.input.text = 'andyb';
element._lastAutocompleteRequest.then(function() {
MockInteractions.pressAndReleaseKeyOn(autocompleteInput, 13); // 'enter'
MockInteractions.pressAndReleaseKeyOn(
autocompleteInput, 13); // 'enter'
assert.isTrue(element.disabled);
element._xhrPromise.then(function() {

View File

@@ -73,7 +73,7 @@ limitations under the License.
}
}
node = node.previousSibling || node.parentElement;
};
}
return null;
},
@@ -147,7 +147,7 @@ limitations under the License.
getCommentThreadByLine: function(lineNumber, opt_side, opt_root) {
var root = Polymer.dom(opt_root || this.diffElement);
var sideSelector = !!opt_side ? ('.' + opt_side) : ''
var sideSelector = !!opt_side ? ('.' + opt_side) : '';
var content = this.getContentByLine(lineNumber, opt_side, opt_root);
return content.querySelector('gr-diff-comment-thread');
},

View File

@@ -306,7 +306,8 @@ limitations under the License.
assert.equal(builder._addTabWrappers(html), 'abc' + wrapper + 'def');
assert.throws(builder._getTabWrapper.bind(
builder,
'"><img src="/" onerror="alert(1);"><span class="',
// using \x3c instead of < in string so gjslint can parse
'">\x3cimg src="/" onerror="alert(1);">\x3cspan class="',
true));
});
@@ -507,9 +508,12 @@ limitations under the License.
content = [
' this._path = value.path;',
'',
' // When navigating away from the page, there is a possibility that the',
' // patch number is no longer a part of the URL (say when navigating to',
' // the top-level change info view) and therefore undefined in `params`.',
' // When navigating away from the page, there is a ' +
'possibility that the',
' // patch number is no longer a part of the URL ' +
'(say when navigating to',
' // the top-level change info view) and therefore ' +
'undefined in `params`.',
' if (!this._patchRange.patchNum) {',
];
highlights = [

View File

@@ -68,14 +68,14 @@
moveLeft: function() {
this.side = DiffSides.LEFT;
if (this._isTargetBlank()) {
this.moveUp()
this.moveUp();
}
},
moveRight: function() {
this.side = DiffSides.RIGHT;
if (this._isTargetBlank()) {
this.moveUp()
this.moveUp();
}
},

View File

@@ -87,7 +87,7 @@ limitations under the License.
var firstDeltaRow = diffElement.$$('.section.delta .diff-row');
assert.equal(cursorElement.diffRow, firstDeltaRow);
cursorElement.moveDown()
cursorElement.moveDown();
assert.notEqual(cursorElement.diffRow, firstDeltaRow);
assert.equal(cursorElement.diffRow, firstDeltaRow.nextSibling);

View File

@@ -23,76 +23,77 @@ limitations under the License.
'use strict';
var RESPONSE = {
"meta_a": {
"name": "lorem-ipsum.txt",
"content_type": "text/plain",
"lines": 45,
'meta_a': {
'name': 'lorem-ipsum.txt',
'content_type': 'text/plain',
'lines': 45,
},
"meta_b": {
"name": "lorem-ipsum.txt",
"content_type": "text/plain",
"lines": 48,
'meta_b': {
'name': 'lorem-ipsum.txt',
'content_type': 'text/plain',
'lines': 48,
},
"intraline_status": "OK",
"change_type": "MODIFIED",
"diff_header": [
"diff --git a/lorem-ipsum.txt b/lorem-ipsum.txt",
"index b2adcf4..554ae49 100644",
"--- a/lorem-ipsum.txt",
"+++ b/lorem-ipsum.txt",
'intraline_status': 'OK',
'change_type': 'MODIFIED',
'diff_header': [
'diff --git a/lorem-ipsum.txt b/lorem-ipsum.txt',
'index b2adcf4..554ae49 100644',
'--- a/lorem-ipsum.txt',
'+++ b/lorem-ipsum.txt',
],
"content": [
'content': [
{
"ab": [
"Lorem ipsum dolor sit amet, suspendisse inceptos vehicula, nulla phasellus.",
"Mattis lectus.",
"Sodales duis.",
"Orci a faucibus.",
'ab': [
'Lorem ipsum dolor sit amet, suspendisse inceptos vehicula, ' +
'nulla phasellus.',
'Mattis lectus.',
'Sodales duis.',
'Orci a faucibus.',
]
},
{
"b": [
"Nullam neque, ligula ac, id blandit.",
"Sagittis tincidunt torquent, tempor nunc amet.",
"At rhoncus id.",
'b': [
'Nullam neque, ligula ac, id blandit.',
'Sagittis tincidunt torquent, tempor nunc amet.',
'At rhoncus id.',
],
},
{
"ab": [
"Sem nascetur, erat ut, non in.",
"A donec, venenatis pellentesque dis.",
"Mauris mauris.",
"Quisque nisl duis, facilisis viverra.",
"Justo purus, semper eget et.",
'ab': [
'Sem nascetur, erat ut, non in.',
'A donec, venenatis pellentesque dis.',
'Mauris mauris.',
'Quisque nisl duis, facilisis viverra.',
'Justo purus, semper eget et.',
],
},
{ "a": [
"Est amet, vestibulum pellentesque.",
"Erat ligula.",
"Justo eros.",
"Fringilla quisque.",
{ 'a': [
'Est amet, vestibulum pellentesque.',
'Erat ligula.',
'Justo eros.',
'Fringilla quisque.',
],
},
{
"ab": [
"Arcu eget, rhoncus amet cursus, ipsum elementum.",
"Eros suspendisse.",
'ab': [
'Arcu eget, rhoncus amet cursus, ipsum elementum.',
'Eros suspendisse.',
],
},
{
"a": [
"Rhoncus tempor, ultricies aliquam ipsum.",
'a': [
'Rhoncus tempor, ultricies aliquam ipsum.',
],
"b": [
"Rhoncus tempor, ultricies praesent ipsum.",
'b': [
'Rhoncus tempor, ultricies praesent ipsum.',
],
"edit_a": [
'edit_a': [
[
26,
7,
],
],
"edit_b": [
'edit_b': [
[
26,
8,
@@ -100,48 +101,49 @@ limitations under the License.
],
},
{
"ab": [
"Sollicitudin duis.",
"Blandit blandit, ante nisl fusce.",
"Felis ac at, tellus consectetuer.",
"Sociis ligula sapien, egestas leo.",
"Cum pulvinar, sed mauris, cursus neque velit.",
"Augue porta lobortis.",
"Nibh lorem, amet fermentum turpis, vel pulvinar diam.",
"Id quam ipsum, id urna et, massa suspendisse.",
"Ac nec, nibh praesent.",
"Rutrum vestibulum.",
"Est tellus, bibendum habitasse.",
"Justo facilisis, vel nulla.",
"Donec eu, vulputate neque aliquam, nulla dui.",
"Risus adipiscing in.",
"Lacus arcu arcu.",
"Urna velit.",
"Urna a dolor.",
"Lectus magna augue, convallis mattis tortor, sed tellus consequat.",
"Etiam dui, blandit wisi.",
"Mi nec.",
"Vitae eget vestibulum.",
"Ullamcorper nunc ante, nec imperdiet felis, consectetur in.",
"Ac eget.",
"Vel fringilla, interdum pellentesque placerat, proin ante.",
'ab': [
'Sollicitudin duis.',
'Blandit blandit, ante nisl fusce.',
'Felis ac at, tellus consectetuer.',
'Sociis ligula sapien, egestas leo.',
'Cum pulvinar, sed mauris, cursus neque velit.',
'Augue porta lobortis.',
'Nibh lorem, amet fermentum turpis, vel pulvinar diam.',
'Id quam ipsum, id urna et, massa suspendisse.',
'Ac nec, nibh praesent.',
'Rutrum vestibulum.',
'Est tellus, bibendum habitasse.',
'Justo facilisis, vel nulla.',
'Donec eu, vulputate neque aliquam, nulla dui.',
'Risus adipiscing in.',
'Lacus arcu arcu.',
'Urna velit.',
'Urna a dolor.',
'Lectus magna augue, convallis mattis tortor, sed tellus ' +
'consequat.',
'Etiam dui, blandit wisi.',
'Mi nec.',
'Vitae eget vestibulum.',
'Ullamcorper nunc ante, nec imperdiet felis, consectetur in.',
'Ac eget.',
'Vel fringilla, interdum pellentesque placerat, proin ante.',
],
},
{
"b": [
"Eu congue risus.",
"Enim ac, quis elementum.",
"Non et elit.",
"Etiam aliquam, diam vel nunc.",
'b': [
'Eu congue risus.',
'Enim ac, quis elementum.',
'Non et elit.',
'Etiam aliquam, diam vel nunc.',
],
},
{
"ab": [
"Nec at.",
"Arcu mauris, venenatis lacus fermentum, praesent duis.",
"Pellentesque amet et, tellus duis.",
"Ipsum arcu vitae, justo elit, sed libero tellus.",
"Metus rutrum euismod, vivamus sodales, vel arcu nisl.",
'ab': [
'Nec at.',
'Arcu mauris, venenatis lacus fermentum, praesent duis.',
'Pellentesque amet et, tellus duis.',
'Ipsum arcu vitae, justo elit, sed libero tellus.',
'Metus rutrum euismod, vivamus sodales, vel arcu nisl.',
],
},
],

View File

@@ -62,8 +62,8 @@
this.listen(this, eventName, methodName);
} else {
this.unlisten(this, eventName, methodName);
};
};
}
}
},
isRangeSelected: function() {

View File

@@ -58,7 +58,7 @@
this.style.top =
rect.top - parentRect.top - boxRect.height - 4 + 'px';
this.style.left =
rect.left - parentRect.left + (rect.width - boxRect.width)/2 + 'px';
rect.left - parentRect.left + (rect.width - boxRect.width) / 2 + 'px';
},
_getTargetBoundingRect: function(el) {
@@ -79,7 +79,7 @@
if (e.keyCode === 67) { // 'c'
e.preventDefault();
this._fireCreateComment();
};
}
},
_handleTap: function() {

View File

@@ -83,9 +83,9 @@ limitations under the License.
setup(function() {
target = container.querySelector('.target');
sinon.stub(container, 'getBoundingClientRect').returns(
{top:1, bottom: 2, left: 3, right: 4, width: 50, height: 6});
{top: 1, bottom: 2, left: 3, right: 4, width: 50, height: 6});
sinon.stub(element, '_getTargetBoundingRect').returns(
{top:42, bottom: 20, left: 30, right: 40, width: 100, height: 60});
{top: 42, bottom: 20, left: 30, right: 40, width: 100, height: 60});
sinon.stub(element, 'getBoundingClientRect').returns(
{width: 10, height: 10});
});

View File

@@ -46,8 +46,8 @@ limitations under the License.
// Click the up/down button (according to direction) for the index'th row.
// The index of the first row is 0, corresponding to the array.
function move(element, index, direction) {
var selector =
'tr:nth-child(' + (index+1) + ') .move-' + direction + '-button';
var selector =
'tr:nth-child(' + (index + 1) + ') .move-' + direction + '-button';
var button = element.$$('tbody').querySelector(selector);
MockInteractions.tap(button);
}
@@ -55,9 +55,9 @@ limitations under the License.
setup(function() {
element = fixture('basic');
menu = [
{url: "/first/url", name: "first name", target: "_blank"},
{url: "/second/url", name: "second name", target: "_blank"},
{url: "/third/url", name: "third name", target: "_blank"},
{url: '/first/url', name: 'first name', target: '_blank'},
{url: '/second/url', name: 'second name', target: '_blank'},
{url: '/third/url', name: 'third name', target: '_blank'},
];
element.set('menuItems', menu);
Polymer.dom.flush();

View File

@@ -145,7 +145,7 @@
this._diffPrefsChanged = true;
},
_handleMenuChanged: function () {
_handleMenuChanged: function() {
if (this._loading || this._loading === undefined) { return; }
this._menuChanged = true;
},

View File

@@ -57,7 +57,7 @@
show: function(text, opt_actionText) {
this.text = text;
this.actionText = opt_actionText;
this._hideActionButton = !opt_actionText
this._hideActionButton = !opt_actionText;
document.body.appendChild(this);
this._setShown(true);
},

View File

@@ -37,7 +37,8 @@
var hasAvatars = !!(cfg && cfg.plugin && cfg.plugin.has_avatars);
if (hasAvatars) {
this.hidden = false;
this._updateAvatarURL(this.account); // src needs to be set if avatar becomes visible
// src needs to be set if avatar becomes visible
this._updateAvatarURL(this.account);
}
}.bind(this));
},

View File

@@ -88,7 +88,7 @@
/**
* Set the cursor to an arbitrary element.
* @param {DOMElement}
* @param {DOMElement} element
*/
setCursor: function(element) {
this.unsetCursor();
@@ -120,7 +120,7 @@
/**
* Move the cursor forward or backward by delta. Noop if moving past either
* end of the stop list.
* @param {Number} delta: either -1 or 1.
* @param {Number} delta either -1 or 1.
* @param {Function} opt_condition Optional stop condition. If a condition
* is passed the cursor will continue to move in the specified direction
* until the condition is met.
@@ -161,7 +161,7 @@
/**
* Get the next stop index indicated by the delta direction.
* @param {Number} delta: either -1 or 1.
* @param {Number} delta either -1 or 1.
* @param {Function} opt_condition Optional stop condition.
* @return {Number} the new index.
* @private
@@ -174,9 +174,9 @@
var newIndex = this.index;
do {
newIndex = newIndex + delta;
} while(newIndex > 0 &&
newIndex < this.stops.length - 1 &&
opt_condition && !opt_condition(this.stops[newIndex]));
} while (newIndex > 0 &&
newIndex < this.stops.length - 1 &&
opt_condition && !opt_condition(this.stops[newIndex]));
newIndex = Math.max(0, Math.min(this.stops.length - 1, newIndex));

View File

@@ -127,7 +127,7 @@
if (!dateStr) { return ''; }
var date = moment(util.parseDate(dateStr));
if (!date.isValid()) { return ''; }
return date.format(TimeFormats.MONTH_DAY_YEAR + ', ' + timeFormat);
return date.format(TimeFormats.MONTH_DAY_YEAR + ', ' + timeFormat);
},
});
})();

View File

@@ -63,12 +63,12 @@
this.async(function() {
this.$.input.focus();
this.$.input.setSelectionRange(0, this.$.input.value.length)
this.$.input.setSelectionRange(0, this.$.input.value.length);
});
},
_save: function() {
if (!this.editing) { return; };
if (!this.editing) { return; }
this.value = this._inputText;
this.editing = false;

View File

@@ -449,7 +449,7 @@
_sendChangeReviewerRequest: function(method, changeNum, reviewerID) {
var url = this.getChangeActionURL(changeNum, null, '/reviewers');
var body;
switch(method) {
switch (method) {
case 'POST':
body = {reviewer: reviewerID};
break;
@@ -592,7 +592,7 @@
getDiff: function(changeNum, basePatchNum, patchNum, path,
opt_errFn, opt_cancelCondition) {
var url = this._getDiffFetchURL(changeNum, patchNum, path);
var params = {
var params = {
context: 'ALL',
intraline: null,
whitespace: 'IGNORE_NONE',

View File

@@ -263,7 +263,7 @@ limitations under the License.
assert.isTrue(getResponseObjectStub.notCalled);
getResponseObjectStub.restore();
fetchStub.restore();
serverErrorEventPromise.then(function () {
serverErrorEventPromise.then(function() {
done();
});
});

View File

@@ -15,10 +15,10 @@
'use strict';
// Date cutoff is one day:
var DRAFT_MAX_AGE = 24*60*60*1000;
var DRAFT_MAX_AGE = 24 * 60 * 60 * 1000;
// Clean up old entries no more frequently than one day.
var CLEANUP_THROTTLE_INTERVAL = 24*60*60*1000;
var CLEANUP_THROTTLE_INTERVAL = 24 * 60 * 60 * 1000;
Polymer({
is: 'gr-storage',

View File

@@ -100,7 +100,7 @@ limitations under the License.
// Create a message with a timestamp that is a second behind the max age.
storage.setItem(key, JSON.stringify({
message: 'old message',
updated: Date.now() - 24*60*60*1000 - 1000,
updated: Date.now() - 24 * 60 * 60 * 1000 - 1000,
}));
// Getting the draft should cause it to be removed.