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
+30 -30
View File
@@ -6,35 +6,35 @@ describe('ol.geom.flat.orient', function() {
describe('ol.geom.flat.orient.linearRingIsClockwise()', function() {
it('identifies clockwise rings', function() {
var flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0];
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
flatCoordinates, 0, flatCoordinates.length, 2);
const flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0];
const isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
flatCoordinates, 0, flatCoordinates.length, 2);
expect(isClockwise).to.be(true);
});
it('identifies anti-clockwise rings', function() {
var flatCoordinates = [2, 2, 3, 2, 3, 3, 2, 3];
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
flatCoordinates, 0, flatCoordinates.length, 2);
const flatCoordinates = [2, 2, 3, 2, 3, 3, 2, 3];
const isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
flatCoordinates, 0, flatCoordinates.length, 2);
expect(isClockwise).to.be(false);
});
});
describe('ol.geom.flat.orient.linearRingsAreOriented()', function() {
var oriented = _ol_geom_flat_orient_.linearRingsAreOriented;
const oriented = _ol_geom_flat_orient_.linearRingsAreOriented;
var rightCoords = [
const rightCoords = [
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
-100, -45, -100, 45, 100, 45, 100, -45, -100, -45
];
var leftCoords = [
const leftCoords = [
-180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
-100, -45, 100, -45, 100, 45, -100, 45, -100, -45
];
var ends = [10, 20];
const ends = [10, 20];
it('checks for left-hand orientation by default', function() {
expect(oriented(rightCoords, 0, ends, 2)).to.be(false);
@@ -49,23 +49,23 @@ describe('ol.geom.flat.orient', function() {
});
describe('ol.geom.flat.orient.linearRingssAreOriented()', function() {
var oriented = _ol_geom_flat_orient_.linearRingssAreOriented;
const oriented = _ol_geom_flat_orient_.linearRingssAreOriented;
var rightCoords = [
const rightCoords = [
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
-100, -45, -100, 45, 100, 45, 100, -45, -100, -45,
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
-100, -45, -100, 45, 100, 45, 100, -45, -100, -45
];
var leftCoords = [
const leftCoords = [
-180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
-100, -45, 100, -45, 100, 45, -100, 45, -100, -45,
-180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
-100, -45, 100, -45, 100, 45, -100, 45, -100, -45
];
var ends = [[10, 20], [30, 40]];
const ends = [[10, 20], [30, 40]];
it('checks for left-hand orientation by default', function() {
expect(oriented(rightCoords, 0, ends, 2)).to.be(false);
@@ -80,36 +80,36 @@ describe('ol.geom.flat.orient', function() {
});
describe('ol.geom.flat.orient.orientLinearRings()', function() {
var orient = _ol_geom_flat_orient_.orientLinearRings;
const orient = _ol_geom_flat_orient_.orientLinearRings;
var rightCoords = [
const rightCoords = [
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
-100, -45, -100, 45, 100, 45, 100, -45, -100, -45
];
var leftCoords = [
const leftCoords = [
-180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
-100, -45, 100, -45, 100, 45, -100, 45, -100, -45
];
var ends = [10, 20];
const ends = [10, 20];
it('orients using the left-hand rule by default', function() {
var rightClone = rightCoords.slice();
const rightClone = rightCoords.slice();
orient(rightClone, 0, ends, 2);
expect(rightClone).to.eql(leftCoords);
var leftClone = leftCoords.slice();
const leftClone = leftCoords.slice();
orient(leftClone, 0, ends, 2);
expect(leftClone).to.eql(leftCoords);
});
it('can orient using the right-hand rule', function() {
var rightClone = rightCoords.slice();
const rightClone = rightCoords.slice();
orient(rightClone, 0, ends, 2, true);
expect(rightClone).to.eql(rightCoords);
var leftClone = leftCoords.slice();
const leftClone = leftCoords.slice();
orient(leftClone, 0, ends, 2, true);
expect(leftClone).to.eql(rightCoords);
});
@@ -117,40 +117,40 @@ describe('ol.geom.flat.orient', function() {
});
describe('ol.geom.flat.orient.orientLinearRingss()', function() {
var orient = _ol_geom_flat_orient_.orientLinearRingss;
const orient = _ol_geom_flat_orient_.orientLinearRingss;
var rightCoords = [
const rightCoords = [
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
-100, -45, -100, 45, 100, 45, 100, -45, -100, -45,
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
-100, -45, -100, 45, 100, 45, 100, -45, -100, -45
];
var leftCoords = [
const leftCoords = [
-180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
-100, -45, 100, -45, 100, 45, -100, 45, -100, -45,
-180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
-100, -45, 100, -45, 100, 45, -100, 45, -100, -45
];
var ends = [[10, 20], [30, 40]];
const ends = [[10, 20], [30, 40]];
it('orients using the left-hand rule by default', function() {
var rightClone = rightCoords.slice();
const rightClone = rightCoords.slice();
orient(rightClone, 0, ends, 2);
expect(rightClone).to.eql(leftCoords);
var leftClone = leftCoords.slice();
const leftClone = leftCoords.slice();
orient(leftClone, 0, ends, 2);
expect(leftClone).to.eql(leftCoords);
});
it('can orient using the right-hand rule', function() {
var rightClone = rightCoords.slice();
const rightClone = rightCoords.slice();
orient(rightClone, 0, ends, 2, true);
expect(rightClone).to.eql(rightCoords);
var leftClone = leftCoords.slice();
const leftClone = leftCoords.slice();
orient(leftClone, 0, ends, 2, true);
expect(leftClone).to.eql(rightCoords);
});