Fix Closure errors in PolyGerrit

The Closure Compiler is very picky with regard to JSDoc formatting. This
change fixes a few invalid JSDoc issues, and removes the corresponding
suppresses from the BUILD file. Additionally, modify the transpilation
target language to ES5.

After this change, there should no longer be warnings from the Closure
Compiler during building of PolyGerrit.

Change-Id: If7566e40c2c419c55f2a634c0f558c6cc263f61c
This commit is contained in:
Kasper Nilsson 2017-04-26 16:17:47 +02:00 committed by David Pursehouse
parent c78fb72fd9
commit d1581ec71c
6 changed files with 15 additions and 13 deletions

View File

@ -33,11 +33,10 @@ vulcanize(
closure_js_library(
name = "closure_lib",
srcs = ["gr-app.js"],
convention = "GOOGLE",
language = "ECMASCRIPT6",
suppress = [
"JSC_BAD_JSDOC_ANNOTATION",
"JSC_TYPE_PARSE_ERROR",
"JSC_MISPLACED_MSG_ANNOTATION",
],
deps = [
"//lib/polymer_externs:polymer_closure",
@ -50,8 +49,11 @@ closure_js_binary(
# Known issue: Closure compilation not compatible with Polymer behaviors.
# See: https://github.com/google/closure-compiler/issues/2042
compilation_level = "WHITESPACE_ONLY",
defs = ["--polymer_pass"],
language = "ECMASCRIPT3",
defs = [
"--polymer_pass",
"--jscomp_off=duplicate",
],
language = "ECMASCRIPT5_STRICT",
deps = [":closure_lib"],
)

View File

@ -1095,16 +1095,16 @@
},
/**
* @desc get the line height of an element to the nearest integer.
* */
* Get the line height of an element to the nearest integer.
*/
_getLineHeight: function(element) {
var lineHeightStr = getComputedStyle(element).lineHeight;
return Math.round(lineHeightStr.slice(0, lineHeightStr.length - 2));
},
/**
* @desc new max height for the related changes section, shorter than
* the existing change info height.
* New max height for the related changes section, shorter than the existing
* change info height.
*/
_updateRelatedChangeMaxHeight: function() {
// Takes into account approximate height for the expand button and

View File

@ -65,8 +65,8 @@
* Performs a synchronous in-order traversal from top to bottom of the node
* element, counting the length of the syntax until child is found.
*
* @param {!Element} The root DOM element to be searched through.
* @param {!Element} The child element being searched for.
* @param {!Element} node The root DOM element to be searched through.
* @param {!Element} child The child element being searched for.
* @return {number}
*/
_getTextOffset: function(node, child) {

View File

@ -191,7 +191,7 @@
* Query the diff object for the lines from a particular side.
*
* @param {!string} side The side that is currently selected.
* @return {string[]} An array of strings indexed by line number.
* @return {Array.string} An array of strings indexed by line number.
*/
_getDiffLines: function(side) {
if (this._linesCache[side]) {

View File

@ -481,7 +481,7 @@
* If the URL hash is a diff address then configure the diff cursor.
*/
_loadHash: function(hash) {
var hash = hash.replace(/^#/, '');
hash = hash.replace(/^#/, '');
if (!HASH_PATTERN.test(hash)) { return; }
if (hash[0] === 'a' || hash[0] === 'b') {
this.$.cursor.side = DiffSides.LEFT;

View File

@ -172,7 +172,7 @@
var ranges = this.get(['_commentMap', side, lineNum]) || [];
return ranges
.map(function(range) {
var range = {
range = {
start: range.start,
end: range.end === -1 ? line.text.length : range.end,
hovering: !!range.comment.__hovering,