Use blocked scoped variables

In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
Tim Schaub
2018-01-11 23:32:36 -07:00
parent 0bf2b04dee
commit ad62739a6e
684 changed files with 18120 additions and 18184 deletions
+9 -9
View File
@@ -10,14 +10,14 @@ import Fill from '../src/ol/style/Fill.js';
import Stroke from '../src/ol/style/Stroke.js';
import Style from '../src/ol/style/Style.js';
var raster = new TileLayer({
const raster = new TileLayer({
source: new BingMaps({
imagerySet: 'Aerial',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
});
var style = {
const style = {
'Point': new Style({
image: new CircleStyle({
fill: new Fill({
@@ -44,7 +44,7 @@ var style = {
})
};
var vector = new VectorLayer({
const vector = new VectorLayer({
source: new VectorSource({
url: 'data/gpx/fells_loop.gpx',
format: new GPX()
@@ -54,7 +54,7 @@ var vector = new VectorLayer({
}
});
var map = new Map({
const map = new Map({
layers: [raster, vector],
target: document.getElementById('map'),
view: new View({
@@ -63,14 +63,14 @@ var map = new Map({
})
});
var displayFeatureInfo = function(pixel) {
var features = [];
const displayFeatureInfo = function(pixel) {
const features = [];
map.forEachFeatureAtPixel(pixel, function(feature) {
features.push(feature);
});
if (features.length > 0) {
var info = [];
var i, ii;
const info = [];
let i, ii;
for (i = 0, ii = features.length; i < ii; ++i) {
info.push(features[i].get('desc'));
}
@@ -86,7 +86,7 @@ map.on('pointermove', function(evt) {
if (evt.dragging) {
return;
}
var pixel = map.getEventPixel(evt.originalEvent);
const pixel = map.getEventPixel(evt.originalEvent);
displayFeatureInfo(pixel);
});