Skip to content

Commit b41d187

Browse files
authored
ESLINT - no-var (handsontable#5317)
* Changed: /test/unit/**/*.spec.js * Changed: /test/helpers/*.js + Fix: unit test for PluginHooks * Changed: /test/e2e/validators/*.js * Changed: /test/e2e/utils/*.js * Changed: /test/e2e/settings/*.js * Changed: /test/e2e/renderers/*.js * Changed: /test/e2e/editors/*.js * Changed: /test/e2e/core/*.js * Changed: /test/e2e/*.spec.js * Changed: /src/plugins/**/test/*.js * Changed: /src/3rdparty/walkontable/**/test/*.js * Changed: rest of /src/**/*.js * A few changes in tests and dom helper.
1 parent cb930a4 commit b41d187

File tree

166 files changed

+2576
-2607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+2576
-2607
lines changed

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
}
5050
],
5151
"no-use-before-define": 0,
52-
"no-var": 0,
5352
"no-void": 0,
5453
"no-with": 2,
5554
"object-curly-spacing": 0,

src/3rdparty/walkontable/src/event.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ function Event(instance) {
1818

1919
this.instance = instance;
2020

21-
var dblClickOrigin = [null, null];
21+
const dblClickOrigin = [null, null];
2222
this.dblClickTimeout = [null, null];
2323

24-
var onMouseDown = function(event) {
24+
const onMouseDown = function(event) {
2525
const activeElement = document.activeElement;
2626
const getParentNode = partial(getParent, event.realTarget);
2727
const realTarget = event.realTarget;
@@ -33,7 +33,7 @@ function Event(instance) {
3333
return;
3434
}
3535

36-
var cell = that.parentCell(realTarget);
36+
const cell = that.parentCell(realTarget);
3737

3838
if (hasClass(realTarget, 'corner')) {
3939
that.instance.getSetting('onCellCornerMouseDown', event, realTarget);
@@ -64,11 +64,11 @@ function Event(instance) {
6464
}
6565
};
6666

67-
var onTouchMove = function() {
67+
const onTouchMove = function() {
6868
that.instance.touchMoving = true;
6969
};
7070

71-
var onTouchStart = function(event) {
71+
const onTouchStart = function(event) {
7272
eventManager.addEventListener(this, 'touchmove', onTouchMove);
7373

7474
// Prevent cell selection when scrolling with touch event - not the best solution performance-wise
@@ -84,10 +84,10 @@ function Event(instance) {
8484
}, 30);
8585
};
8686

87-
var onMouseOver = function(event) {
88-
var table,
89-
td,
90-
mainWOT;
87+
const onMouseOver = function(event) {
88+
let table;
89+
let td;
90+
let mainWOT;
9191

9292
if (that.instance.hasSetting('onCellMouseOver')) {
9393
table = that.instance.wtTable.TABLE;
@@ -102,7 +102,7 @@ function Event(instance) {
102102
}
103103
};
104104

105-
var onMouseOut = function(event) {
105+
const onMouseOut = function(event) {
106106
let table;
107107
let lastTD;
108108
let nextTD;
@@ -118,9 +118,9 @@ function Event(instance) {
118118
}
119119
};
120120

121-
var onMouseUp = function(event) {
121+
const onMouseUp = function(event) {
122122
if (event.button !== 2) { // if not right mouse button
123-
var cell = that.parentCell(event.realTarget);
123+
const cell = that.parentCell(event.realTarget);
124124

125125
if (cell.TD === dblClickOrigin[0] && cell.TD === dblClickOrigin[1]) {
126126
if (hasClass(event.realTarget, 'corner')) {
@@ -162,7 +162,7 @@ function Event(instance) {
162162
return false;
163163
};
164164

165-
var onTouchEnd = function(event) {
165+
const onTouchEnd = function(event) {
166166
const excludeTags = ['A', 'BUTTON', 'INPUT'];
167167
const target = event.target;
168168

@@ -182,7 +182,7 @@ function Event(instance) {
182182

183183
// check if full HOT instance, or detached WOT AND run on mobile device
184184
if (this.instance.wtTable.holder.parentNode.parentNode && isMobileBrowser() && !that.instance.wtTable.isWorkingOnClone()) {
185-
var classSelector = `.${this.instance.wtTable.holder.parentNode.className.split(' ').join('.')}`;
185+
const classSelector = `.${this.instance.wtTable.holder.parentNode.className.split(' ').join('.')}`;
186186

187187
eventManager.addEventListener(this.instance.wtTable.holder, 'touchstart', (event) => {
188188
selectedCellBeforeTouchEnd = instance.selections.getCell().cellRange;
@@ -235,9 +235,9 @@ function Event(instance) {
235235
}
236236

237237
Event.prototype.parentCell = function(elem) {
238-
var cell = {};
239-
var TABLE = this.instance.wtTable.TABLE;
240-
var TD = closestDown(elem, ['TD', 'TH'], TABLE);
238+
const cell = {};
239+
const TABLE = this.instance.wtTable.TABLE;
240+
const TD = closestDown(elem, ['TD', 'TH'], TABLE);
241241

242242
if (TD) {
243243
cell.coords = this.instance.wtTable.getCoords(TD);

src/3rdparty/walkontable/src/overlay/_base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class Overlay {
238238
*/
239239
refresh(fastDraw = false) {
240240
// When hot settings are changed we allow to refresh overlay once before blocking
241-
var nextCycleRenderFlag = this.shouldBeRendered();
241+
const nextCycleRenderFlag = this.shouldBeRendered();
242242

243243
if (this.clone && (this.needFullRender || nextCycleRenderFlag)) {
244244
this.clone.draw(fastDraw);

src/3rdparty/walkontable/test/helpers/common.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ export function createDataArray(rows, cols) {
1919
rows = typeof rows === 'number' ? rows : 100;
2020
cols = typeof cols === 'number' ? cols : 4;
2121

22-
for (var i = 0; i < rows; i++) {
23-
var row = [];
22+
for (let i = 0; i < rows; i++) {
23+
const row = [];
2424

2525
if (cols > 0) {
2626
row.push(i);
2727

28-
for (var j = 0; j < cols - 1; j++) {
28+
for (let j = 0; j < cols - 1; j++) {
2929
/* eslint-disable no-mixed-operators */
3030
/* eslint-disable no-bitwise */
3131
row.push(String.fromCharCode(65 + j % 20).toLowerCase() + (j / 20 | 0 || '')); // | 0 is parseInt - see http://jsperf.com/math-floor-vs-math-round-vs-parseint/18
@@ -47,12 +47,12 @@ export function getTotalColumns() {
4747
return spec().data[0] ? spec().data[0].length : 0;
4848
};
4949

50-
var currentSpec;
50+
let currentSpec;
5151

5252
beforeEach(function() {
5353
currentSpec = this;
5454

55-
var matchers = {
55+
const matchers = {
5656
toBeInArray() {
5757
return {
5858
compare(actual, expected) {
@@ -76,8 +76,8 @@ beforeEach(function() {
7676
compare(actual, expected, diff) {
7777
diff = diff || 1;
7878

79-
var pass = actual >= expected - diff && actual <= expected + diff;
80-
var message = `Expected ${actual} to be around ${expected} (between ${expected - diff} and ${expected + diff})`;
79+
const pass = actual >= expected - diff && actual <= expected + diff;
80+
let message = `Expected ${actual} to be around ${expected} (between ${expected - diff} and ${expected + diff})`;
8181

8282
if (!pass) {
8383
message = `Expected ${actual} NOT to be around ${expected} (between ${expected - diff} and ${expected + diff})`;
@@ -117,7 +117,7 @@ export function range(from, to) {
117117
from = [to, to = from][0]; // one-liner for swapping two values
118118
}
119119

120-
var result = [];
120+
const result = [];
121121

122122
while (to++ < from) {
123123
result.push(to);
@@ -194,12 +194,12 @@ export function getTableCornerClone() {
194194
}
195195

196196
export function createSpreadsheetData(rows, columns) {
197-
var _rows = [],
198-
i,
199-
j;
197+
const _rows = [];
198+
let i;
199+
let j;
200200

201201
for (i = 0; i < rows; i++) {
202-
var row = [];
202+
const row = [];
203203

204204
for (j = 0; j < columns; j++) {
205205
row.push(spreadsheetColumnLabel(j) + (i + 1));
@@ -234,11 +234,11 @@ export function spreadsheetColumnLabel(index) {
234234
}
235235

236236
export function walkontableCalculateScrollbarWidth() {
237-
var inner = document.createElement('div');
237+
const inner = document.createElement('div');
238238
inner.style.height = '200px';
239239
inner.style.width = '100%';
240240

241-
var outer = document.createElement('div');
241+
const outer = document.createElement('div');
242242
outer.style.boxSizing = 'content-box';
243243
outer.style.height = '150px';
244244
outer.style.left = '0px';
@@ -250,9 +250,9 @@ export function walkontableCalculateScrollbarWidth() {
250250
outer.appendChild(inner);
251251

252252
(document.body || document.documentElement).appendChild(outer);
253-
var w1 = inner.offsetWidth;
253+
const w1 = inner.offsetWidth;
254254
outer.style.overflow = 'scroll';
255-
var w2 = inner.offsetWidth;
255+
let w2 = inner.offsetWidth;
256256
if (w1 === w2) {
257257
w2 = outer.clientWidth;
258258
}
@@ -262,7 +262,7 @@ export function walkontableCalculateScrollbarWidth() {
262262
return (w1 - w2);
263263
}
264264

265-
var cachedScrollbarWidth;
265+
let cachedScrollbarWidth;
266266

267267
export function getScrollbarWidth() {
268268
if (cachedScrollbarWidth === void 0) {

src/3rdparty/walkontable/test/spec/border.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
describe('WalkontableBorder', () => {
2-
var $table,
3-
$container,
4-
$wrapper,
5-
debug = false;
2+
let $table;
3+
let $container;
4+
let $wrapper;
5+
let debug = false;
66

77
beforeEach(() => {
88
$container = $('<div></div>');

0 commit comments

Comments
 (0)