Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
LabhanshAgrawal committed Apr 15, 2020
1 parent d1321c5 commit 3562446
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
19 changes: 11 additions & 8 deletions addons/xterm-addon-ligatures/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ describe('xterm-addon-ligatures', () => {

before(() => {
sinon.stub(fontFinder, 'list').returns(Promise.resolve({
// eslint-disable-next-line @typescript-eslint/naming-convention
'Fira Code': [{
path: path.join(__dirname, '../fonts/firaCode.otf'),
style: fontFinder.Style.Regular,
type: fontFinder.Type.Monospace,
weight: 400
}],
// eslint-disable-next-line @typescript-eslint/naming-convention
'Iosevka': [{
path: path.join(__dirname, '../fonts/iosevka.ttf'),
style: fontFinder.Style.Regular,
type: fontFinder.Type.Monospace,
weight: 400
}],
// eslint-disable-next-line @typescript-eslint/naming-convention
'Nonexistant Font': [{
path: path.join(__dirname, '../fonts/nonexistant.ttf'),
style: fontFinder.Style.Regular,
Expand Down Expand Up @@ -185,32 +188,32 @@ describe('xterm-addon-ligatures', () => {
});

class MockTerminal {
static applyAddon(addon: any): void {
public static applyAddon(addon: any): void {
addon.apply(MockTerminal);
}

private _options: { [name: string]: string | number; } = {
private _options: { [name: string]: string | number } = {
fontFamily: 'Fira Code, monospace',
rows: 50
};
joiner?: (text: string) => [number, number][];
refresh: (start: number, end: number) => void;
public joiner?: (text: string) => [number, number][];
public refresh: (start: number, end: number) => void;

constructor(onRefresh: (start: number, end: number) => void) {
this.refresh = onRefresh;
}

registerCharacterJoiner(handler: (text: string) => [number, number][]): number {
public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {
this.joiner = handler;
return 1;
}
deregisterCharacterJoiner(id: number): void {
public deregisterCharacterJoiner(id: number): void {
this.joiner = undefined;
}
setOption(name: string, value: string | number): void {
public setOption(name: string, value: string | number): void {
this._options[name] = value;
}
getOption(name: string): string | number {
public getOption(name: string): string | number {
return this._options[name];
}
}
Expand Down
3 changes: 2 additions & 1 deletion addons/xterm-addon-ligatures/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export function enableLigatures(term: Terminal): void {
return font.findLigatureRanges(text).map<[number, number]>(
range => [range[0], range[1]]
);
} else if (loadingState === LoadingState.FAILED) {
}
if (loadingState === LoadingState.FAILED) {
throw loadError || new Error('Failure while loading font');
}

Expand Down
3 changes: 2 additions & 1 deletion addons/xterm-addon-ligatures/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ function parseUnicode(context: IParseContext): string {
// The first whitespace character after a unicode escape indicates the end
// of the escape and is swallowed.
return unicodeToString(str);
} else if (str.length >= 6 || !/[0-9a-fA-F]/.test(char)) {
}
if (str.length >= 6 || !/[0-9a-fA-F]/.test(char)) {
// If the next character is not a valid hex digit or we have reached the
// maximum of 6 digits in the escape, terminate the escape.
context.offset--;
Expand Down

0 comments on commit 3562446

Please sign in to comment.