Skip to content

Commit 20ade13

Browse files
authored
fix: address lint CI failures (#235)
1 parent 7640f6b commit 20ade13

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

client-src/overlay.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
import ansiHTML from './utils/ansiHTML.js';
1515

16-
const getCodePoint = !!String.prototype.codePointAt
16+
const hasCodePointAt = typeof String.prototype.codePointAt === 'function';
17+
const getCodePoint = hasCodePointAt
1718
? (input: string, position: number): number | undefined =>
1819
input.codePointAt(position)
1920
: (input: string, position: number): number | undefined =>

client-src/utils/ansiHTML.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Match = {
2020

2121
// Reference to https://github.com/sindresorhus/ansi-regex
2222
const _regANSI =
23+
// eslint-disable-next-line no-control-regex
2324
/(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/;
2425

2526
const _defColors: Record<string, string | Array<string>> = {
@@ -138,6 +139,7 @@ export default function ansiHTML(text: string) {
138139
const ansiCodes: string[] = [];
139140
// Replace with markup.
140141
let ret = text.replace(
142+
// eslint-disable-next-line no-control-regex
141143
/\x1b\[(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?m/g,
142144
(m) => {
143145
const match = m.match(/(;?\d+)/g)?.map(normalizeSeq) as unknown as Match;
@@ -211,7 +213,9 @@ ansiHTML.setColors = (colors: typeof _defColors) => {
211213

212214
const _finalColors: typeof _defColors = {};
213215
for (const key in _defColors) {
214-
let hex = colors.hasOwnProperty(key) ? colors[key] : null;
216+
let hex = Object.prototype.hasOwnProperty.call(colors, key)
217+
? colors[key]
218+
: null;
215219
if (!hex) {
216220
_finalColors[key] = _defColors[key];
217221
continue;

0 commit comments

Comments
 (0)