chore: lint using putout
This commit is contained in:
@@ -112,7 +112,7 @@ export class AccessibilityManager extends Disposable {
|
||||
}
|
||||
|
||||
private _onBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {
|
||||
const boundaryElement = <HTMLElement>e.target;
|
||||
const boundaryElement = e.target as HTMLElement;
|
||||
const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];
|
||||
|
||||
// Don't scroll if the buffer top has reached the end in that direction
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('ColorManager', () => {
|
||||
dom = new jsdom.JSDOM('');
|
||||
window = dom.window;
|
||||
document = window.document;
|
||||
(<any>window).HTMLCanvasElement.prototype.getContext = () => ({
|
||||
(window as any).HTMLCanvasElement.prototype.getContext = () => ({
|
||||
createLinearGradient(): any {
|
||||
return null;
|
||||
},
|
||||
@@ -36,7 +36,7 @@ describe('ColorManager', () => {
|
||||
for (const key of Object.keys(cm.colors)) {
|
||||
if (key !== 'ansi' && key !== 'contrastCache') {
|
||||
// A #rrggbb or rgba(...)
|
||||
assert.ok((<any>cm.colors)[key].css.length >= 7);
|
||||
assert.ok((cm.colors as any)[key].css.length >= 7);
|
||||
}
|
||||
}
|
||||
assert.equal(cm.colors.ansi.length, 256);
|
||||
|
||||
@@ -174,7 +174,7 @@ describe('Linkifier', () => {
|
||||
assert.equal(mouseZoneManager.zones[0].y1, 1);
|
||||
assert.equal(mouseZoneManager.zones[0].y2, 1);
|
||||
// Fires done()
|
||||
mouseZoneManager.zones[0].clickCallback(<any>{});
|
||||
mouseZoneManager.zones[0].clickCallback({} as any);
|
||||
}
|
||||
});
|
||||
linkifier.linkifyRows();
|
||||
@@ -210,7 +210,7 @@ describe('Linkifier', () => {
|
||||
let count = 0;
|
||||
linkifier.registerLinkMatcher(/test/, () => assert.fail(), {
|
||||
validationCallback: (url, cb) => {
|
||||
count += 1;
|
||||
++count;
|
||||
if (count === 2) {
|
||||
done();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ export class Linkifier implements ILinkifier {
|
||||
if (this._rowsTimeoutId) {
|
||||
clearTimeout(this._rowsTimeoutId);
|
||||
}
|
||||
this._rowsTimeoutId = <number><any>setTimeout(() => this._linkifyRows(), Linkifier._timeBeforeLatency);
|
||||
this._rowsTimeoutId = setTimeout(() => this._linkifyRows(), Linkifier._timeBeforeLatency) as any as number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,10 +29,10 @@ describe('Terminal', () => {
|
||||
beforeEach(() => {
|
||||
term = new TestTerminal(termOptions);
|
||||
term.refresh = () => { };
|
||||
(<any>term).renderer = new MockRenderer();
|
||||
(term as any).renderer = new MockRenderer();
|
||||
term.viewport = new MockViewport();
|
||||
(<any>term)._compositionHelper = new MockCompositionHelper();
|
||||
(<any>term).element = {
|
||||
(term as any)._compositionHelper = new MockCompositionHelper();
|
||||
(term as any).element = {
|
||||
classList: {
|
||||
toggle: () => { },
|
||||
remove: () => { }
|
||||
@@ -86,12 +86,12 @@ describe('Terminal', () => {
|
||||
assert.equal(e.domEvent instanceof Object, true);
|
||||
done();
|
||||
});
|
||||
const evKeyPress = <KeyboardEvent>{
|
||||
const evKeyPress = {
|
||||
preventDefault: () => { },
|
||||
stopPropagation: () => { },
|
||||
type: 'keypress',
|
||||
keyCode: 13
|
||||
};
|
||||
} as KeyboardEvent;
|
||||
term.keyPress(evKeyPress);
|
||||
});
|
||||
it('should fire a key event after a keydown DOM event', (done) => {
|
||||
@@ -100,13 +100,13 @@ describe('Terminal', () => {
|
||||
assert.equal(e.domEvent instanceof Object, true);
|
||||
done();
|
||||
});
|
||||
(<any>term).textarea = { value: '' };
|
||||
const evKeyDown = <KeyboardEvent>{
|
||||
(term as any).textarea = { value: '' };
|
||||
const evKeyDown = {
|
||||
preventDefault: () => { },
|
||||
stopPropagation: () => { },
|
||||
type: 'keydown',
|
||||
keyCode: 13
|
||||
};
|
||||
} as KeyboardEvent;
|
||||
term.keyDown(evKeyDown);
|
||||
});
|
||||
it('should fire the onResize event', (done) => {
|
||||
@@ -140,18 +140,18 @@ describe('Terminal', () => {
|
||||
});
|
||||
|
||||
describe('attachCustomKeyEventHandler', () => {
|
||||
const evKeyDown = <KeyboardEvent>{
|
||||
const evKeyDown = {
|
||||
preventDefault: () => { },
|
||||
stopPropagation: () => { },
|
||||
type: 'keydown',
|
||||
keyCode: 77
|
||||
};
|
||||
const evKeyPress = <KeyboardEvent>{
|
||||
} as KeyboardEvent;
|
||||
const evKeyPress = {
|
||||
preventDefault: () => { },
|
||||
stopPropagation: () => { },
|
||||
type: 'keypress',
|
||||
keyCode: 77
|
||||
};
|
||||
} as KeyboardEvent;
|
||||
|
||||
beforeEach(() => {
|
||||
term.clearSelection = () => { };
|
||||
@@ -374,13 +374,13 @@ describe('Terminal', () => {
|
||||
|
||||
describe('keyPress', () => {
|
||||
it('should scroll down, when a key is pressed and terminal is scrolled up', () => {
|
||||
const event = <KeyboardEvent>{
|
||||
const event = {
|
||||
type: 'keydown',
|
||||
key: 'a',
|
||||
keyCode: 65,
|
||||
preventDefault: () => { },
|
||||
stopPropagation: () => { }
|
||||
};
|
||||
} as KeyboardEvent;
|
||||
|
||||
term.buffer.ydisp = 0;
|
||||
term.buffer.ybase = 40;
|
||||
@@ -403,7 +403,7 @@ describe('Terminal', () => {
|
||||
assert.equal(term.buffer.ydisp, startYDisp);
|
||||
term.scrollLines(-1);
|
||||
assert.equal(term.buffer.ydisp, startYDisp - 1);
|
||||
term.keyPress(<KeyboardEvent>{ keyCode: 0 });
|
||||
term.keyPress({ keyCode: 0 } as KeyboardEvent);
|
||||
assert.equal(term.buffer.ydisp, startYDisp - 1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
|
||||
// private _visualBellTimer: number;
|
||||
|
||||
public browser: IBrowser = <any>Browser;
|
||||
public browser: IBrowser = Browser as any;
|
||||
|
||||
// TODO: We should remove options once components adopt optionsService
|
||||
public get options(): IInitializedTerminalOptions { return this.optionsService.options; }
|
||||
@@ -601,7 +601,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
|
||||
let but: CoreMouseButton;
|
||||
let action: CoreMouseAction | undefined;
|
||||
switch ((<any>ev).overrideType || ev.type) {
|
||||
switch ((ev as any).overrideType || ev.type) {
|
||||
case 'mousemove':
|
||||
action = CoreMouseAction.MOVE;
|
||||
if (ev.buttons === undefined) {
|
||||
|
||||
@@ -105,7 +105,7 @@ function formatError(input: string, output: string, expected: string): string {
|
||||
function addLineNumber(start: number, color: string): (s: string) => string {
|
||||
let counter = start || 0;
|
||||
return (s: string): string => {
|
||||
counter += 1;
|
||||
++counter;
|
||||
return '\x1b[33m' + (' ' + counter).slice(-2) + color + s;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ export class MockTerminal implements ITerminal {
|
||||
public textarea!: HTMLTextAreaElement;
|
||||
public rows!: number;
|
||||
public cols!: number;
|
||||
public browser: IBrowser = <any>Browser;
|
||||
public browser: IBrowser = Browser as any;
|
||||
public writeBuffer!: string[];
|
||||
public children!: HTMLElement[];
|
||||
public cursorHidden!: boolean;
|
||||
|
||||
Reference in New Issue
Block a user