A tool for parsing traffic on the jetstream and applying a moderation workstream based on regexp based rules

feat: Add type checking and update tsconfig

Adds a type-checking script to package.json and updates tsconfig.json to
improve type checking and skip library checks.

feat: Add type checking and update tsconfig

Adds a type-check script to `package.json` and a pre-push hook to run
type checks before pushing. Updates the `tsconfig.json` to include
`vitest/globals` and `skipLibCheck`. Also, updates imports in test files
to include the `.js` extension.

Skywatch d5d5a662 286bd075

+4
.husky/pre-push
··· 1 + #!/usr/bin/env sh 2 + . "$(dirname -- "$0")/_/husky.sh" 3 + 4 + npm run type-check
+1
package.json
··· 9 9 "test:ui": "vitest --ui", 10 10 "test:run": "vitest run", 11 11 "test:coverage": "vitest run --coverage", 12 + "type-check": "tsc --noEmit", 12 13 "format": "bunx prettier --write .", 13 14 "lint": "bunx eslint .", 14 15 "lint:fix": "bunx eslint --fix .",
+1 -1
src/tests/agent.test.ts
··· 27 27 } 28 28 })) 29 29 30 - const { agent, login } = await import('../agent') 30 + const { agent, login } = await import('../agent.js') 31 31 32 32 // Check that the agent was created with the correct service URL 33 33 expect(mockConstructor).toHaveBeenCalledWith({ service: 'https://pds.test.com' })
+1 -1
src/tests/limits.test.ts
··· 1 1 import { describe, it, expect } from 'vitest' 2 - import { limit } from '../limits' 2 + import { limit } from '../limits.js' 3 3 4 4 describe('Rate Limiter', () => { 5 5 it('should limit the rate of calls', async () => {
+1 -1
src/tests/metrics.test.ts
··· 1 1 import { describe, it, expect } from 'vitest' 2 2 import request from 'supertest' 3 - import { startMetricsServer } from '../metrics' 3 + import { startMetricsServer } from '../metrics.js' 4 4 import { Server } from 'http' 5 5 6 6 describe('Metrics Server', () => {
+1 -1
src/utils/homoglyph.test.ts
··· 1 1 import { describe, it, expect } from 'vitest' 2 - import { normalizeUnicode } from './normalizeUnicode' 2 + import { normalizeUnicode } from './normalizeUnicode.js' 3 3 4 4 describe('normalizeUnicode with Homoglyphs', () => { 5 5 it('should replace basic homoglyphs', () => {
+2 -1
tsconfig.json
··· 6 6 "moduleResolution": "NodeNext", 7 7 "allowSyntheticDefaultImports": true, 8 8 "esModuleInterop": true, 9 - "types": ["node"] 9 + "skipLibCheck": true, 10 + "types": ["node", "vitest/globals"] 10 11 } 11 12 }