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
+33 -33
View File
@@ -13,7 +13,7 @@ describe('ol.reproj.Tile', function() {
'+towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 ' +
'+units=m +no_defs');
register(proj4);
var proj27700 = getProjection('EPSG:27700');
const proj27700 = getProjection('EPSG:27700');
proj27700.setExtent([0, 0, 700000, 1300000]);
});
@@ -25,23 +25,23 @@ describe('ol.reproj.Tile', function() {
function createTile(pixelRatio, opt_tileSize) {
var proj4326 = getProjection('EPSG:4326');
var proj3857 = getProjection('EPSG:3857');
const proj4326 = getProjection('EPSG:4326');
const proj3857 = getProjection('EPSG:3857');
return new ReprojTile(
proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326,
_ol_tilegrid_.createForProjection(proj4326, 3, opt_tileSize),
[3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) {
return new ImageTile([z, x, y], 0, // IDLE
'data:image/gif;base64,' +
proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326,
_ol_tilegrid_.createForProjection(proj4326, 3, opt_tileSize),
[3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) {
return new ImageTile([z, x, y], 0, // IDLE
'data:image/gif;base64,' +
'R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=', null,
function(tile, src) {
tile.getImage().src = src;
});
});
function(tile, src) {
tile.getImage().src = src;
});
});
}
it('changes state as expected', function(done) {
var tile = createTile(1);
const tile = createTile(1);
expect(tile.getState()).to.be(0); // IDLE
_ol_events_.listen(tile, 'change', function() {
if (tile.getState() == 2) { // LOADED
@@ -52,34 +52,34 @@ describe('ol.reproj.Tile', function() {
});
it('is empty when outside target tile grid', function() {
var proj4326 = getProjection('EPSG:4326');
var proj3857 = getProjection('EPSG:3857');
var tile = new ReprojTile(
proj3857, _ol_tilegrid_.createForProjection(proj3857),
proj4326, _ol_tilegrid_.createForProjection(proj4326),
[0, -1, 0], null, 1, 0, function() {
expect().fail('No tiles should be required');
});
const proj4326 = getProjection('EPSG:4326');
const proj3857 = getProjection('EPSG:3857');
const tile = new ReprojTile(
proj3857, _ol_tilegrid_.createForProjection(proj3857),
proj4326, _ol_tilegrid_.createForProjection(proj4326),
[0, -1, 0], null, 1, 0, function() {
expect().fail('No tiles should be required');
});
expect(tile.getState()).to.be(4); // EMPTY
});
it('is empty when outside source tile grid', function() {
var proj4326 = getProjection('EPSG:4326');
var proj27700 = getProjection('EPSG:27700');
var tile = new ReprojTile(
proj27700, _ol_tilegrid_.createForProjection(proj27700),
proj4326, _ol_tilegrid_.createForProjection(proj4326),
[3, 2, -2], null, 1, 0, function() {
expect().fail('No tiles should be required');
});
const proj4326 = getProjection('EPSG:4326');
const proj27700 = getProjection('EPSG:27700');
const tile = new ReprojTile(
proj27700, _ol_tilegrid_.createForProjection(proj27700),
proj4326, _ol_tilegrid_.createForProjection(proj4326),
[3, 2, -2], null, 1, 0, function() {
expect().fail('No tiles should be required');
});
expect(tile.getState()).to.be(4); // EMPTY
});
it('respects tile size of target tile grid', function(done) {
var tile = createTile(1, [100, 40]);
const tile = createTile(1, [100, 40]);
_ol_events_.listen(tile, 'change', function() {
if (tile.getState() == 2) { // LOADED
var canvas = tile.getImage();
const canvas = tile.getImage();
expect(canvas.width).to.be(100);
expect(canvas.height).to.be(40);
done();
@@ -89,10 +89,10 @@ describe('ol.reproj.Tile', function() {
});
it('respects pixelRatio', function(done) {
var tile = createTile(3, [60, 20]);
const tile = createTile(3, [60, 20]);
_ol_events_.listen(tile, 'change', function() {
if (tile.getState() == 2) { // LOADED
var canvas = tile.getImage();
const canvas = tile.getImage();
expect(canvas.width).to.be(180);
expect(canvas.height).to.be(60);
done();