chore: lint

This commit is contained in:
xiaojunnuo
2026-07-15 01:25:55 +08:00
parent 167b303fae
commit 6cc74a1c0a
26 changed files with 29 additions and 75 deletions
+1
View File
@@ -39,6 +39,7 @@
"test:unit": "cross-env NODE_ENV=unittest pnpm -r --workspace-concurrency=1 run test:unit", "test:unit": "cross-env NODE_ENV=unittest pnpm -r --workspace-concurrency=1 run test:unit",
"pub": "echo 1", "pub": "echo 1",
"dev": "pnpm run -r --parallel compile ", "dev": "pnpm run -r --parallel compile ",
"lint_all": "pnpm run -r --parallel lint ",
"pub_all": "node ./scripts/pub-all.js", "pub_all": "node ./scripts/pub-all.js",
"release": "time /t >trigger/release.trigger && git add trigger/release.trigger && git commit -m \"build: release\" && git push", "release": "time /t >trigger/release.trigger && git add trigger/release.trigger && git commit -m \"build: release\" && git push",
"publish_to_atomgit": "node --experimental-json-modules ./scripts/publish-atomgit.js", "publish_to_atomgit": "node --experimental-json-modules ./scripts/publish-atomgit.js",
+2 -1
View File
@@ -28,7 +28,8 @@
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"esmock": "^2.7.5", "esmock": "^2.7.5",
"prettier": "3.3.3", "prettier": "3.3.3",
"tslib": "^2.8.1" "tslib": "^2.8.1",
"eslint": "^8.57.0"
}, },
"gitHead": "268cd6cc9cb4f1f3d5d5d77859a82f18f0cb6db7" "gitHead": "268cd6cc9cb4f1f3d5d5d77859a82f18f0cb6db7"
} }
+2 -1
View File
@@ -39,7 +39,8 @@
"js-yaml": "^3.11.0", "js-yaml": "^3.11.0",
"mocha": "^10.6.0", "mocha": "^10.6.0",
"prettier": "3.3.3", "prettier": "3.3.3",
"tslib": "^2.8.1" "tslib": "^2.8.1",
"eslint": "^8.57.0"
}, },
"engines": { "engines": {
"node": ">= 8.6.0", "node": ">= 8.6.0",
@@ -24,7 +24,7 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
codeService: CodeService; codeService: CodeService;
@Inject() @Inject()
addonService: AddonService; addonService: AddonService;
getService() { getService() {
return this.service; return this.service;
} }
@@ -223,8 +223,3 @@ getService() {
return this.ok(true); return this.ok(true);
} }
} }
@@ -10,7 +10,6 @@ import { AutoFix } from "./fix/auto-fix.js";
@Autoload() @Autoload()
@Scope(ScopeEnum.Request, { allowDowngrade: true }) @Scope(ScopeEnum.Request, { allowDowngrade: true })
export class AutoARegister { export class AutoARegister {
//这个A是必须,让他排在第一个 进行init,否则会被其他init模块抢先注册导致报错 //这个A是必须,让他排在第一个 进行init,否则会被其他init模块抢先注册导致报错
@Inject() @Inject()
autoInitSite: AutoInitSite; autoInitSite: AutoInitSite;
@@ -44,4 +43,3 @@ export class AutoARegister {
await this.autoPrint.init(); await this.autoPrint.init();
} }
} }
@@ -13,7 +13,7 @@ export class AutoLoadPlugins {
@Inject() @Inject()
pluginService: PluginService; pluginService: PluginService;
@Config('runtimeDeps') @Config("runtimeDeps")
runtimeDepsConfig: any; runtimeDepsConfig: any;
async init() { async init() {
@@ -39,18 +39,15 @@ export class AutoLoadPlugins {
logger.info(`加载插件完成,加载模式:${process.env.certd_plugin_loadmode}`); logger.info(`加载插件完成,加载模式:${process.env.certd_plugin_loadmode}`);
//初始化第三方依赖服务 //初始化第三方依赖服务
initRuntimeDepsService(this.runtimeDepsConfig,{ initRuntimeDepsService(this.runtimeDepsConfig, {
pluginRegistry, pluginRegistry,
accessRegistry, accessRegistry,
notificationRegistry, notificationRegistry,
dnsProviderRegistry, dnsProviderRegistry,
addonRegistry, addonRegistry,
}); });
// 收集插件 dependPackages 并安装 // 收集插件 dependPackages 并安装
const service = getRuntimeDepsService(); const service = getRuntimeDepsService();
service.refreshPluginDeps(); service.refreshPluginDeps();
} }
} }
@@ -7,7 +7,6 @@ import { CaptchaService } from "./captcha-service.js";
import { EmailService } from "./email-service.js"; import { EmailService } from "./email-service.js";
import { CaptchaRequest } from "../../../plugins/plugin-captcha/api.js"; import { CaptchaRequest } from "../../../plugins/plugin-captcha/api.js";
// {data: '<svg.../svg>', text: 'abcd'} // {data: '<svg.../svg>', text: 'abcd'}
/** /**
*/ */
@@ -25,7 +24,7 @@ export class CodeService {
@Inject() @Inject()
captchaService: CaptchaService; captchaService: CaptchaService;
async checkCaptcha(body: any, req: CaptchaRequest) { async checkCaptcha(body: any, req: CaptchaRequest) {
return await this.captchaService.doValidate({ form: body, req }); return await this.captchaService.doValidate({ form: body, req });
} }
/** /**
@@ -196,7 +195,3 @@ async checkCaptcha(body: any, req: CaptchaRequest) {
return cache.get(this.buildValidationValueKey(code)); return cache.get(this.buildValidationValueKey(code));
} }
} }
@@ -117,5 +117,3 @@ export class TencentSmsService implements ISmsService {
} }
} }
} }
@@ -4,7 +4,6 @@ import { UserSettingsService } from "./user-settings-service.js";
import { UserTwoFactorSetting } from "./models.js"; import { UserTwoFactorSetting } from "./models.js";
import { UserService } from "../../sys/authority/service/user-service.js"; import { UserService } from "../../sys/authority/service/user-service.js";
/** /**
* 授权 * 授权
*/ */
@@ -15,7 +14,7 @@ export class TwoFactorService {
userSettingsService: UserSettingsService; userSettingsService: UserSettingsService;
@Inject() @Inject()
userService: UserService; userService: UserService;
async getAuthenticatorQrCode(userId: any) { async getAuthenticatorQrCode(userId: any) {
const setting = await this.getSetting(userId); const setting = await this.getSetting(userId);
const authenticatorSetting = setting.authenticator; const authenticatorSetting = setting.authenticator;
@@ -89,6 +88,3 @@ async getAuthenticatorQrCode(userId: any) {
return true; return true;
} }
} }
@@ -14,7 +14,6 @@ import { CertInfoService } from "../../../monitor/index.js";
import { ICertInfoGetter } from "@certd/plugin-lib"; import { ICertInfoGetter } from "@certd/plugin-lib";
import { CnameProviderService } from "../../../cname/service/cname-provider-service.js"; import { CnameProviderService } from "../../../cname/service/cname-provider-service.js";
const serviceNames = ["ocrService"]; const serviceNames = ["ocrService"];
export class TaskServiceGetter implements IServiceGetter { export class TaskServiceGetter implements IServiceGetter {
private userId: number; private userId: number;
@@ -100,5 +99,3 @@ export type TaskServiceCreateReq = {
userId: number; userId: number;
projectId?: number; projectId?: number;
}; };
@@ -48,7 +48,7 @@ export class PluginService extends BaseService<PluginEntity> {
@Inject() @Inject()
builtInPluginService: BuiltInPluginService; builtInPluginService: BuiltInPluginService;
//@ts-ignore //@ts-ignore
getRepository() { getRepository() {
return this.repository; return this.repository;
} }
@@ -297,7 +297,7 @@ export class PluginService extends BaseService<PluginEntity> {
await this.refreshPluginDeps(); await this.refreshPluginDeps();
} }
async refreshPluginDeps(){ async refreshPluginDeps() {
const service = getRuntimeDepsService(); const service = getRuntimeDepsService();
service.refreshPluginDeps(); service.refreshPluginDeps();
} }
@@ -566,5 +566,3 @@ export class PluginService extends BaseService<PluginEntity> {
} }
} }
} }
@@ -209,4 +209,3 @@ export class AliyunDnsProvider extends AbstractDnsProvider {
} }
new AliyunDnsProvider(); new AliyunDnsProvider();
@@ -275,4 +275,3 @@ export class DeployCertToAliyunAckPlugin extends AbstractTaskPlugin {
} }
new DeployCertToAliyunAckPlugin(); new DeployCertToAliyunAckPlugin();
@@ -239,7 +239,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
access: client.access, access: client.access,
logger: this.logger, logger: this.logger,
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
const certIds = []; const certIds = [];
for (const item of list) { for (const item of list) {
@@ -295,7 +295,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
access, access,
logger: this.logger, logger: this.logger,
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
if (certInfo.crt) { if (certInfo.crt) {
const certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt)); const certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt));
@@ -404,4 +404,3 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
} }
new AliyunDeployCertToALB(); new AliyunDeployCertToALB();
@@ -136,7 +136,7 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
access, access,
logger: this.logger, logger: this.logger,
endpoint: this.endpoint || "cas.aliyuncs.com", endpoint: this.endpoint || "cas.aliyuncs.com",
}); });
if (this.domainMatchMode === "auto") { if (this.domainMatchMode === "auto") {
const { result, deployedList } = await this.autoMatchedDeploy({ const { result, deployedList } = await this.autoMatchedDeploy({
@@ -293,4 +293,3 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
} }
} }
new DeployCertToAliyunCDN(); new DeployCertToAliyunCDN();
@@ -224,4 +224,3 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
} }
} }
new DeployCertToAliyunDCDN(); new DeployCertToAliyunDCDN();
@@ -221,7 +221,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
access: client.access, access: client.access,
logger: this.logger, logger: this.logger,
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
const certIds = []; const certIds = [];
for (const item of list) { for (const item of list) {
@@ -286,7 +286,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
access, access,
logger: this.logger, logger: this.logger,
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
const certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt)); const certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt));
@@ -389,4 +389,3 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
} }
new AliyunDeployCertToNLB(); new AliyunDeployCertToNLB();
@@ -234,7 +234,7 @@ export class AliyunDeployCertToSLB extends AbstractTaskPlugin {
access, access,
logger: this.logger, logger: this.logger,
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
if (typeof this.cert === "object") { if (typeof this.cert === "object") {
const name = this.appendTimeSuffix("certd"); const name = this.appendTimeSuffix("certd");
@@ -412,4 +412,3 @@ export class AliyunDeployCertToSLB extends AbstractTaskPlugin {
} }
new AliyunDeployCertToSLB(); new AliyunDeployCertToSLB();
@@ -316,4 +316,3 @@ export class AliyunDeployCertToWafCloud extends AbstractTaskPlugin {
} }
new AliyunDeployCertToWafCloud(); new AliyunDeployCertToWafCloud();
@@ -144,7 +144,7 @@ export class AliyunDeployCertToWaf extends AbstractTaskPlugin {
access, access,
logger: this.logger, logger: this.logger,
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
const cert = this.cert as CertInfo; const cert = this.cert as CertInfo;
const casCert = this.cert as CasCertInfo; const casCert = this.cert as CasCertInfo;
@@ -250,4 +250,3 @@ export class AliyunDeployCertToWaf extends AbstractTaskPlugin {
} }
new AliyunDeployCertToWaf(); new AliyunDeployCertToWaf();
@@ -85,7 +85,7 @@ export class AliyunAccess extends BaseAccess {
access: this, access: this,
logger: this.ctx.logger, logger: this.ctx.logger,
endpoint, endpoint,
}); });
return client; return client;
} }
@@ -94,9 +94,8 @@ export class AliyunAccess extends BaseAccess {
access: this, access: this,
logger: this.ctx.logger, logger: this.ctx.logger,
endpoint: endpoint, endpoint: endpoint,
}); });
} }
} }
new AliyunAccess(); new AliyunAccess();
@@ -20,13 +20,11 @@ export class AliyunClientV2 {
logger: ILogger; logger: ILogger;
endpoint: string; endpoint: string;
client: any; client: any;
constructor(opts: { access: AliyunAccess; logger: ILogger; endpoint: string }) { constructor(opts: { access: AliyunAccess; logger: ILogger; endpoint: string }) {
this.access = opts.access; this.access = opts.access;
this.logger = opts.logger; this.logger = opts.logger;
this.endpoint = opts.endpoint; this.endpoint = opts.endpoint;
} }
async importRuntime(name: string) { async importRuntime(name: string) {
@@ -96,4 +94,3 @@ export class AliyunClientV2 {
return res?.body; return res?.body;
} }
} }
@@ -7,7 +7,6 @@ export class AliyunClient {
agent: any; agent: any;
useROAClient: boolean; useROAClient: boolean;
constructor(opts: { logger: ILogger; useROAClient?: boolean }) { constructor(opts: { logger: ILogger; useROAClient?: boolean }) {
this.logger = opts.logger; this.logger = opts.logger;
this.useROAClient = opts.useROAClient || false; this.useROAClient = opts.useROAClient || false;
@@ -82,4 +81,3 @@ export class AliyunClient {
return res; return res;
} }
} }
@@ -12,7 +12,6 @@ export type AliyunSslClientOpts = {
logger: ILogger; logger: ILogger;
endpoint?: string; endpoint?: string;
region?: string; region?: string;
}; };
export type AliyunSslGetResourceListReq = { export type AliyunSslGetResourceListReq = {
@@ -47,7 +46,6 @@ export class AliyunSslClient {
constructor(opts: AliyunSslClientOpts) { constructor(opts: AliyunSslClientOpts) {
this.opts = opts; this.opts = opts;
this.logger = opts.logger; this.logger = opts.logger;
} }
checkRet(ret: any) { checkRet(ret: any) {
@@ -254,5 +252,3 @@ export class AliyunSslClient {
} }
} }
} }
@@ -19,7 +19,7 @@ export default class TencentOssClientImpl extends BaseOssClient<TencentCosAccess
logger: this.logger, logger: this.logger,
region: this.access.region, region: this.access.region,
bucket: this.access.bucket, bucket: this.access.bucket,
}); });
} }
async download(filePath: string, savePath: string): Promise<void> { async download(filePath: string, savePath: string): Promise<void> {
const key = this.join(this.rootDir, filePath); const key = this.join(this.rootDir, filePath);
@@ -52,4 +52,3 @@ export default class TencentOssClientImpl extends BaseOssClient<TencentCosAccess
this.logger.info(`文件删除成功: ${filePath}`); this.logger.info(`文件删除成功: ${filePath}`);
} }
} }
@@ -9,13 +9,11 @@ export class TencentCosClient {
region: string; region: string;
bucket: string; bucket: string;
constructor(opts: { access: TencentAccess; logger: ILogger; region: string; bucket: string }) { constructor(opts: { access: TencentAccess; logger: ILogger; region: string; bucket: string }) {
this.access = opts.access; this.access = opts.access;
this.logger = opts.logger; this.logger = opts.logger;
this.bucket = opts.bucket; this.bucket = opts.bucket;
this.region = opts.region; this.region = opts.region;
} }
async importRuntime(specifier: string) { async importRuntime(specifier: string) {
@@ -122,4 +120,3 @@ export class TencentCosClient {
}); });
} }
} }