package upgrades & linter fixes

This commit is contained in:
Jörg Breitbart
2026-05-09 17:42:49 +02:00
parent 6ba731d73b
commit dc1ae4514b
36 changed files with 2804 additions and 2389 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ export class IIPHandler implements IOscHandler, IResetHandler {
let h = 0;
// early exit condition chain
let cond: number | boolean = true;
let cond: number | boolean;
if (cond = success) {
if (cond = !this._dec.end()) {
if (cond = this._dec.data8.length === this._header.size) {
+1 -1
View File
@@ -146,7 +146,7 @@ export class ImageRenderer extends Disposable implements IDisposable {
public clearLines(start: number, end: number, layer?: ImageLayer): void {
const y = start * (this.dimensions?.css.cell.height || 0);
const w = this.dimensions?.css.canvas.width || 0;
const h = (++end - start) * (this.dimensions?.css.cell.height || 0);
const h = (end + 1 - start) * (this.dimensions?.css.cell.height || 0);
if (!layer || layer === 'top') {
this._layers.get('top')?.clearRect(0, y, w, h);
}
+1 -1
View File
@@ -455,7 +455,7 @@ export class ImageStorage implements IDisposable {
if (!nextE || nextE.imageId !== imageId || nextE.tileId !== startTile + count) {
break;
}
e = nextE;
// e = nextE;
count++;
}
col--;
+6 -12
View File
@@ -539,7 +539,6 @@ test.describe('Kitty Graphics Protocol', () => {
test.describe('Query support (a=q)', () => {
test('responds with OK for capability query without payload', async () => {
let response = '';
await ctx.page.evaluate(() => {
(window as any).kittyResponse = '';
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
@@ -548,12 +547,11 @@ test.describe('Kitty Graphics Protocol', () => {
await ctx.proxy.write('\x1b_Gi=31,a=q;\x1b\\');
await timeout(100);
response = await ctx.page.evaluate('window.kittyResponse');
const response = await ctx.page.evaluate('window.kittyResponse');
strictEqual(response, '\x1b_Gi=31;OK\x1b\\');
});
test('responds with OK for valid PNG query', async () => {
let response = '';
await ctx.page.evaluate(() => {
(window as any).kittyResponse = '';
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
@@ -562,7 +560,7 @@ test.describe('Kitty Graphics Protocol', () => {
await ctx.proxy.write(`\x1b_Gi=42,a=q,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
await timeout(100);
response = await ctx.page.evaluate('window.kittyResponse');
const response = await ctx.page.evaluate('window.kittyResponse');
strictEqual(response, '\x1b_Gi=42;OK\x1b\\');
});
@@ -578,7 +576,6 @@ test.describe('Kitty Graphics Protocol', () => {
});
test('responds with error for invalid base64', async () => {
let response = '';
await ctx.page.evaluate(() => {
(window as any).kittyResponse = '';
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
@@ -587,12 +584,11 @@ test.describe('Kitty Graphics Protocol', () => {
await ctx.proxy.write('\x1b_Gi=60,a=q,f=100;!!!invalid!!!\x1b\\');
await timeout(100);
response = await ctx.page.evaluate('window.kittyResponse');
const response: string = await ctx.page.evaluate('window.kittyResponse');
strictEqual(response.startsWith('\x1b_Gi=60;EINVAL:'), true);
});
test('responds with error for RGB data without dimensions', async () => {
let response = '';
await ctx.page.evaluate(() => {
(window as any).kittyResponse = '';
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
@@ -601,7 +597,7 @@ test.describe('Kitty Graphics Protocol', () => {
await ctx.proxy.write('\x1b_Gi=70,a=q,f=24;AAAA\x1b\\');
await timeout(100);
response = await ctx.page.evaluate('window.kittyResponse');
const response = await ctx.page.evaluate('window.kittyResponse');
strictEqual(response, '\x1b_Gi=70;EINVAL:width and height required for raw pixel data\x1b\\');
});
@@ -630,7 +626,6 @@ test.describe('Kitty Graphics Protocol', () => {
});
test('responds with EINVAL when both i and I keys are specified', async () => {
let response = '';
await ctx.page.evaluate(() => {
(window as any).kittyResponse = '';
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
@@ -640,12 +635,11 @@ test.describe('Kitty Graphics Protocol', () => {
await ctx.proxy.write(`\x1b_Gi=100,I=200,a=q,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
await timeout(100);
response = await ctx.page.evaluate('window.kittyResponse');
const response = await ctx.page.evaluate('window.kittyResponse');
strictEqual(response, '\x1b_Gi=100;EINVAL:cannot specify both i and I keys\x1b\\');
});
test('responds with EINVAL for i+I conflict even without payload', async () => {
let response = '';
await ctx.page.evaluate(() => {
(window as any).kittyResponse = '';
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
@@ -655,7 +649,7 @@ test.describe('Kitty Graphics Protocol', () => {
await ctx.proxy.write('\x1b_Gi=101,I=201,a=d\x1b\\');
await timeout(100);
response = await ctx.page.evaluate('window.kittyResponse');
const response = await ctx.page.evaluate('window.kittyResponse');
strictEqual(response, '\x1b_Gi=101;EINVAL:cannot specify both i and I keys\x1b\\');
});
});
+5 -8
View File
@@ -31,15 +31,12 @@
],
"license": "MIT",
"dependencies": {
"lru-cache": "^6.0.0",
"opentype.js": "^0.8.0"
"lru-cache": "^11.3.6",
"opentype.js": "^2.0.0"
},
"devDependencies": {
"@types/lru-cache": "^5.1.0",
"@types/opentype.js": "^0.7.0",
"axios": "^1.15.0",
"font-finder": "^1.1.0",
"mkdirp": "0.5.5",
"yauzl": "^3.2.1"
"@types/lru-cache": "^7.10.9",
"@types/opentype.js": "^1.3.9",
"font-finder": "^1.1.0"
}
}
@@ -1,5 +1,5 @@
import * as opentype from 'opentype.js';
import LRUCache = require('lru-cache');
import { LRUCache } from 'lru-cache';
import { IFont, ILigatureData, IFlattenedLookupTree, ILookupTree, IOptions } from './types';
import mergeTrees from './merge';
@@ -23,8 +23,8 @@ class FontImpl implements IFont {
if (options.cacheSize > 0) {
this._cache = new LRUCache({
max: options.cacheSize,
length: ((val: ILigatureData | [number, number][], key: string) => key.length) as any
maxSize: options.cacheSize,
sizeCalculation: ((val: ILigatureData | [number, number][], key: string) => key.length) as any
});
}
@@ -44,7 +44,6 @@ export default function mergeRange(ranges: [number, number][], newRangeStart: nu
// current range
ranges[i - 1][1] = Math.max(newRangeEnd, range[1]);
ranges.splice(i, 1);
inRange = false;
return ranges;
}
// Case 7: New range extends from previous range past the
+3 -3
View File
@@ -174,7 +174,7 @@ export class SearchEngine {
this._terminal.clearSelection();
let startRow = this._terminal.buffer.active.baseY + this._terminal.rows - 1;
let startCol = this._terminal.cols;
const startCol = this._terminal.cols;
const isReverseSearch = true;
this._lineCache.initLinesCache();
@@ -186,14 +186,14 @@ export class SearchEngine {
let result: ISearchResult | undefined;
if (prevSelectedPos) {
searchPosition.startRow = startRow = prevSelectedPos.start.y;
searchPosition.startCol = startCol = prevSelectedPos.start.x;
searchPosition.startCol = prevSelectedPos.start.x;
if (cachedSearchTerm !== term) {
// Try to expand selection to right first.
result = this._findInLine(term, searchPosition, searchOptions, false);
if (!result) {
// If selection was not able to be expanded to the right, then try reverse search
searchPosition.startRow = startRow = prevSelectedPos.end.y;
searchPosition.startCol = startCol = prevSelectedPos.end.x;
searchPosition.startCol = prevSelectedPos.end.x;
}
}
}
@@ -7,10 +7,10 @@
"rootDir": "..",
"outDir": "../out-benchmark",
"types": ["../../../node_modules/@types/node"],
"moduleResolution": "node",
"moduleResolution": "nodenext",
"strict": false,
"target": "es2021",
"module": "commonjs",
"module": "nodenext",
"paths": {
"common/*": ["../../../src/common/*"],
"browser/*": ["../../../src/browser/*"],
@@ -4,10 +4,10 @@
"rootDir": "..",
"outDir": "../out-benchmark",
"types": ["../../../node_modules/@types/node"],
"moduleResolution": "node",
"moduleResolution": "nodenext",
"strict": false,
"target": "es2015",
"module": "commonjs",
"module": "nodenext",
"paths": {
"common/*": ["../../../src/common/*"],
"browser/*": ["../../../src/browser/*"],
@@ -5,7 +5,6 @@
"lib": [
"es2021",
],
// "downlevelIteration": true,
"rootDir": ".",
"outDir": "../out-test",
"sourceMap": true,
@@ -113,8 +113,8 @@ export class LinkComputer {
let line: IBufferLine | undefined;
let topIdx = lineIndex;
let bottomIdx = lineIndex;
let length = 0;
let content = '';
let length;
let content;
const lines: string[] = [];
if ((line = terminal.buffer.active.getLine(lineIndex))) {
@@ -5,7 +5,6 @@
"lib": [
"es2021",
],
// "downlevelIteration": true,
"rootDir": ".",
"outDir": "../out-test",
"sourceMap": true,
+2 -2
View File
@@ -407,8 +407,8 @@ export class WebglRenderer extends Disposable implements IRenderer {
let line: IBufferLine;
let joinedRanges: [number, number][];
let isJoined: boolean;
let skipJoinedCheckUntilX: number = 0;
let isValidJoinRange: boolean = true;
let skipJoinedCheckUntilX: number;
let isValidJoinRange: boolean;
let lastCharX: number;
let range: [number, number];
let isCursorRow: boolean;
-1
View File
@@ -25,7 +25,6 @@
]
},
"strict": true,
"downlevelIteration": true,
"experimentalDecorators": true,
"types": [
"../../../node_modules/@types/mocha"
+1
View File
@@ -2,6 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"target": "es2021",
"types": ["node"],
"outDir": "../out-demo/client",
"rootDir": ".",
"sourceMap": true,
+1 -1
View File
@@ -118,7 +118,7 @@ function startServer(): void {
});
appWs.ws('/terminals/:pid', function (ws, req) {
const term = terminals[parseInt(req.params.pid)];
const term = terminals[parseInt(Array.isArray(req.params.pid) ? req.params.pid[0] : req.params.pid)];
console.log('Connected to terminal ' + term.pid);
temporaryDisposable[term.pid].dispose();
delete temporaryDisposable[term.pid];
+1 -1
View File
@@ -37,7 +37,7 @@ export default tseslint.config(
'@stylistic/comma-spacing': ['warn', { before: false, after: true }],
'@stylistic/indent': ['warn', 2],
'@stylistic/semi': ['warn', 'always'],
'@stylistic/quotes': ['warn', 'single', { allowTemplateLiterals: true }],
'@stylistic/quotes': ['warn', 'single', { allowTemplateLiterals: 'always' }],
'@stylistic/member-delimiter-style': ['warn', {
multiline: { delimiter: 'semi', requireLast: true },
singleline: { delimiter: 'comma', requireLast: false }
+1 -1
View File
@@ -17,7 +17,7 @@ export default tseslint.config(
rules: {
'@stylistic/indent': ['warn', 2],
'@stylistic/semi': ['warn', 'always'],
'@stylistic/quotes': ['warn', 'single', { allowTemplateLiterals: true }],
'@stylistic/quotes': ['warn', 'single', { allowTemplateLiterals: 'always' }],
'@stylistic/member-delimiter-style': ['warn', {
multiline: { delimiter: 'semi', requireLast: true },
singleline: { delimiter: 'comma', requireLast: false }
+2715 -2286
View File
File diff suppressed because it is too large Load Diff
+28 -27
View File
@@ -76,47 +76,48 @@
"prepublishOnly": "npm run package"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@lunapaint/png-codec": "^0.2.0",
"@playwright/test": "^1.57.0",
"@stylistic/eslint-plugin": "^4.4.1",
"@types/chai": "^4.2.22",
"@types/debug": "^4.1.7",
"@playwright/test": "^1.59.1",
"@stylistic/eslint-plugin": "^5.10.0",
"@types/chai": "^5.2.3",
"@types/debug": "^4.1.13",
"@types/deep-equal": "^1.0.1",
"@types/express": "4",
"@types/express": "^5.0.6",
"@types/express-ws": "^3.0.1",
"@types/jsdom": "^27.0.0",
"@types/mocha": "^9.0.0",
"@types/jsdom": "^28.0.1",
"@types/mocha": "^10.0.10",
"@types/node": "^22.19.3",
"@types/trusted-types": "^1.0.6",
"@types/trusted-types": "^2.0.7",
"@types/utf8": "^3.0.0",
"@types/webpack": "^5.28.0",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^8.50.1",
"@typescript-eslint/parser": "^8.50.1",
"@typescript/native-preview": "^7.0.0-dev.20260213.1",
"chai": "^4.3.4",
"@typescript-eslint/eslint-plugin": "^8.59.2",
"@typescript-eslint/parser": "^8.59.2",
"@typescript/native-preview": "^7.0.0-dev.20260509.2",
"chai": "^6.2.2",
"concurrently": "^9.1.2",
"cross-env": "^7.0.3",
"cross-env": "^10.1.0",
"deep-equal": "^2.0.5",
"esbuild": "~0.25.2",
"eslint": "^9.39.2",
"eslint-plugin-jsdoc": "^50.8.0",
"express": "^4.19.2",
"esbuild": "^0.28.0",
"eslint": "^10.3.0",
"eslint-plugin-jsdoc": "^62.9.0",
"express": "^5.2.1",
"express-ws": "^5.0.2",
"jsdom": "^27.3.0",
"mocha": "^10.1.0",
"jsdom": "^29.1.1",
"mocha": "^11.7.5",
"mustache": "^4.2.0",
"node-pty": "^1.2.0-beta.9",
"nyc": "^17.1.0",
"source-map-loader": "^3.0.0",
"nyc": "^18.0.0",
"source-map-loader": "^5.0.0",
"source-map-support": "^0.5.20",
"ts-loader": "^9.3.1",
"ts-loader": "^9.5.7",
"typescript": "^5.9.3",
"typescript-eslint": "^8.50.1",
"typescript-eslint": "^8.59.2",
"utf8": "^3.0.0",
"webpack": "^5.61.0",
"webpack-cli": "^4.9.1",
"ws": "^8.2.3",
"xterm-benchmark": "^0.3.1"
"webpack": "^5.106.2",
"webpack-cli": "^7.0.2",
"ws": "^8.20.0",
"xterm-benchmark": "^0.3.2"
}
}
+1 -1
View File
@@ -212,7 +212,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
if (!this._themeService) return;
for (const req of event) {
let acc: 'foreground' | 'background' | 'cursor' | 'ansi';
let ident = '';
let ident: string;
switch (req.index) {
case SpecialColorIndex.FOREGROUND: // OSC 10 | 110
acc = 'foreground';
+1 -1
View File
@@ -125,7 +125,7 @@ function formatError(input: string, output: string, expected: string): string {
// simple debug output of terminal cells
function terminalToString(term: CoreBrowserTerminal): string {
let result = '';
let lineText = '';
let lineText: string;
for (let line = term.buffer.ybase; line < term.buffer.ybase + term.rows; line++) {
lineText = term.buffer.lines.get(line)!.translateToString(true);
// rtrim empty cells as xterm does
@@ -90,14 +90,14 @@ export class DomRendererRowFactory {
let charElement: HTMLSpanElement | undefined;
let cellAmount = 0;
let text = '';
let i = 0;
let i;
let oldBg = 0;
let oldFg = 0;
let oldExt = 0;
let oldLinkHover: number | boolean = false;
let oldSpacing = 0;
let oldIsInSelection: boolean = false;
let spacing = 0;
let spacing;
let skipJoinedCheckUntilX = 0;
const classes: string[] = [];
@@ -231,6 +231,7 @@ export class DomRendererRowFactory {
}
charElement = this._document.createElement('span');
cellAmount = 0;
// eslint-disable-next-line no-useless-assignment
text = '';
}
}
+1 -1
View File
@@ -110,7 +110,7 @@ export class WidthCache implements IDisposable {
* `variant` denotes the font variant to be used.
*/
public get(c: string, bold: boolean | number, italic: boolean | number): number {
let cp = 0;
let cp: number;
if (!bold && !italic && c.length === 1 && (cp = c.charCodeAt(0)) < WidthCacheSettings.FLAT_SIZE) {
if (this._flat[cp] !== WidthCacheSettings.FLAT_UNSET) {
return this._flat[cp];
+1 -1
View File
@@ -367,7 +367,7 @@ export class Gesture extends Disposable {
private _dispatchEvent(event: IGestureEvent): void {
if (event.type === EventType.TAP) {
const currentTime = (new Date()).getTime();
let setTapCount = 0;
let setTapCount;
if (currentTime - this._lastSetTapCountTime > Gesture._clearTapCountTime) {
setTapCount = 1;
} else {
@@ -285,7 +285,7 @@ function substringJoiner(substring: string): (sequence: string) => [number, numb
return (sequence: string): [number, number][] => {
const ranges: [number, number][] = [];
let searchIndex = 0;
let matchIndex = -1;
let matchIndex;
while ((matchIndex = sequence.indexOf(substring, searchIndex)) !== -1) {
const matchEndIndex = matchIndex + substring.length;
+4 -4
View File
@@ -919,10 +919,10 @@ export class SelectionService extends Disposable implements ISelectionService {
// Calculate the start _column_, converting the the string indexes back to
// column coordinates.
let start =
startIndex // The index of the selection's start char in the line string
+ charOffset // The difference between the initial char's column and index
- leftWideCharCount // The number of wide chars left of the initial char
+ leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)
startIndex // The index of the selection's start char in the line string
+ charOffset // The difference between the initial char's column and index
- leftWideCharCount // The number of wide chars left of the initial char
+ leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)
// Calculate the length in _columns_, converting the the string indexes back
// to column coordinates.
+2 -2
View File
@@ -74,10 +74,10 @@ abstract class TaskQueue implements ITaskQueue {
private _process(deadline: ITaskDeadline): void {
this._idleCallback = undefined;
let taskDuration = 0;
let taskDuration: number;
let longestTask = 0;
let lastDeadlineRemaining = deadline.timeRemaining();
let deadlineRemaining = 0;
let deadlineRemaining: number;
while (this._i < this._tasks.length) {
taskDuration = performance.now();
if (!this._tasks[this._i]()) {
+3 -6
View File
@@ -98,8 +98,7 @@ CHARSETS['4'] = {
* ESC (C or ESC (5
* Reference: http://vt100.net/docs/vt220-rm/table2-7.html
*/
CHARSETS['C'] =
CHARSETS['5'] = {
CHARSETS['C'] = CHARSETS['5'] = {
'[': 'Ä',
'\\': 'Ö',
']': 'Å',
@@ -185,8 +184,7 @@ CHARSETS['Y'] = {
* ESC (E or ESC (6
* Reference: http://vt100.net/docs/vt220-rm/table2-12.html
*/
CHARSETS['E'] =
CHARSETS['6'] = {
CHARSETS['E'] = CHARSETS['6'] = {
'@': 'Ä',
'[': 'Æ',
'\\': 'Ø',
@@ -220,8 +218,7 @@ CHARSETS['Z'] = {
* ESC (H or ESC (7
* Reference: http://vt100.net/docs/vt220-rm/table2-14.html
*/
CHARSETS['H'] =
CHARSETS['7'] = {
CHARSETS['H'] = CHARSETS['7'] = {
'@': 'É',
'[': 'Ä',
'\\': 'Ö',
+1 -1
View File
@@ -148,7 +148,7 @@ export class Utf8ToUtf32 {
let byte2: number;
let byte3: number;
let byte4: number;
let codepoint = 0;
let codepoint;
let startPos = 0;
// handle leftover bytes
+2 -2
View File
@@ -572,8 +572,8 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
* ```
*/
public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise<boolean> {
let code = 0;
let transition = 0;
let code: number;
let transition: number;
let start = 0;
let handlerResult: void | boolean | Promise<boolean>;
+4 -4
View File
@@ -72,10 +72,10 @@ export class DecorationService extends Disposable implements IDecorationService
}
public *getDecorationsAtCell(x: number, line: number, layer?: 'bottom' | 'top'): IterableIterator<IInternalDecoration> {
let xmin = 0;
let xmax = 0;
let ymin = 0;
let ymax = 0;
let xmin;
let xmax;
let ymin;
let ymax;
for (const d of this._decorations.values()) {
ymin = d.marker.line;
ymax = ymin + (d.options.height ?? 1);
+1 -2
View File
@@ -4,7 +4,6 @@
"composite": true,
"strict": true,
"declarationMap": true,
"experimentalDecorators": true,
"downlevelIteration": true
"experimentalDecorators": true
}
}
+2 -2
View File
@@ -8,10 +8,10 @@
"types": [
"../../node_modules/@types/node"
],
"moduleResolution": "node",
"moduleResolution": "nodenext",
"strict": false,
"target": "es2021",
"module": "commonjs",
"module": "nodenext",
"paths": {
"common/*": [ "../../src/common/*" ],
"browser/*": [ "../../src/browser/*" ],
+2 -2
View File
@@ -16,7 +16,7 @@
"strict": true,
"noImplicitAny": false,
"declaration": true,
"moduleResolution": "node",
"moduleResolution": "nodenext",
"paths": {
"browser/*": [
"../../src/browser/*"
@@ -26,7 +26,7 @@
]
},
"target": "ESNext",
"module": "commonjs",
"module": "nodenext",
"composite": true
},
"include": [