Skip to content

Commit e4f3fa4

Browse files
committed
chore: lint using 🐊Putout
1 parent ff6fa73 commit e4f3fa4

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

ā€Žaddons/xterm-addon-search/test/SearchAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('Search Tests', function(): void {
134134
.replace(/\n/g, '\\n\\r');
135135
}
136136
fixture = fixture
137-
.replace(/'/g, '\\\'');
137+
.replace(/'/g, `\'`);
138138
});
139139
it('should find all occurrences using findNext', async () => {
140140
await writeSync(page, fixture);

ā€Žaddons/xterm-addon-serialize/src/SerializeAddon.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('xterm-addon-serialize html', () => {
8686
it('empty terminal with selection turned off', () => {
8787
const output = serializeAddon.serializeAsHTML();
8888
assert.notEqual(output, '');
89-
assert.equal((output.match(new RegExp('<div><span> {10}</span><\/div>', 'g')) || []).length, 2);
89+
assert.equal((output.match(/<div><span> {10}<\/span><\/div>/g) || []).length, 2);
9090
});
9191

9292
it('empty terminal with no selection', () => {
@@ -103,84 +103,84 @@ describe('xterm-addon-serialize html', () => {
103103
const output = serializeAddon.serializeAsHTML({
104104
onlySelection: true
105105
});
106-
assert.equal((output.match(new RegExp('<div><span>terminal<\/span><\/div>', 'g')) || []).length, 1, output);
106+
assert.equal((output.match(/<div><span>terminal<\/span><\/div>/g) || []).length, 1, output);
107107
});
108108

109109
it('cells with bold styling', async () => {
110110
await writeP(terminal, ' ' + sgr('1') + 'terminal' + sgr('22') + ' ');
111111

112112
const output = serializeAddon.serializeAsHTML();
113-
assert.equal((output.match(new RegExp('<span style=\'font-weight: bold;\'>terminal<\/span>', 'g')) || []).length, 1, output);
113+
assert.equal((output.match(/<span style='font-weight: bold;'>terminal<\/span>/g) || []).length, 1, output);
114114
});
115115

116116
it('cells with italic styling', async () => {
117117
await writeP(terminal, ' ' + sgr('3') + 'terminal' + sgr('23') + ' ');
118118

119119
const output = serializeAddon.serializeAsHTML();
120-
assert.equal((output.match(new RegExp('<span style=\'font-style: italic;\'>terminal<\/span>', 'g')) || []).length, 1, output);
120+
assert.equal((output.match(/<span style='font-style: italic;'>terminal<\/span>/g) || []).length, 1, output);
121121
});
122122

123123
it('cells with inverse styling', async () => {
124124
await writeP(terminal, ' ' + sgr('7') + 'terminal' + sgr('27') + ' ');
125125

126126
const output = serializeAddon.serializeAsHTML();
127-
assert.equal((output.match(new RegExp('<span style=\'color: #000000; background-color: #BFBFBF;\'>terminal<\/span>', 'g')) || []).length, 1, output);
127+
assert.equal((output.match(/<span style='color: #000000; background-color: #BFBFBF;'>terminal<\/span>/g) || []).length, 1, output);
128128
});
129129

130130
it('cells with underline styling', async () => {
131131
await writeP(terminal, ' ' + sgr('4') + 'terminal' + sgr('24') + ' ');
132132

133133
const output = serializeAddon.serializeAsHTML();
134-
assert.equal((output.match(new RegExp('<span style=\'text-decoration: underline;\'>terminal<\/span>', 'g')) || []).length, 1, output);
134+
assert.equal((output.match(/<span style='text-decoration: underline;'>terminal<\/span>/g) || []).length, 1, output);
135135
});
136136

137137
it('cells with invisible styling', async () => {
138138
await writeP(terminal, ' ' + sgr('8') + 'terminal' + sgr('28') + ' ');
139139

140140
const output = serializeAddon.serializeAsHTML();
141-
assert.equal((output.match(new RegExp('<span style=\'visibility: hidden;\'>terminal<\/span>', 'g')) || []).length, 1, output);
141+
assert.equal((output.match(/<span style='visibility: hidden;'>terminal<\/span>/g) || []).length, 1, output);
142142
});
143143

144144
it('cells with dim styling', async () => {
145145
await writeP(terminal, ' ' + sgr('2') + 'terminal' + sgr('22') + ' ');
146146

147147
const output = serializeAddon.serializeAsHTML();
148-
assert.equal((output.match(new RegExp('<span style=\'opacity: 0.5;\'>terminal<\/span>', 'g')) || []).length, 1, output);
148+
assert.equal((output.match(/<span style='opacity: 0.5;'>terminal<\/span>/g) || []).length, 1, output);
149149
});
150150

151151
it('cells with strikethrough styling', async () => {
152152
await writeP(terminal, ' ' + sgr('9') + 'terminal' + sgr('29') + ' ');
153153

154154
const output = serializeAddon.serializeAsHTML();
155-
assert.equal((output.match(new RegExp('<span style=\'text-decoration: line-through;\'>terminal<\/span>', 'g')) || []).length, 1, output);
155+
assert.equal((output.match(/<span style='text-decoration: line-through;'>terminal<\/span>/g) || []).length, 1, output);
156156
});
157157

158158
it('cells with combined styling', async () => {
159159
await writeP(terminal, sgr('1') + ' ' + sgr('9') + 'termi' + sgr('22') + 'nal' + sgr('29') + ' ');
160160

161161
const output = serializeAddon.serializeAsHTML();
162-
assert.equal((output.match(new RegExp('<span style=\'font-weight: bold;\'> <\/span>', 'g')) || []).length, 1, output);
163-
assert.equal((output.match(new RegExp('<span style=\'font-weight: bold; text-decoration: line-through;\'>termi<\/span>', 'g')) || []).length, 1, output);
164-
assert.equal((output.match(new RegExp('<span style=\'text-decoration: line-through;\'>nal<\/span>', 'g')) || []).length, 1, output);
162+
assert.equal((output.match(/<span style='font-weight: bold;'> <\/span>/g) || []).length, 1, output);
163+
assert.equal((output.match(/<span style='font-weight: bold; text-decoration: line-through;'>termi<\/span>/g) || []).length, 1, output);
164+
assert.equal((output.match(/<span style='text-decoration: line-through;'>nal<\/span>/g) || []).length, 1, output);
165165
});
166166

167167
it('cells with color styling', async () => {
168168
await writeP(terminal, ' ' + sgr('38;5;46') + 'terminal' + sgr('39') + ' ');
169169

170170
const output = serializeAddon.serializeAsHTML();
171-
assert.equal((output.match(new RegExp('<span style=\'color: #00ff00;\'>terminal<\/span>', 'g')) || []).length, 1, output);
171+
assert.equal((output.match(/<span style='color: #00ff00;'>terminal<\/span>/g) || []).length, 1, output);
172172
});
173173

174174
it('cells with background styling', async () => {
175175
await writeP(terminal, ' ' + sgr('48;5;46') + 'terminal' + sgr('49') + ' ');
176176

177177
const output = serializeAddon.serializeAsHTML();
178-
assert.equal((output.match(new RegExp('<span style=\'background-color: #00ff00;\'>terminal<\/span>', 'g')) || []).length, 1, output);
178+
assert.equal((output.match(/<span style='background-color: #00ff00;'>terminal<\/span>/g) || []).length, 1, output);
179179
});
180180

181181
it('empty terminal with default options', async () => {
182182
const output = serializeAddon.serializeAsHTML();
183-
assert.equal((output.match(new RegExp('color: #000000; background-color: #ffffff; font-family: courier-new, courier, monospace; font-size: 15px;', 'g')) || []).length, 1, output);
183+
assert.equal((output.match(/color: #000000; background-color: #ffffff; font-family: courier-new, courier, monospace; font-size: 15px;/g) || []).length, 1, output);
184184
});
185185

186186
it('empty terminal with custom options', async () => {
@@ -193,13 +193,13 @@ describe('xterm-addon-serialize html', () => {
193193
const output = serializeAddon.serializeAsHTML({
194194
includeGlobalBackground: true
195195
});
196-
assert.equal((output.match(new RegExp('color: #ff00ff; background-color: #00ff00; font-family: verdana; font-size: 20px;', 'g')) || []).length, 1, output);
196+
assert.equal((output.match(/color: #ff00ff; background-color: #00ff00; font-family: verdana; font-size: 20px;/g) || []).length, 1, output);
197197
});
198198

199199
it('empty terminal with background included', async () => {
200200
const output = serializeAddon.serializeAsHTML({
201201
includeGlobalBackground: true
202202
});
203-
assert.equal((output.match(new RegExp('color: #ffffff; background-color: #000000; font-family: courier-new, courier, monospace; font-size: 15px;', 'g')) || []).length, 1, output);
203+
assert.equal((output.match(/color: #ffffff; background-color: #000000; font-family: courier-new, courier, monospace; font-size: 15px;/g) || []).length, 1, output);
204204
});
205205
});

ā€Žaddons/xterm-addon-serialize/src/SerializeAddon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export class HTMLSerializeHandler extends BaseSerializeHandler {
544544
return target;
545545
}
546546

547-
targetLength = targetLength - target.length;
547+
targetLength -= target.length;
548548
if (targetLength > padString.length) {
549549
padString += padString.repeat(targetLength / padString.length);
550550
}

ā€Žaddons/xterm-addon-serialize/test/SerializeAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let page: Page;
1414
const width = 800;
1515
const height = 600;
1616

17-
const writeRawSync = (page: any, str: string): Promise<void> => writeSync(page, '\' +' + JSON.stringify(str) + '+ \'');
17+
const writeRawSync = (page: any, str: string): Promise<void> => writeSync(page, `' +` + JSON.stringify(str) + `+ '`);
1818

1919
const testNormalScreenEqual = async (page: any, str: string): Promise<void> => {
2020
await writeRawSync(page, str);

ā€Žsrc/browser/ColorManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class ColorManager implements IColorManager {
185185
foreground: this.colors.foreground,
186186
background: this.colors.background,
187187
cursor: this.colors.cursor,
188-
ansi: [...this.colors.ansi]
188+
ansi: this.colors.ansi.slice()
189189
};
190190
}
191191

ā€Žsrc/browser/renderer/atlas/CharAtlasUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function generateConfig(scaledCharWidth: number, scaledCharHeight: number
1616
cursor: undefined,
1717
cursorAccent: undefined,
1818
selection: undefined,
19-
ansi: [...colors.ansi]
19+
ansi: colors.ansi.slice()
2020
};
2121
return {
2222
devicePixelRatio: window.devicePixelRatio,

ā€Žsrc/common/input/XParseColor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
// 'rgb:' rule - matching: r/g/b | rr/gg/bb | rrr/ggg/bbb | rrrr/gggg/bbbb (hex digits)
8-
const RGB_REX = /^([\da-f]{1})\/([\da-f]{1})\/([\da-f]{1})$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/;
8+
const RGB_REX = /^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/;
99
// '#...' rule - matching any hex digits
1010
const HASH_REX = /^[\da-f]+$/;
1111

0 commit comments

Comments
Ā (0)