lint & fixes

This commit is contained in:
Eugene
2026-07-12 01:08:56 +02:00
parent 3a4a41431a
commit ffe60ce9bc
11 changed files with 1002 additions and 4507 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import LRU from 'lru-cache' import { LRUCache } from 'lru-cache'
import * as fs from 'fs' import * as fs from 'fs'
const lru = new LRU({ max: 256, maxAge: 250 }) const lru = new LRUCache<string, string>({ ttl: 250, ttlAutopurge: true })
const origLstat = fs.realpathSync.bind(fs) const origLstat = fs.realpathSync.bind(fs)
// NB: The biggest offender of thrashing realpathSync is the node module system // NB: The biggest offender of thrashing realpathSync is the node module system
+2 -2
View File
@@ -16,8 +16,8 @@
}, },
"dependencies": { "dependencies": {
"@electron/remote": "^2", "@electron/remote": "^2",
"atomically": "^2.0.2",
"any-promise": "^1.3.0", "any-promise": "^1.3.0",
"atomically": "^2.0.2",
"dunder-proto": "^1", "dunder-proto": "^1",
"electron-config": "2.0.0", "electron-config": "2.0.0",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",
@@ -30,7 +30,7 @@
"mz": "^2.7.0", "mz": "^2.7.0",
"native-process-working-directory": "^1.0.2", "native-process-working-directory": "^1.0.2",
"node-pty": "^1.2.0-beta.8", "node-pty": "^1.2.0-beta.8",
"npm": "6", "npm": "12",
"russh": "0.1.37", "russh": "0.1.37",
"rxjs": "^7.5.7", "rxjs": "^7.5.7",
"source-map-support": "^0.5.20", "source-map-support": "^0.5.20",
+937 -2357
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -28,7 +28,6 @@
"@typescript-eslint/eslint-plugin": "^6.4.1", "@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1", "@typescript-eslint/parser": "^6.4.1",
"apply-loader": "2.0.0", "apply-loader": "2.0.0",
"axios": "^1.4.0",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
"browserify-sign": "^4.2.1", "browserify-sign": "^4.2.1",
"clone-deep": "^4.0.1", "clone-deep": "^4.0.1",
@@ -57,7 +56,6 @@
"ngx-filesize": "^3.0.2", "ngx-filesize": "^3.0.2",
"node-abi": "^4", "node-abi": "^4",
"npmlog": "6.0.2", "npmlog": "6.0.2",
"npx": "^10.2.2",
"patch-package": "^6.4.7", "patch-package": "^6.4.7",
"po-gettext-loader": "^1.0.0", "po-gettext-loader": "^1.0.0",
"pug": "3", "pug": "3",
@@ -1,5 +1,4 @@
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import axios from 'axios'
import { Logger, LogService, ConfigService, UpdaterService, PlatformService, TranslateService } from 'tabby-core' import { Logger, LogService, ConfigService, UpdaterService, PlatformService, TranslateService } from 'tabby-core'
import { ElectronService } from '../services/electron.service' import { ElectronService } from '../services/electron.service'
@@ -101,8 +100,8 @@ export class ElectronUpdaterService extends UpdaterService {
} else { } else {
this.logger.debug('Checking for updates through fallback method.') this.logger.debug('Checking for updates through fallback method.')
const response = await axios.get(UPDATES_URL) const response = await fetch(UPDATES_URL)
const data = response.data const data = await response.json()
const version = data.tag_name.substring(1) const version = data.tag_name.substring(1)
if (this.electron.app.getVersion() !== version) { if (this.electron.app.getVersion() !== version) {
this.logger.info('Update available') this.logger.info('Update available')
-1
View File
@@ -1,5 +1,4 @@
import * as tmp from 'tmp-promise' import * as tmp from 'tmp-promise'
import * as path from 'path'
import * as fs from 'fs' import * as fs from 'fs'
import { Subject, debounceTime, debounce } from 'rxjs' import { Subject, debounceTime, debounce } from 'rxjs'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
@@ -1,4 +1,3 @@
import axios from 'axios'
import { compare as semverCompare } from 'semver' import { compare as semverCompare } from 'semver'
import { Observable, from, forkJoin, map, of } from 'rxjs' import { Observable, from, forkJoin, map, of } from 'rxjs'
import { Injectable, Inject } from '@angular/core' import { Injectable, Inject } from '@angular/core'
@@ -51,9 +50,9 @@ export class PluginManagerService {
_listAvailableInternal (namePrefix: string, keyword: string, query?: string): Observable<PluginInfo[]> { _listAvailableInternal (namePrefix: string, keyword: string, query?: string): Observable<PluginInfo[]> {
return from( return from(
axios.get(`https://registry.npmjs.com/-/v1/search?text=keywords%3A${keyword}%20${query}&size=250`), fetch(`https://registry.npmjs.com/-/v1/search?text=keywords%3A${keyword}%20${query}&size=250`).then(r => r.json()),
).pipe( ).pipe(
map(response => response.data.objects map(response => response.objects
.filter(item => !item.keywords?.includes('tabby-dummy-transition-plugin')) .filter(item => !item.keywords?.includes('tabby-dummy-transition-plugin'))
.map(item => ({ .map(item => ({
name: item.package.name.substring(namePrefix.length), name: item.package.name.substring(namePrefix.length),
-1
View File
@@ -18,7 +18,6 @@
"author": "Tabby Developers", "author": "Tabby Developers",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/marked": "^5.0.1",
"marked": "^9.1.4", "marked": "^9.1.4",
"ngx-infinite-scroll": "^16" "ngx-infinite-scroll": "^16"
}, },
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker' import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
import axios from 'axios'
import * as marked from '../../node_modules/marked/src/marked' import * as marked from '../../node_modules/marked/src/marked'
import { Component, Injector } from '@angular/core' import { Component, Injector } from '@angular/core'
import { BaseTabComponent, TranslateService } from 'tabby-core' import { BaseTabComponent, TranslateService } from 'tabby-core'
@@ -30,10 +29,11 @@ export class ReleaseNotesComponent extends BaseTabComponent {
async loadReleases (page) { async loadReleases (page) {
console.log('Loading releases page', page) console.log('Loading releases page', page)
const response = await axios.get(`https://api.github.com/repos/eugeny/tabby/releases?page=${page}`, { const response = await fetch(`https://api.github.com/repos/eugeny/tabby/releases?page=${page}`, {
headers: { Accept: 'application/vnd.github.v3+json' }, headers: { Accept: 'application/vnd.github.v3+json' },
}) })
this.releases = this.releases.concat(response.data.map(r => ({ const releases = await response.json()
this.releases = this.releases.concat(releases.map(r => ({
name: r.name, name: r.name,
version: r.tag_name, version: r.tag_name,
content: marked.marked(r.body), content: marked.marked(r.body),
@@ -1,5 +1,4 @@
import * as yaml from 'js-yaml' import * as yaml from 'js-yaml'
import axios from 'axios'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { ConfigService, HostAppService, Logger, LogService, Platform, PlatformService } from 'tabby-core' import { ConfigService, HostAppService, Logger, LogService, Platform, PlatformService } from 'tabby-core'
@@ -159,7 +158,7 @@ export class ConfigSyncService {
await this.config.save() await this.config.save()
} }
private async request (method: 'GET'|'POST'|'PATCH'|'DELETE', url: string, params = {}) { private async request (method: 'GET'|'POST'|'PATCH'|'DELETE', url: string, { data }: { data?: any } = {}) {
if (this.config.store.configSync.host.endsWith('/')) { if (this.config.store.configSync.host.endsWith('/')) {
this.config.store.configSync.host = this.config.store.configSync.host.slice(0, -1) this.config.store.configSync.host = this.config.store.configSync.host.slice(0, -1)
} }
@@ -175,18 +174,23 @@ export class ConfigSyncService {
throw new Error(message) throw new Error(message)
} }
url = host + url url = host + url
this.logger.debug(`${method} ${url}`, params) this.logger.debug(`${method} ${url}`, data)
try { try {
const response = await axios.request({ const response = await fetch(url, {
url,
method, method,
headers: { headers: {
Authorization: `Bearer ${this.config.store.configSync.token}`, Authorization: `Bearer ${this.config.store.configSync.token}`,
...data !== undefined ? { 'Content-Type': 'application/json' } : {},
}, },
...params, body: data !== undefined ? JSON.stringify(data) : undefined,
}) })
if (!response.ok) {
throw new Error(`${method} ${url} failed: ${response.status} ${response.statusText}`)
}
this.logger.debug(response) this.logger.debug(response)
return response.data // ponytail: DELETE returns empty 204, parse only if there's a body
const text = await response.text()
return text ? JSON.parse(text) : undefined
} catch (error) { } catch (error) {
this.logger.error(error) this.logger.error(error)
throw error throw error
+43 -2126
View File
File diff suppressed because it is too large Load Diff