Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/core/src/common/contributors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('createContributorsList', () => {

expect(globalThis.fetch).toHaveBeenCalledTimes(REPO_COUNT);
expect(result.external).toHaveLength(1);
expect(result.external[0].contributions).toBe(15); // 10 + 5
expect(result.external[0]?.contributions).toBe(15); // 10 + 5
});

it('should use cached value and avoid network calls before TTL expires', async () => {
Expand Down
7 changes: 1 addition & 6 deletions apps/core/src/routes/api/setup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import path from 'node:path';
import { Type, type Static } from '@sinclair/typebox';
import type { FastifyPluginAsync } from 'fastify';
import { repo } from '@fxmanager/database';
import { UserPermissions } from '@fxmanager/shared/constants';
import type { ApiResponse } from '@fxmanager/shared/types';
import { COOKIE_NAME, fileExists, isFxManagerSetup } from '../../common/utils';
import { COOKIE_NAME, isFxManagerSetup } from '../../common/utils';
import { ConfigManager } from '../../modules/config/manager';
import { setupTokenManager } from '../../modules/setup/token';
import type { RouteModule } from '../../types';
Expand Down Expand Up @@ -49,10 +48,6 @@ const SetupEndpoint: FastifyPluginAsync = async (fastify) => {
}

const cfg = ConfigManager.getInstance().getFxServerValues();
const cfgPath = path.isAbsolute(cfg.serverConfigFile)
? cfg.serverConfigFile
: path.join(cfg.serverDataPath, cfg.serverConfigFile);

const result = await ConfigManager.getInstance().checkFXServerPaths(
cfg.executablePath,
cfg.serverDataPath,
Expand Down
1 change: 0 additions & 1 deletion apps/core/src/routes/internal/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ResourceData } from '@fxmanager/shared/types';
import { resourceAuth } from '../../middleware/resource';
import type { RouteModule } from '../../types';

Expand Down
10 changes: 1 addition & 9 deletions apps/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
"skipLibCheck": true
}
}
5 changes: 0 additions & 5 deletions apps/resource/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
"lib": ["es2022"],
"resolveJsonModule": true,
"esModuleInterop": true,
"allowUnreachableCode": false,
"strictFunctionTypes": true,
"moduleResolution": "bundler",
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"skipLibCheck": true
},
"include": ["./src", "./web"]
Expand Down
8 changes: 1 addition & 7 deletions apps/resource/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"jsx": "react-jsx"
},
"include": ["./src", "./nui.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down
11 changes: 10 additions & 1 deletion apps/resource/web/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true
"strict": true,

// Linting
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noUncheckedSideEffectImports": true,
"allowUnreachableCode": false
},
"include": ["vite.config.ts"]
}
4 changes: 3 additions & 1 deletion apps/webpanel/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noUncheckedSideEffectImports": true,
"allowUnreachableCode": false,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
Expand Down
6 changes: 4 additions & 2 deletions apps/webpanel/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noUncheckedSideEffectImports": true,
"allowUnreachableCode": false
},
"include": ["vite.config.ts"]
}
24 changes: 12 additions & 12 deletions packages/database/src/import/txadmin.importer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ describe('importTxAdmin - players', () => {

const players = db.select().from(schema.players).all();
expect(players).toHaveLength(1);
expect(players[0].name).toBe('CaliChris');
expect(players[0].playtime).toBe(1_440_000);
expect(players[0]!.name).toBe('CaliChris');
expect(players[0]!.playtime).toBe(1_440_000);

const ids = db.select().from(schema.playerIdentifiers).all();
expect(ids.map((i) => i.value).sort()).toEqual(['123', 'abc']);
Expand All @@ -66,8 +66,8 @@ describe('importTxAdmin - players', () => {

const notes = db.select().from(schema.playerNotes).all();
expect(notes).toHaveLength(1);
expect(notes[0].content).toBe('a note');
expect(notes[0].issuer).toBeNull();
expect(notes[0]!.content).toBe('a note');
expect(notes[0]!.issuer).toBeNull();
});

it('is idempotent: re-running creates no duplicate players, ids or notes', () => {
Expand Down Expand Up @@ -124,9 +124,9 @@ describe('importTxAdmin - actions matched to existing players', () => {

const bans = db.select().from(schema.bans).all();
expect(bans).toHaveLength(1);
expect(bans[0].playerId).toBe(1);
expect(bans[0].reason).toBe('Cheating');
expect(bans[0].issuer).toBeNull();
expect(bans[0]!.playerId).toBe(1);
expect(bans[0]!.reason).toBe('Cheating');
expect(bans[0]!.issuer).toBeNull();
});
});

Expand All @@ -152,15 +152,15 @@ describe('importTxAdmin - orphan actions', () => {

const players = db.select().from(schema.players).all();
expect(players).toHaveLength(1);
expect(players[0].name).toBe('GhostBanned');
expect(players[0]!.name).toBe('GhostBanned');
expect(summary.stubPlayers).toBe(1);

const ids = db.select().from(schema.playerIdentifiers).all();
expect(ids).toHaveLength(1);
expect(ids[0].value).toBe('orphan');
expect(ids[0]!.value).toBe('orphan');

const bans = db.select().from(schema.bans).all();
expect(bans[0].playerId).toBe(players[0].id);
expect(bans[0]!.playerId).toBe(players[0]!.id);
});

it('reuses the same stub player for two actions sharing an identifier', () => {
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('importTxAdmin - ban fields', () => {
],
};
importTxAdmin(localDb, data);
return localDb.select().from(schema.bans).all()[0];
return localDb.select().from(schema.bans).all()[0]!;
}

it('stores a permanent ban with null expiresAt', () => {
Expand Down Expand Up @@ -245,7 +245,7 @@ describe('importTxAdmin - warn fields', () => {
],
};
importTxAdmin(localDb, data);
return localDb.select().from(schema.warns).all()[0];
return localDb.select().from(schema.warns).all()[0]!;
}

it('marks an acked warn as read', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/import/txadmin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ describe('parseTxAdminDb', () => {
expect(result.players).toHaveLength(1);
expect(result.actions).toHaveLength(1);
expect(result.whitelist).toHaveLength(1);
expect(result.players[0].name).toBe('P1');
expect(result.players[0]!.name).toBe('P1');
expect(result.whitelist[0]).toEqual({
type: 'discord',
value: 'discord:999',
Expand Down
8 changes: 4 additions & 4 deletions packages/database/src/migrations/migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ describe('Database Migration Runner', () => {
// Assert that migrations were tracked and documented chronologically by version number
const history = getTrackedVersions(testSqlite);
expect(history.length).toBe(2);
expect(history[0].version).toBe(1);
expect(history[0].description).toBe('Create users table');
expect(history[1].version).toBe(2);
expect(history[1].description).toBe('Create logs table');
expect(history[0]!.version).toBe(1);
expect(history[0]!.description).toBe('Create users table');
expect(history[1]!.version).toBe(2);
expect(history[1]!.description).toBe('Create logs table');
});

it('should gracefully perform a no-op if the database is already fully up-to-date', () => {
Expand Down
Loading
Loading