Prefer const vs let for variables that are only declared once

Requires that variable declarations use `const` instead of `let` and `var` if possible.

This is mostly for code readability, performance wins are debatable.
This commit is contained in:
Lukas Geiger
2018-05-30 19:47:28 +02:00
parent 4a4a17966a
commit 8989a09853
22 changed files with 153 additions and 152 deletions
+3 -3
View File
@@ -827,7 +827,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
// ^[[M 3<^[[M@4<^[[M@5<^[[M@6<^[[M@7<^[[M#7<
function sendMove(ev: MouseEvent): void {
let button = pressed;
let pos = self.mouseHelper.getRawByteCoords(ev, self.screenElement, self.charMeasure, self.options.lineHeight, self.cols, self.rows);
const pos = self.mouseHelper.getRawByteCoords(ev, self.screenElement, self.charMeasure, self.options.lineHeight, self.cols, self.rows);
if (!pos) return;
// buttons marked as motions
@@ -938,7 +938,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
return;
}
let data: number[] = [];
const data: number[] = [];
encode(data, button);
encode(data, pos.x);
@@ -1145,7 +1145,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
public scroll(isWrapped?: boolean): void {
const newLine = this.blankLine(undefined, isWrapped);
const topRow = this.buffer.ybase + this.buffer.scrollTop;
let bottomRow = this.buffer.ybase + this.buffer.scrollBottom;
const bottomRow = this.buffer.ybase + this.buffer.scrollBottom;
if (this.buffer.scrollTop === 0) {
// Determine whether the buffer is going to be trimmed after insertion.