diff --git a/package.json b/package.json index ea8dfb37..42db5a4c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "scripts": { "lint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src", "lint-fix": "eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src", - "type-safety-check": "./scripts/type-safety-check.sh", "type-check": "tsc --noEmit", "type-check:vue": "vue-tsc --noEmit", "prebuild": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src && node sw_combine.js && node scripts/copy-wasm.js", @@ -17,7 +16,7 @@ "test:unit": "jest", "check:dependencies": "./scripts/check-dependencies.sh", "deps:update-daily-notification-plugin": "npm install @timesafari/daily-notification-plugin@git+https://gitea.anomalistdesign.com/trent_larson/daily-notification-plugin.git#master", - "test:all": "npm run lint && tsc && npm run test:unit && npm run test:web && npm run test:mobile && ./scripts/test-safety-check.sh && echo '\n\n\nGotta add the performance tests'", + "test:all": "npm run lint && npm run type-check && npm run type-check:vue && npm run test:unit && npm run test:web && npm run test:mobile && echo '\n\n\nGotta add the performance tests'", "test:web": "npx playwright test -c playwright.config-local.ts --trace on", "test:mobile": "./scripts/test-mobile.sh", "test:android": "node scripts/test-android.js", diff --git a/scripts/type-safety-check.sh b/scripts/type-safety-check.sh deleted file mode 100755 index adb76c93..00000000 --- a/scripts/type-safety-check.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - -# Type Safety Pre-commit Check Script -# This script ensures type safety before commits by running linting and type checking - -set -e - -echo "🔍 Running Type Safety Pre-commit Checks..." - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -# Function to print colored output -print_status() { - echo -e "${GREEN}✅ $1${NC}" -} - -print_warning() { - echo -e "${YELLOW}⚠️ $1${NC}" -} - -print_error() { - echo -e "${RED}❌ $1${NC}" -} - -# Check if we're in the right directory -if [ ! -f "package.json" ]; then - print_error "Must run from project root directory" - exit 1 -fi - -# Step 1: Run ESLint with TypeScript rules -print_status "Running ESLint TypeScript checks..." -if npm run lint > /dev/null 2>&1; then - print_status "ESLint passed - no type safety issues found" -else - print_error "ESLint failed - type safety issues detected" - echo "" - echo "Running lint with details..." - npm run lint - echo "" - print_error "Please fix the above type safety issues before committing" - exit 1 -fi - -# Step 2: Run TypeScript type checking -print_status "Running TypeScript type checking..." -if npm run type-check > /dev/null 2>&1; then - print_status "TypeScript compilation passed" -else - print_error "TypeScript compilation failed" - echo "" - echo "Running type check with details..." - npm run type-check - echo "" - print_error "Please fix the above TypeScript errors before committing" - exit 1 -fi - -# Step 3: Check for any remaining 'any' types -print_status "Scanning for any remaining 'any' types..." -ANY_COUNT=$(grep -r "any" src/ --include="*.ts" --include="*.vue" | grep -v "// eslint-disable" | grep -v "eslint-disable-next-line" | wc -l) - -if [ "$ANY_COUNT" -eq 0 ]; then - print_status "No 'any' types found in source code" -else - print_warning "Found $ANY_COUNT instances of 'any' type usage" - echo "" - echo "Instances found:" - grep -r "any" src/ --include="*.ts" --include="*.vue" | grep -v "// eslint-disable" | grep -v "eslint-disable-next-line" || true - echo "" - print_error "Please replace 'any' types with proper TypeScript types before committing" - exit 1 -fi - -# Step 4: Verify database migration status -print_status "Checking database migration status..." -if grep -r "databaseUtil" src/ --include="*.ts" --include="*.vue" > /dev/null 2>&1; then - print_warning "Found databaseUtil imports - ensure migration is complete" - echo "" - echo "Files with databaseUtil imports:" - grep -r "databaseUtil" src/ --include="*.ts" --include="*.vue" | head -5 || true - echo "" - print_warning "Consider completing database migration to PlatformServiceMixin" -else - print_status "No databaseUtil imports found - migration appears complete" -fi - -# All checks passed -echo "" -print_status "All type safety checks passed! 🎉" -print_status "Your code is ready for commit" -echo "" -echo "📚 Remember to follow the Type Safety Guidelines:" -echo " - doc/typescript-type-safety-guidelines.md" -echo " - Use proper error handling patterns" -echo " - Leverage existing type definitions" -echo " - Run 'npm run lint-fix' for automatic fixes" - -exit 0 diff --git a/src/components/BulkMembersDialog.vue b/src/components/BulkMembersDialog.vue index abce37cc..3efd6003 100644 --- a/src/components/BulkMembersDialog.vue +++ b/src/components/BulkMembersDialog.vue @@ -130,6 +130,7 @@ diff --git a/src/views/HelpTermsView.vue b/src/views/HelpTermsView.vue index 8a84d192..202c67ae 100644 --- a/src/views/HelpTermsView.vue +++ b/src/views/HelpTermsView.vue @@ -133,12 +133,14 @@ diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 436ee87c..9f1da49b 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1855,14 +1855,6 @@ export default class HomeView extends Vue { this.isImageViewerOpen = true; } - private handleQRCodeClick() { - if (Capacitor.isNativePlatform()) { - this.$router.push({ name: "contact-qr-scan-full" }); - } else { - this.$router.push({ name: "contact-qr" }); - } - } - openPersonDialog(giver?: GiverReceiverInputInfo, prompt?: string) { this.openDialog(giver, prompt); } diff --git a/src/views/IdentitySwitcherView.vue b/src/views/IdentitySwitcherView.vue index 9eea7fde..ea814d6a 100644 --- a/src/views/IdentitySwitcherView.vue +++ b/src/views/IdentitySwitcherView.vue @@ -236,8 +236,10 @@ export default class IdentitySwitcherView extends Vue { } async switchAccount(did?: string) { - // Update the active DID in the active_identity table - await this.$updateActiveDid(did); + // Update the active DID in the active_identity table. + // Coerce to null: the value reaches a SQL parameter, where undefined is not + // a valid binding. + await this.$updateActiveDid(did ?? null); // Check if we need to load user-specific settings for the new DID if (did) { diff --git a/src/views/ImportDerivedAccountView.vue b/src/views/ImportDerivedAccountView.vue index 7a757537..c4519f7f 100644 --- a/src/views/ImportDerivedAccountView.vue +++ b/src/views/ImportDerivedAccountView.vue @@ -130,7 +130,7 @@ export default class ImportAccountView extends Vue { }), ); const filteredDecryptedAccounts: Account[] = decryptedAccounts.filter( - (account) => account !== undefined, + (account): account is Account => account !== undefined, ); // group by account.mnemonic diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 556c51cb..557b18a0 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -1232,7 +1232,7 @@ export default class ProjectViewView extends Vue { undefined, ); // Immediately select "Unnamed" and move to Step 2 - (this.$refs.giveDialogToThis as GiftedDialog).selectGiver(); + (this.$refs.giveDialogToThis as GiftedDialog).selectGiverPerson(); } else { // Open straight to Step 2 with current user as giver and current project as recipient (this.$refs.giveDialogToThis as GiftedDialog).open( diff --git a/src/views/StatisticsView.vue b/src/views/StatisticsView.vue index 6e61a26a..4606bb19 100644 --- a/src/views/StatisticsView.vue +++ b/src/views/StatisticsView.vue @@ -79,7 +79,7 @@ export default class StatisticsView extends Vue { $notify!: (notification: NotificationIface, timeout?: number) => void; $router!: Router; - world: World; + world!: World; worldProperties: Dictionary = {}; mounted() { diff --git a/src/views/TestView.vue b/src/views/TestView.vue index ecea8c78..6791576e 100644 --- a/src/views/TestView.vue +++ b/src/views/TestView.vue @@ -745,7 +745,7 @@ export default class Help extends Vue { * @returns True if not on production server (enables test utilities) */ public isNotProdServer() { - return isNotProdServerUtil(this.apiServer); + return isNotProdServerUtil(this.apiServer ?? ""); } async registerMe() { diff --git a/src/views/dev/NotificationDebugView.vue b/src/views/dev/NotificationDebugView.vue index d210afbf..b35be46e 100644 --- a/src/views/dev/NotificationDebugView.vue +++ b/src/views/dev/NotificationDebugView.vue @@ -31,6 +31,7 @@