Migrate whitespace tslint rule

This commit is contained in:
Daniel Imms
2020-03-28 07:34:49 -07:00
parent 2e9b4779c9
commit bbd83b9dba
9 changed files with 19 additions and 16 deletions
+3
View File
@@ -87,6 +87,7 @@ module.exports = {
"error", "error",
"always" "always"
], ],
"keyword-spacing": "error",
"new-parens": "error", "new-parens": "error",
"no-duplicate-imports": "error", "no-duplicate-imports": "error",
"no-else-return": [ "no-else-return": [
@@ -104,6 +105,7 @@ module.exports = {
] ]
} }
], ],
"no-irregular-whitespace": "error",
"no-trailing-spaces": "error", "no-trailing-spaces": "error",
"no-unsafe-finally": "error", "no-unsafe-finally": "error",
"no-var": "error", "no-var": "error",
@@ -134,6 +136,7 @@ module.exports = {
{ "selector": "typeLike", "format": ["PascalCase"] }, { "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "interface", "format": ["PascalCase"], "prefix": ["I"] }, { "selector": "interface", "format": ["PascalCase"], "prefix": ["I"] },
], ],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/explicit-function-return-type": [ "@typescript-eslint/explicit-function-return-type": [
"error", "error",
{ {
+2 -2
View File
@@ -38,7 +38,7 @@ export class FitAddon implements ITerminalAddon {
} }
// TODO: Remove reliance on private API // TODO: Remove reliance on private API
const core = (<any>this._terminal)._core; const core = (this._terminal as any)._core;
// Force a full render // Force a full render
if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) { if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {
@@ -57,7 +57,7 @@ export class FitAddon implements ITerminalAddon {
} }
// TODO: Remove reliance on private API // TODO: Remove reliance on private API
const core = (<any>this._terminal)._core; const core = (this._terminal as any)._core;
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement); const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')); const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
@@ -56,7 +56,7 @@ export class WebLinksAddon implements ITerminalAddon {
this._linkProvider = this._terminal.registerLinkProvider(new WebLinkProvider(this._terminal, strictUrlRegex, this._handler)); this._linkProvider = this._terminal.registerLinkProvider(new WebLinkProvider(this._terminal, strictUrlRegex, this._handler));
} else { } else {
// TODO: This should be removed eventually // TODO: This should be removed eventually
this._linkMatcherId = (<Terminal>this._terminal).registerLinkMatcher(strictUrlRegex, this._handler, this._options); this._linkMatcherId = (this._terminal as Terminal).registerLinkMatcher(strictUrlRegex, this._handler, this._options);
} }
} }
+3 -3
View File
@@ -21,7 +21,7 @@ export class WebglAddon implements ITerminalAddon {
throw new Error('Cannot activate WebglAddon before Terminal.open'); throw new Error('Cannot activate WebglAddon before Terminal.open');
} }
this._terminal = terminal; this._terminal = terminal;
const renderService: IRenderService = (<any>terminal)._core._renderService; const renderService: IRenderService = (<any>terminal)._core._renderService;
const colors: IColorSet = (<any>terminal)._core._colorManager.colors; const colors: IColorSet = (<any>terminal)._core._colorManager.colors;
this._renderer = new WebglRenderer(terminal, colors, this._preserveDrawingBuffer); this._renderer = new WebglRenderer(terminal, colors, this._preserveDrawingBuffer);
renderService.setRenderer(this._renderer); renderService.setRenderer(this._renderer);
@@ -31,8 +31,8 @@ export class WebglAddon implements ITerminalAddon {
if (!this._terminal) { if (!this._terminal) {
throw new Error('Cannot dispose WebglAddon because it is activated'); throw new Error('Cannot dispose WebglAddon because it is activated');
} }
const renderService: IRenderService = (<any>this._terminal)._core._renderService; const renderService: IRenderService = (this._terminal as any)._core._renderService;
renderService.setRenderer((<any>this._terminal)._core._createRenderer()); renderService.setRenderer((this._terminal as any)._core._createRenderer());
renderService.onResize(this._terminal.cols, this._terminal.rows); renderService.onResize(this._terminal.cols, this._terminal.rows);
this._renderer = undefined; this._renderer = undefined;
} }
@@ -49,7 +49,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
) { ) {
super(); super();
this._core = (<any>this._terminal)._core; this._core = (this._terminal as any)._core;
this._renderLayers = [ this._renderLayers = [
new LinkRenderLayer(this._core.screenElement, 2, this._colors, this._core), new LinkRenderLayer(this._core.screenElement, 2, this._colors, this._core),
@@ -226,7 +226,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
public renderRows(start: number, end: number): void { public renderRows(start: number, end: number): void {
if (!this._isAttached) { if (!this._isAttached) {
if (document.body.contains(this._core.screenElement) && (<any>this._core)._charSizeService.width && (<any>this._core)._charSizeService.height) { if (document.body.contains(this._core.screenElement) && (this._core as any)._charSizeService.width && (this._core as any)._charSizeService.height) {
this._updateDimensions(); this._updateDimensions();
this._refreshCharAtlas(); this._refreshCharAtlas();
this._isAttached = true; this._isAttached = true;
@@ -329,7 +329,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
// TODO: Acquire CharSizeService properly // TODO: Acquire CharSizeService properly
// Perform a new measure if the CharMeasure dimensions are not yet available // Perform a new measure if the CharMeasure dimensions are not yet available
if (!(<any>this._core)._charSizeService.width || !(<any>this._core)._charSizeService.height) { if (!(this._core as any)._charSizeService.width || !(this._core as any)._charSizeService.height) {
return; return;
} }
@@ -340,12 +340,12 @@ export class WebglRenderer extends Disposable implements IRenderer {
// NOTE: ceil fixes sometime, floor does others :s // NOTE: ceil fixes sometime, floor does others :s
this.dimensions.scaledCharWidth = Math.floor((<any>this._core)._charSizeService.width * this._devicePixelRatio); this.dimensions.scaledCharWidth = Math.floor((this._core as any)._charSizeService.width * this._devicePixelRatio);
// Calculate the scaled character height. Height is ceiled in case // Calculate the scaled character height. Height is ceiled in case
// devicePixelRatio is a floating point number in order to ensure there is // devicePixelRatio is a floating point number in order to ensure there is
// enough space to draw the character to the cell. // enough space to draw the character to the cell.
this.dimensions.scaledCharHeight = Math.ceil((<any>this._core)._charSizeService.height * this._devicePixelRatio); this.dimensions.scaledCharHeight = Math.ceil((this._core as any)._charSizeService.height * this._devicePixelRatio);
// Calculate the scaled cell height, if lineHeight is not 1 then the value // Calculate the scaled cell height, if lineHeight is not 1 then the value
// will be floored because since lineHeight can never be lower then 1, there // will be floored because since lineHeight can never be lower then 1, there
@@ -74,7 +74,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
const oldCanvas = this._canvas; const oldCanvas = this._canvas;
this._alpha = alpha; this._alpha = alpha;
// Cloning preserves properties // Cloning preserves properties
this._canvas = <HTMLCanvasElement>this._canvas.cloneNode(); this._canvas = this._canvas.cloneNode() as HTMLCanvasElement;
this._initCanvas(); this._initCanvas();
this._container.replaceChild(this._canvas, oldCanvas); this._container.replaceChild(this._canvas, oldCanvas);
+1 -1
View File
@@ -93,7 +93,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
const oldCanvas = this._canvas; const oldCanvas = this._canvas;
this._alpha = alpha; this._alpha = alpha;
// Cloning preserves properties // Cloning preserves properties
this._canvas = <HTMLCanvasElement>this._canvas.cloneNode(); this._canvas = this._canvas.cloneNode() as HTMLCanvasElement;
this._initCanvas(); this._initCanvas();
this._container.replaceChild(this._canvas, oldCanvas); this._container.replaceChild(this._canvas, oldCanvas);
+2 -2
View File
@@ -56,7 +56,7 @@ export class InstantiationService implements IInstantiationService {
return this._services.get(id); return this._services.get(id);
} }
public createInstance<T>(ctor: any, ...args: any[]): any { public createInstance<T>(ctor: any, ...args: any[]): T {
const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index); const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);
const serviceArgs: any[] = []; const serviceArgs: any[] = [];
@@ -76,6 +76,6 @@ export class InstantiationService implements IInstantiationService {
} }
// now create the instance // now create the instance
return <T>new ctor(...[...args, ...serviceArgs]); return new ctor(...[...args, ...serviceArgs]);
} }
} }
+1 -1
View File
@@ -25,7 +25,7 @@ export function createDecorator<T>(id: string): IServiceIdentifier<T> {
return serviceRegistry.get(id)!; return serviceRegistry.get(id)!;
} }
const decorator = <any>function (target: Function, key: string, index: number): any { const decorator: any = function (target: Function, key: string, index: number): any {
if (arguments.length !== 3) { if (arguments.length !== 3) {
throw new Error('@IServiceName-decorator can only be used to decorate a parameter'); throw new Error('@IServiceName-decorator can only be used to decorate a parameter');
} }