Enforce strict equality through tslint

This commit is contained in:
Jeff Principe
2018-08-22 19:36:40 -07:00
parent 9273e8175e
commit b35fa9576e
6 changed files with 13 additions and 12 deletions
+3 -3
View File
@@ -283,7 +283,7 @@ export class Buffer implements IBuffer {
* @param i The index to start setting up tab stops from. * @param i The index to start setting up tab stops from.
*/ */
public setupTabStops(i?: number): void { public setupTabStops(i?: number): void {
if (i != null) { if (i !== null && i !== undefined) {
if (!this.tabs[i]) { if (!this.tabs[i]) {
i = this.prevStop(i); i = this.prevStop(i);
} }
@@ -302,7 +302,7 @@ export class Buffer implements IBuffer {
* @param x The position to move the cursor to the previous tab stop. * @param x The position to move the cursor to the previous tab stop.
*/ */
public prevStop(x?: number): number { public prevStop(x?: number): number {
if (x == null) { if (x === null || x === undefined) {
x = this.x; x = this.x;
} }
while (!this.tabs[--x] && x > 0); while (!this.tabs[--x] && x > 0);
@@ -314,7 +314,7 @@ export class Buffer implements IBuffer {
* @param x The position to move the cursor one tab stop forward. * @param x The position to move the cursor one tab stop forward.
*/ */
public nextStop(x?: number): number { public nextStop(x?: number): number {
if (x == null) { if (x === null || x === undefined) {
x = this.x; x = this.x;
} }
while (!this.tabs[++x] && x < this._terminal.cols); while (!this.tabs[++x] && x < this._terminal.cols);
+5 -5
View File
@@ -251,7 +251,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
private _setup(): void { private _setup(): void {
Object.keys(DEFAULT_OPTIONS).forEach((key) => { Object.keys(DEFAULT_OPTIONS).forEach((key) => {
if (this.options[key] == null) { if (this.options[key] === null || this.options[key] === undefined) {
this.options[key] = DEFAULT_OPTIONS[key]; this.options[key] = DEFAULT_OPTIONS[key];
} }
}); });
@@ -960,9 +960,9 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
// 1, and 2 - with 64 added // 1, and 2 - with 64 added
switch ((<any>ev).overrideType || ev.type) { switch ((<any>ev).overrideType || ev.type) {
case 'mousedown': case 'mousedown':
button = ev.button != null button = ev.button !== null && ev.button !== undefined
? +ev.button ? +ev.button
: ev.which != null : ev.which !== null && ev.which !== undefined
? ev.which - 1 ? ev.which - 1
: null; : null;
@@ -1587,7 +1587,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
if (ev.charCode) { if (ev.charCode) {
key = ev.charCode; key = ev.charCode;
} else if (ev.which == null) { } else if (ev.which === null || ev.which === undefined) {
key = ev.keyCode; key = ev.keyCode;
} else if (ev.which !== 0 && ev.charCode !== 0) { } else if (ev.which !== 0 && ev.charCode !== 0) {
key = ev.which; key = ev.which;
@@ -1932,7 +1932,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
public matchColor(r1: number, g1: number, b1: number): number { public matchColor(r1: number, g1: number, b1: number): number {
const hash = (r1 << 16) | (g1 << 8) | b1; const hash = (r1 << 16) | (g1 << 8) | b1;
if (matchColorCache[hash] != null) { if (matchColorCache[hash] !== null && matchColorCache[hash] !== undefined) {
return matchColorCache[hash]; return matchColorCache[hash];
} }
+1 -1
View File
@@ -94,7 +94,7 @@ export default class DynamicCharAtlas extends BaseCharAtlas {
): boolean { ): boolean {
const glyphKey = getGlyphCacheKey(glyph); const glyphKey = getGlyphCacheKey(glyph);
const cacheValue = this._cacheMap.get(glyphKey); const cacheValue = this._cacheMap.get(glyphKey);
if (cacheValue != null) { if (cacheValue !== null && cacheValue !== undefined) {
this._drawFromCache(ctx, cacheValue, x, y); this._drawFromCache(ctx, cacheValue, x, y);
return true; return true;
} else if (this._canCache(glyph) && this._drawToCacheCount < FRAME_CACHE_DRAW_LIMIT) { } else if (this._canCache(glyph) && this._drawToCacheCount < FRAME_CACHE_DRAW_LIMIT) {
+1 -1
View File
@@ -53,7 +53,7 @@ export default class StaticCharAtlas extends BaseCharAtlas {
y: number y: number
): boolean { ): boolean {
// we're not warmed up yet // we're not warmed up yet
if (this._texture == null) { if (this._texture === null || this._texture === undefined) {
return false; return false;
} }
+1 -1
View File
@@ -11,7 +11,7 @@ export class MouseHelper {
public static getCoordsRelativeToElement(event: {pageX: number, pageY: number}, element: HTMLElement): [number, number] { public static getCoordsRelativeToElement(event: {pageX: number, pageY: number}, element: HTMLElement): [number, number] {
// Ignore browsers that don't support MouseEvent.pageX // Ignore browsers that don't support MouseEvent.pageX
if (event.pageX == null) { if (event.pageX === null || event.pageX === undefined) {
return null; return null;
} }
+2 -1
View File
@@ -111,6 +111,7 @@
"prefer-const-enum": [ "prefer-const-enum": [
true true
], ],
"prefer-const": true "prefer-const": true,
"triple-equals": true
} }
} }