Add Oxlint configuration and integrate linting commands

- Introduced a new `.oxlintrc.json` file to configure Oxlint for code quality checks.
- Updated `package.json` to include linting scripts (`lint` and `lint:fix`) for easier code maintenance.
- Enhanced documentation in `README` files to guide users on running Oxlint checks and applying fixes.
This commit is contained in:
discountry
2026-03-12 22:40:18 +08:00
parent 055bb445a9
commit eb70bab8c5
21 changed files with 95 additions and 46 deletions
+1 -1
View File
@@ -409,7 +409,7 @@ export class BasisArbEngine {
if (!Number.isFinite(wallet) || !Number.isFinite(available)) continue;
if (Math.abs(wallet) === 0 && Math.abs(available) === 0) continue;
const isTaggedFuturesAsset = /0$/.test(name);
const isTaggedFuturesAsset = name.endsWith("0");
if (isTaggedFuturesAsset) {
futuresBalances.push({ asset: name.replace(/0$/, ""), wallet, available });
continue;
+1 -1
View File
@@ -461,7 +461,7 @@ export class GridEngine {
return false;
}
private async haltGrid(price: number): Promise<void> {
private async haltGrid(_price: number): Promise<void> {
if (!this.running) return;
const reason = this.stopReason ?? "触发网格止损";
this.log("warn", `${reason},开始执行平仓与撤单`);
-1
View File
@@ -3,7 +3,6 @@ import type { ExchangeAdapter } from "../exchanges/adapter";
import type {
AsterAccountSnapshot,
AsterDepth,
AsterKline,
AsterOrder,
AsterTicker,
} from "../exchanges/types";
+1 -2
View File
@@ -422,7 +422,7 @@ export class SwingEngine {
: position.entryPrice * (1 + Math.max(0, this.config.stopLossPct));
const tick = Math.max(1e-9, this.config.priceTick);
const lastPrice = referencePrice ?? Number(this.tickerSnapshot?.lastPrice) ?? null;
const lastPrice = referencePrice;
// Kill-switch (always-on).
const triggerKill =
@@ -621,4 +621,3 @@ export class SwingEngine {
});
}
}
+1 -1
View File
@@ -386,7 +386,7 @@ export class TrendEngine {
private async enforceRateLimitStop(): Promise<void> {
const position = getPosition(this.accountSnapshot, this.config.symbol);
if (Math.abs(position.positionAmt) < 1e-5) return;
const price = this.getReferencePrice() ?? Number(this.tickerSnapshot?.lastPrice) ?? this.lastPrice;
const price = this.getReferencePrice();
if (!Number.isFinite(price) || price == null) return;
const result = await this.handlePositionManagement(position, Number(price));
if (result.closed) {