diff --git a/package.json b/package.json index 0a6e68f54e..0e2cd7c4ff 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,8 @@ "clean-css": "3.4.9", "coveralls": "2.11.6", "debounce": "^1.0.0", - "eslint": "v2.0.0-alpha-2", - "eslint-config-openlayers": "^1.0.0", + "eslint": "git://github.com/eslint/eslint.git#4356532469ec1b9d4977aff05a03c3e167922ffa", + "eslint-config-openlayers": "^2.0.0", "expect.js": "0.3.1", "gaze": "^0.5.1", "istanbul": "0.4.1", @@ -83,7 +83,9 @@ "proj4": false }, "rules": { - "no-multiple-empty-lines": [2, {"max": 3, "maxEOF": 1}] + "no-constant-condition": 0, + "no-multiple-empty-lines": [2, {"max": 3, "maxEOF": 1}], + "indent": 0 } }, "ext": [ diff --git a/src/ol/centerconstraint.js b/src/ol/centerconstraint.js index b02dd21fa4..e1d1a9705a 100644 --- a/src/ol/centerconstraint.js +++ b/src/ol/centerconstraint.js @@ -12,7 +12,7 @@ ol.CenterConstraintType; /** * @param {ol.Extent} extent Extent. - * @return {ol.CenterConstraintType} + * @return {ol.CenterConstraintType} The constraint. */ ol.CenterConstraint.createExtent = function(extent) { return ( diff --git a/src/ol/dom/dom.js b/src/ol/dom/dom.js index 1fa51ed61b..2ce721b6de 100644 --- a/src/ol/dom/dom.js +++ b/src/ol/dom/dom.js @@ -14,7 +14,7 @@ goog.require('ol'); * Create an html canvas element and returns its 2d context. * @param {number=} opt_width Canvas width. * @param {number=} opt_height Canvas height. - * @return {CanvasRenderingContext2D} + * @return {CanvasRenderingContext2D} The context. */ ol.dom.createCanvasContext2D = function(opt_width, opt_height) { var canvas = document.createElement('CANVAS'); @@ -196,7 +196,7 @@ ol.dom.transformElement2D = function(element, transform, opt_precision) { * padding and border. * Equivalent to jQuery's `$(el).outerWidth(true)`. * @param {!Element} element Element. - * @return {number} + * @return {number} The width. */ ol.dom.outerWidth = function(element) { var width = element.offsetWidth; @@ -212,7 +212,7 @@ ol.dom.outerWidth = function(element) { * padding and border. * Equivalent to jQuery's `$(el).outerHeight(true)`. * @param {!Element} element Element. - * @return {number} + * @return {number} The height. */ ol.dom.outerHeight = function(element) { var height = element.offsetHeight; diff --git a/src/ol/geom/flat/flipflatgeom.js b/src/ol/geom/flat/flipflatgeom.js index 5808999797..565ed49e77 100644 --- a/src/ol/geom/flat/flipflatgeom.js +++ b/src/ol/geom/flat/flipflatgeom.js @@ -24,12 +24,12 @@ ol.geom.flat.flip.flipXY = dest = []; destOffset = 0; } - var j, k; - for (j = offset; j < end; ) { + var j = offset; + while (j < end) { var x = flatCoordinates[j++]; dest[destOffset++] = flatCoordinates[j++]; dest[destOffset++] = x; - for (k = 2; k < stride; ++k) { + for (var k = 2; k < stride; ++k) { dest[destOffset++] = flatCoordinates[j++]; } } diff --git a/src/ol/pointer/touchsource.js b/src/ol/pointer/touchsource.js index 33a62bca4f..b400b9e733 100644 --- a/src/ol/pointer/touchsource.js +++ b/src/ol/pointer/touchsource.js @@ -40,8 +40,8 @@ goog.require('ol.pointer.MouseSource'); /** * @constructor - * @param {ol.pointer.PointerEventHandler} dispatcher - * @param {ol.pointer.MouseSource} mouseSource + * @param {ol.pointer.PointerEventHandler} dispatcher The event handler. + * @param {ol.pointer.MouseSource} mouseSource Mouse source. * @extends {ol.pointer.EventSource} */ ol.pointer.TouchSource = function(dispatcher, mouseSource) { @@ -111,7 +111,7 @@ ol.pointer.TouchSource.POINTER_TYPE = 'touch'; /** * @private - * @param {Touch} inTouch + * @param {Touch} inTouch The in touch. * @return {boolean} True, if this is the primary touch. */ ol.pointer.TouchSource.prototype.isPrimaryTouch_ = function(inTouch) { @@ -121,7 +121,7 @@ ol.pointer.TouchSource.prototype.isPrimaryTouch_ = function(inTouch) { /** * Set primary touch if there are no pointers, or the only pointer is the mouse. - * @param {Touch} inTouch + * @param {Touch} inTouch The in touch. * @private */ ol.pointer.TouchSource.prototype.setPrimaryTouch_ = function(inTouch) { @@ -136,7 +136,7 @@ ol.pointer.TouchSource.prototype.setPrimaryTouch_ = function(inTouch) { /** * @private - * @param {Object} inPointer + * @param {Object} inPointer The in pointer object. */ ol.pointer.TouchSource.prototype.removePrimaryPointer_ = function(inPointer) { if (inPointer.isPrimary) { @@ -237,8 +237,8 @@ ol.pointer.TouchSource.prototype.processTouches_ = /** * @private - * @param {TouchList} touchList - * @param {number} searchId + * @param {TouchList} touchList The touch list. + * @param {number} searchId Search identifier. * @return {boolean} True, if the `Touch` with the given id is in the list. */ ol.pointer.TouchSource.prototype.findTouch_ = function(touchList, searchId) { @@ -263,7 +263,7 @@ ol.pointer.TouchSource.prototype.findTouch_ = function(touchList, searchId) { * this "abandoned" touch * * @private - * @param {goog.events.BrowserEvent} inEvent + * @param {goog.events.BrowserEvent} inEvent The in event. */ ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) { var touchList = inEvent.getBrowserEvent().touches; @@ -296,7 +296,7 @@ ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) { * Handler for `touchstart`, triggers `pointerover`, * `pointerenter` and `pointerdown` events. * - * @param {goog.events.BrowserEvent} inEvent + * @param {goog.events.BrowserEvent} inEvent The in event. */ ol.pointer.TouchSource.prototype.touchstart = function(inEvent) { this.vacuumTouches_(inEvent); @@ -309,8 +309,8 @@ ol.pointer.TouchSource.prototype.touchstart = function(inEvent) { /** * @private - * @param {goog.events.BrowserEvent} browserEvent - * @param {Object} inPointer + * @param {goog.events.BrowserEvent} browserEvent The event. + * @param {Object} inPointer The in pointer object. */ ol.pointer.TouchSource.prototype.overDown_ = function(browserEvent, inPointer) { this.pointerMap[inPointer.pointerId] = { @@ -327,7 +327,7 @@ ol.pointer.TouchSource.prototype.overDown_ = function(browserEvent, inPointer) { /** * Handler for `touchmove`. * - * @param {goog.events.BrowserEvent} inEvent + * @param {goog.events.BrowserEvent} inEvent The in event. */ ol.pointer.TouchSource.prototype.touchmove = function(inEvent) { inEvent.preventDefault(); @@ -375,7 +375,7 @@ ol.pointer.TouchSource.prototype.moveOverOut_ = * Handler for `touchend`, triggers `pointerup`, * `pointerout` and `pointerleave` events. * - * @param {goog.events.BrowserEvent} inEvent + * @param {goog.events.BrowserEvent} inEvent The event. */ ol.pointer.TouchSource.prototype.touchend = function(inEvent) { this.dedupSynthMouse_(inEvent); @@ -385,8 +385,8 @@ ol.pointer.TouchSource.prototype.touchend = function(inEvent) { /** * @private - * @param {goog.events.BrowserEvent} browserEvent - * @param {Object} inPointer + * @param {goog.events.BrowserEvent} browserEvent An event. + * @param {Object} inPointer The inPointer object. */ ol.pointer.TouchSource.prototype.upOut_ = function(browserEvent, inPointer) { this.dispatcher.up(inPointer, browserEvent); @@ -400,7 +400,7 @@ ol.pointer.TouchSource.prototype.upOut_ = function(browserEvent, inPointer) { * Handler for `touchcancel`, triggers `pointercancel`, * `pointerout` and `pointerleave` events. * - * @param {goog.events.BrowserEvent} inEvent + * @param {goog.events.BrowserEvent} inEvent The in event. */ ol.pointer.TouchSource.prototype.touchcancel = function(inEvent) { this.processTouches_(inEvent, this.cancelOut_); @@ -423,7 +423,7 @@ ol.pointer.TouchSource.prototype.cancelOut_ = /** * @private - * @param {Object} inPointer + * @param {Object} inPointer The inPointer object. */ ol.pointer.TouchSource.prototype.cleanUpPointer_ = function(inPointer) { delete this.pointerMap[inPointer.pointerId]; @@ -435,7 +435,7 @@ ol.pointer.TouchSource.prototype.cleanUpPointer_ = function(inPointer) { * Prevent synth mouse events from creating pointer events. * * @private - * @param {goog.events.BrowserEvent} inEvent + * @param {goog.events.BrowserEvent} inEvent The in event. */ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) { var lts = this.mouseSource.lastTouches; diff --git a/src/ol/render/ireplay.js b/src/ol/render/ireplay.js index 6d1048a043..46cdfd560c 100644 --- a/src/ol/render/ireplay.js +++ b/src/ol/render/ireplay.js @@ -34,6 +34,11 @@ ol.render.IReplayGroup = function() { }; +/* eslint-disable valid-jsdoc */ +// TODO: enable valid-jsdoc for @interface methods when this issue is resolved +// https://github.com/eslint/eslint/issues/4887 + + /** * @param {number|undefined} zIndex Z index. * @param {ol.render.ReplayType} replayType Replay type. diff --git a/src/ol/renderer/maprenderer.js b/src/ol/renderer/maprenderer.js index 68efff4bb2..2ab6e1d422 100644 --- a/src/ol/renderer/maprenderer.js +++ b/src/ol/renderer/maprenderer.js @@ -382,9 +382,9 @@ ol.renderer.Map.prototype.scheduleRemoveUnusedLayerRenderers = /** - * @param {ol.layer.LayerState} state1 - * @param {ol.layer.LayerState} state2 - * @return {number} + * @param {ol.layer.LayerState} state1 First layer state. + * @param {ol.layer.LayerState} state2 Second layer state. + * @return {number} The zIndex difference. */ ol.renderer.Map.sortByZIndex = function(state1, state2) { return state1.zIndex - state2.zIndex; diff --git a/src/ol/renderer/webgl/webglmaprenderer.js b/src/ol/renderer/webgl/webglmaprenderer.js index 7ee45244cf..3d884fd6d2 100644 --- a/src/ol/renderer/webgl/webglmaprenderer.js +++ b/src/ol/renderer/webgl/webglmaprenderer.js @@ -344,7 +344,7 @@ ol.renderer.webgl.Map.prototype.expireCache_ = function(map, frameState) { /** - * @return {ol.webgl.Context} + * @return {ol.webgl.Context} The context. */ ol.renderer.webgl.Map.prototype.getContext = function() { return this.context_; diff --git a/src/ol/reproj/triangulation.js b/src/ol/reproj/triangulation.js index 571c676c6a..ab988e2648 100644 --- a/src/ol/reproj/triangulation.js +++ b/src/ol/reproj/triangulation.js @@ -48,8 +48,8 @@ ol.reproj.Triangulation = function(sourceProj, targetProj, targetExtent, var transformInv = ol.proj.getTransform(this.targetProj_, this.sourceProj_); /** - * @param {ol.Coordinate} c - * @return {ol.Coordinate} + * @param {ol.Coordinate} c A coordinate. + * @return {ol.Coordinate} Transformed coordinate. * @private */ this.transformInv_ = function(c) { @@ -173,12 +173,12 @@ ol.reproj.Triangulation = function(sourceProj, targetProj, targetExtent, /** * Adds triangle to the triangulation. - * @param {ol.Coordinate} a - * @param {ol.Coordinate} b - * @param {ol.Coordinate} c - * @param {ol.Coordinate} aSrc - * @param {ol.Coordinate} bSrc - * @param {ol.Coordinate} cSrc + * @param {ol.Coordinate} a The target a coordinate. + * @param {ol.Coordinate} b The target b coordinate. + * @param {ol.Coordinate} c The target c coordinate. + * @param {ol.Coordinate} aSrc The source a coordinate. + * @param {ol.Coordinate} bSrc The source b coordinate. + * @param {ol.Coordinate} cSrc The source c coordinate. * @private */ ol.reproj.Triangulation.prototype.addTriangle_ = function(a, b, c, @@ -195,14 +195,14 @@ ol.reproj.Triangulation.prototype.addTriangle_ = function(a, b, c, * (and reprojects the vertices) if valid. * Performs quad subdivision if needed to increase precision. * - * @param {ol.Coordinate} a - * @param {ol.Coordinate} b - * @param {ol.Coordinate} c - * @param {ol.Coordinate} d - * @param {ol.Coordinate} aSrc - * @param {ol.Coordinate} bSrc - * @param {ol.Coordinate} cSrc - * @param {ol.Coordinate} dSrc + * @param {ol.Coordinate} a The target a coordinate. + * @param {ol.Coordinate} b The target b coordinate. + * @param {ol.Coordinate} c The target c coordinate. + * @param {ol.Coordinate} d The target d coordinate. + * @param {ol.Coordinate} aSrc The source a coordinate. + * @param {ol.Coordinate} bSrc The source b coordinate. + * @param {ol.Coordinate} cSrc The source c coordinate. + * @param {ol.Coordinate} dSrc The source d coordinate. * @param {number} maxSubdivision Maximal allowed subdivision of the quad. * @private */ diff --git a/src/ol/size.js b/src/ol/size.js index 876df0dc1f..2dba83bb72 100644 --- a/src/ol/size.js +++ b/src/ol/size.js @@ -18,7 +18,7 @@ ol.Size; * @param {ol.Size} size Size. * @param {number} buffer Buffer. * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} + * @return {ol.Size} The buffered size. */ ol.size.buffer = function(size, buffer, opt_size) { if (opt_size === undefined) { @@ -56,7 +56,7 @@ ol.size.hasArea = function(size) { * @param {ol.Size} size Size. * @param {number} ratio Ratio. * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} + * @return {ol.Size} The scaled size. */ ol.size.scale = function(size, ratio, opt_size) { if (opt_size === undefined) { diff --git a/src/ol/source/clustersource.js b/src/ol/source/clustersource.js index 9fdc5f4326..e4d19dfff5 100644 --- a/src/ol/source/clustersource.js +++ b/src/ol/source/clustersource.js @@ -19,7 +19,7 @@ goog.require('ol.source.Vector'); * Layer source to cluster vector data. * * @constructor - * @param {olx.source.ClusterOptions} options + * @param {olx.source.ClusterOptions} options Constructor options. * @extends {ol.source.Vector} * @api */ @@ -148,7 +148,7 @@ ol.source.Cluster.prototype.cluster_ = function() { /** * @param {Array.