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
+20 -20
View File
@@ -11,7 +11,7 @@ describe('ol.geom.Point', function() {
describe('construct with 2D coordinates', function() {
var point;
let point;
beforeEach(function() {
point = new Point([1, 2]);
});
@@ -48,7 +48,7 @@ describe('ol.geom.Point', function() {
describe('construct with 3D coordinates and layout XYM', function() {
var point;
let point;
beforeEach(function() {
point = new Point([1, 2, 3], 'XYM');
});
@@ -85,7 +85,7 @@ describe('ol.geom.Point', function() {
describe('construct with 4D coordinates', function() {
var point;
let point;
beforeEach(function() {
point = new Point([1, 2, 3, 4]);
});
@@ -121,7 +121,7 @@ describe('ol.geom.Point', function() {
describe('#getClosestPoint', function() {
it('preseves extra dimensions', function() {
var closestPoint = point.getClosestPoint([0, 0]);
const closestPoint = point.getClosestPoint([0, 0]);
expect(closestPoint).to.eql([1, 2, 3, 4]);
});
@@ -132,23 +132,23 @@ describe('ol.geom.Point', function() {
describe('#scale()', function() {
it('scales a point', function() {
var geom = new Point([1, 2]);
const geom = new Point([1, 2]);
geom.scale(10e6);
var coordinates = geom.getCoordinates();
const coordinates = geom.getCoordinates();
expect(coordinates).to.eql([1, 2]);
});
it('accepts sx and sy', function() {
var geom = new Point([1, 2]);
const geom = new Point([1, 2]);
geom.scale(1e6, -42);
var coordinates = geom.getCoordinates();
const coordinates = geom.getCoordinates();
expect(coordinates).to.eql([1, 2]);
});
it('accepts an anchor', function() {
var geom = new Point([1, 2]);
const geom = new Point([1, 2]);
geom.scale(10, 15, [0, 0]);
var coordinates = geom.getCoordinates();
const coordinates = geom.getCoordinates();
expect(coordinates).to.eql([10, 30]);
});
@@ -156,7 +156,7 @@ describe('ol.geom.Point', function() {
describe('#applyTransform()', function() {
var point, transform;
let point, transform;
beforeEach(function() {
point = new Point([1, 2]);
transform = sinon.spy();
@@ -165,7 +165,7 @@ describe('ol.geom.Point', function() {
it('calls a transform function', function() {
point.applyTransform(transform);
expect(transform.calledOnce).to.be(true);
var args = transform.firstCall.args;
const args = transform.firstCall.args;
expect(args).to.have.length(3);
expect(args[0]).to.be(point.getFlatCoordinates()); // input coords
@@ -174,8 +174,8 @@ describe('ol.geom.Point', function() {
});
it('allows for modification of coordinates', function() {
var mod = function(input, output, dimension) {
var copy = input.slice();
const mod = function(input, output, dimension) {
const copy = input.slice();
output[1] = copy[0];
output[0] = copy[1];
};
@@ -184,7 +184,7 @@ describe('ol.geom.Point', function() {
});
it('returns undefined', function() {
var got = point.applyTransform(transform);
const got = point.applyTransform(transform);
expect(got).to.be(undefined);
});
@@ -193,21 +193,21 @@ describe('ol.geom.Point', function() {
describe('#transform()', function() {
it('transforms a geometry given CRS identifiers', function() {
var point = new Point([-111, 45]).transform(
'EPSG:4326', 'EPSG:3857');
const point = new Point([-111, 45]).transform(
'EPSG:4326', 'EPSG:3857');
expect(point).to.be.a(Point);
var coords = point.getCoordinates();
const coords = point.getCoordinates();
expect(coords[0]).to.roughlyEqual(-12356463.47, 1e-2);
expect(coords[1]).to.roughlyEqual(5621521.48, 1e-2);
});
it('modifies the original', function() {
var point = new Point([-111, 45]);
const point = new Point([-111, 45]);
point.transform('EPSG:4326', 'EPSG:3857');
var coords = point.getCoordinates();
const coords = point.getCoordinates();
expect(coords[0]).to.roughlyEqual(-12356463.47, 1e-2);
expect(coords[1]).to.roughlyEqual(5621521.48, 1e-2);