From 9f23e96976bef0908e057d3fcb970d639cb1f228 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 7 Aug 2016 13:05:36 -0600 Subject: [PATCH 1/3] Avoid shadowing ESLint config in package.json --- .eslintrc | 6 ------ package.json | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 65380bf587..0000000000 --- a/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extend": "openlayers", - "rules": { - "no-console": [2, {"allow": ["assert"]}] - } -} diff --git a/package.json b/package.json index 86870e097b..b5457a50c8 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "proj4": false }, "rules": { + "no-console": [2, {"allow": ["assert"]}], "no-constant-condition": 0 } }, From 4373f1bd546d5407234c46d43cbbf202882b4856 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 7 Aug 2016 13:15:22 -0600 Subject: [PATCH 2/3] Run ESLint on all files (catch new linter changes) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b0b4bf4149..88cbde959b 100644 --- a/Makefile +++ b/Makefile @@ -256,7 +256,7 @@ build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \ build/timestamps/node-modules-timestamp @mkdir -p $(@D) @echo "Running eslint..." - @./node_modules/.bin/eslint $? + @./node_modules/.bin/eslint tasks test test_rendering src examples @touch $@ build/timestamps/node-modules-timestamp: package.json From feb7713225f20bc10a7e2e26fc5a226c8c9fd378 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 7 Aug 2016 13:28:19 -0600 Subject: [PATCH 3/3] Remove lint --- src/ol/control/overviewmap.js | 2 -- src/ol/format/esrijson.js | 4 +++- src/ol/format/gml3.js | 2 -- src/ol/interaction/modify.js | 1 - src/ol/math.js | 1 - src/ol/renderer/dom/vectorlayer.js | 3 --- test/node/.eslintrc | 3 ++- test/node/one-provide.js | 2 +- test/spec/ol/format/wfs.test.js | 2 +- test/spec/ol/ol.test.js | 2 +- test/spec/ol/structs/priorityqueue.test.js | 2 +- 11 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/ol/control/overviewmap.js b/src/ol/control/overviewmap.js index f72771f6aa..874021aff2 100644 --- a/src/ol/control/overviewmap.js +++ b/src/ol/control/overviewmap.js @@ -371,8 +371,6 @@ ol.control.OverviewMap.prototype.updateBox_ = function() { var ovview = ovmap.getView(); - var ovmapSize = ovmap.getSize(); - var rotation = view.getRotation(); var overlay = this.boxOverlay_; diff --git a/src/ol/format/esrijson.js b/src/ol/format/esrijson.js index 6e006d2ba8..b183f80b12 100644 --- a/src/ol/format/esrijson.js +++ b/src/ol/format/esrijson.js @@ -315,7 +315,9 @@ ol.format.EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) { return /** @type {EsriJSONPolyline} */ ({ hasZ: hasZM.hasZ, hasM: hasZM.hasM, - paths: [/** @type {ol.geom.LineString} */ (geometry).getCoordinates()] + paths: [ + /** @type {ol.geom.LineString} */ (geometry).getCoordinates() + ] }); }; diff --git a/src/ol/format/gml3.js b/src/ol/format/gml3.js index 8615f09383..fb8f687e4a 100644 --- a/src/ol/format/gml3.js +++ b/src/ol/format/gml3.js @@ -911,7 +911,6 @@ ol.format.GML3.prototype.writeRing_ = function(node, ring, objectStack) { * @private */ ol.format.GML3.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { - var context = objectStack[objectStack.length - 1]; var child = this.GEOMETRY_NODE_FACTORY_( polygon, objectStack); if (child) { @@ -941,7 +940,6 @@ ol.format.GML3.prototype.writePointMember_ = function(node, point, objectStack) * @private */ ol.format.GML3.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) { - var context = objectStack[objectStack.length - 1]; var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); if (child) { node.appendChild(child); diff --git a/src/ol/interaction/modify.js b/src/ol/interaction/modify.js index c934d14c08..e75cce885c 100644 --- a/src/ol/interaction/modify.js +++ b/src/ol/interaction/modify.js @@ -709,7 +709,6 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) { if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) { if (mapBrowserEvent.type != ol.MapBrowserEvent.EventType.SINGLECLICK || !this.ignoreNextSingleClick_) { - var geometry = /** @type {ol.geom.Point} */ (this.vertexFeature_.getGeometry()); handled = this.removePoint(); } else { handled = true; diff --git a/src/ol/math.js b/src/ol/math.js index cd1e3dfd57..96892c6818 100644 --- a/src/ol/math.js +++ b/src/ol/math.js @@ -1,7 +1,6 @@ goog.provide('ol.math'); - /** * Takes a number and clamps it to within the provided bounds. * @param {number} value The input number. diff --git a/src/ol/renderer/dom/vectorlayer.js b/src/ol/renderer/dom/vectorlayer.js index ae70e64efb..70ac946023 100644 --- a/src/ol/renderer/dom/vectorlayer.js +++ b/src/ol/renderer/dom/vectorlayer.js @@ -103,9 +103,6 @@ ol.renderer.dom.VectorLayer.prototype.clearFrame = function() { * @inheritDoc */ ol.renderer.dom.VectorLayer.prototype.composeFrame = function(frameState, layerState) { - - var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer()); - var viewState = frameState.viewState; var viewCenter = viewState.center; var viewRotation = viewState.rotation; diff --git a/test/node/.eslintrc b/test/node/.eslintrc index 22abc7fb2b..60b5f72125 100644 --- a/test/node/.eslintrc +++ b/test/node/.eslintrc @@ -1,5 +1,6 @@ { "env": { - "es6": true + "es6": true, + "mocha": true } } diff --git a/test/node/one-provide.js b/test/node/one-provide.js index 22cad85a3a..9205746ca6 100644 --- a/test/node/one-provide.js +++ b/test/node/one-provide.js @@ -5,7 +5,7 @@ const path = require('path'); const src = path.join(__dirname, '..', '..', 'src'); -const PROVIDE_RE = /^goog.provide\('(.*)'\);/ +const PROVIDE_RE = /^goog.provide\('(.*)'\);/; describe('each file', () => { diff --git a/test/spec/ol/format/wfs.test.js b/test/spec/ol/format/wfs.test.js index 5c8d91a422..7a0b34d272 100644 --- a/test/spec/ol/format/wfs.test.js +++ b/test/spec/ol/format/wfs.test.js @@ -672,7 +672,7 @@ describe('ol.format.WFS', function() { [-12240318, 6507071], [-12416429, 6604910] ]])); - var error = false; + expect(function() { format.writeTransaction(null, [updateFeature], null, { featureNS: 'http://foo', diff --git a/test/spec/ol/ol.test.js b/test/spec/ol/ol.test.js index ebb8f50b68..56b8faa6c6 100644 --- a/test/spec/ol/ol.test.js +++ b/test/spec/ol/ol.test.js @@ -29,7 +29,7 @@ describe('ol', function() { it('has a name', function() { var error = new ol.AssertionError(42); expect(error.name).to.be('AssertionError'); - }) + }); }); }); diff --git a/test/spec/ol/structs/priorityqueue.test.js b/test/spec/ol/structs/priorityqueue.test.js index f969b8b7b9..a1e12ecdcd 100644 --- a/test/spec/ol/structs/priorityqueue.test.js +++ b/test/spec/ol/structs/priorityqueue.test.js @@ -16,7 +16,7 @@ describe('ol.structs.PriorityQueue', function() { if (!assertion) { throw new Error(message); } - } + }; pq = new ol.structs.PriorityQueue( identity, identity); });