Skip to content

fix: stabilize project with tests, linting, and bug fixes#10

Open
ViVaLaDaniel wants to merge 1 commit intomainfrom
fix/project-stabilization-13903886953341354066
Open

fix: stabilize project with tests, linting, and bug fixes#10
ViVaLaDaniel wants to merge 1 commit intomainfrom
fix/project-stabilization-13903886953341354066

Conversation

@ViVaLaDaniel
Copy link
Copy Markdown
Owner

@ViVaLaDaniel ViVaLaDaniel commented Jan 31, 2026

This pull request addresses several critical issues and improves the project infrastructure:

  1. Project Purpose & Status:

    • The project is PermitPilot (or NextN), an AI-powered Permit Application Management System.
    • It features an AI Permit Assistant, Smart Municipality Database, Document Auto-Fill, and Code Validation.
  2. Changes Implemented:

    • Security: Moved hardcoded Firebase credentials from src/firebase/config.ts to environment variables (.env.local.example created).
    • Bug Fixes:
      • Fixed src/lib/seed-db.ts to correctly use doc() from the Firebase Modular SDK.
      • Fixed src/components/ui/calendar.tsx type errors by removing incompatible overrides for react-day-picker v9.
      • Fixed a typo (unescaped apostrophe) in src/app/(app)/dashboard/page.tsx.
    • Infrastructure:
      • Installed vitest and configured vitest.config.mts.
      • Added a test script and a sample test (src/lib/utils.test.ts).
      • Installed and configured eslint properly.
  3. Remaining Work (What else needs to be done):

    • RAG Integration: The Code Validator (src/app/(app)/code-validator/validator-form.tsx) currently mocks building codes. It needs real RAG implementation to fetch actual local codes.
    • Authentication: Currently uses anonymous sign-in. Needs robust auth (Google, Email/Pass).
    • Frontend Testing: Add Playwright E2E tests.
    • Deployment: Configure App Hosting / Vercel deployment with real secrets.
    • Features: Implement the actual AI logic for Checklist Generator and Document Autofill (currently seem to be stubs or prototypes).

PR created automatically by Jules for task 13903886953341354066 started by @ViVaLaDaniel

Summary by CodeRabbit

  • New Features

    • Firebase configuration now uses environment variables for all settings.
  • Bug Fixes

    • Fixed text escaping in dashboard welcome message.
  • Tests

    • Added unit tests for utility functions.
    • Configured test framework with jsdom environment support.
  • Chores

    • Added ESLint configuration for code quality.
    • Updated calendar component icon behavior to use defaults.
    • Added testing and linting development dependencies.

✏️ Tip: You can customize this high-level summary in your review settings.

Co-authored-by: ViVaLaDaniel <110051738+ViVaLaDaniel@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

The pull request establishes testing and linting infrastructure by adding ESLint and Vitest configurations with necessary dependencies. It also updates Firebase configuration to use environment variables, refactors Firebase document reference construction patterns, adds unit tests, and makes minor UI adjustments.

Changes

Cohort / File(s) Summary
Testing & Linting Infrastructure
.eslintrc.json, vitest.config.mts, package.json
Adds ESLint configuration extending Next.js core-web-vitals preset. Introduces Vitest configuration with React and jsdom support. Adds test script and testing/linting dependencies including vitest, @testing-library/react, eslint, and jsdom.
Environment Configuration
src/firebase/config.ts
Replaces hardcoded Firebase configuration values with environment variable references using process.env.NEXT_PUBLIC_* for all firebaseConfig object fields.
Firebase Reference Refactoring
src/lib/seed-db.ts
Refactors document reference construction from collection(...).doc(id) pattern to doc(collection(...), id) pattern in municipality and permit seeding operations.
Tests & Component Updates
src/lib/utils.test.ts, src/app/(app)/dashboard/page.tsx, src/components/ui/calendar.tsx
Adds unit tests for the cn classNames utility verifying class merging and override behavior. Updates dashboard text escaping (don't → don't). Removes custom ChevronLeft/ChevronRight icon overrides from DayPicker calendar component, reverting to default navigation icons.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Our tests now hop with vitest cheer,
ESLint rules make code so clear,
Firebase secrets in env they hide,
Component icons simplified with pride!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objectives: it mentions tests (vitest setup, test script, sample tests), linting (ESLint configuration), and bug fixes (Firebase config, seed-db, calendar, dashboard typo).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/project-stabilization-13903886953341354066

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.eslintrc.json:
- Around line 1-3: The ESLint config currently extends only
"next/core-web-vitals"; for a TypeScript Next.js project update the "extends"
entry in .eslintrc.json to include both "next/core-web-vitals" and
"next/typescript" (i.e., change the extends value to an array containing those
two presets) so TypeScript-specific lint rules are applied by Next's presets.
🧹 Nitpick comments (2)
src/firebase/config.ts (1)

1-8: Fail fast when required Firebase env vars are missing.
This avoids obscure runtime errors when any value is undefined.

♻️ Suggested fail-fast helper
+const requiredEnv = (name: string) => {
+  const value = process.env[name];
+  if (!value) {
+    throw new Error(`Missing environment variable: ${name}`);
+  }
+  return value;
+};
+
 export const firebaseConfig = {
-  projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
-  appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,
-  apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
-  authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
-  measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID,
-  messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
+  projectId: requiredEnv("NEXT_PUBLIC_FIREBASE_PROJECT_ID"),
+  appId: requiredEnv("NEXT_PUBLIC_FIREBASE_APP_ID"),
+  apiKey: requiredEnv("NEXT_PUBLIC_FIREBASE_API_KEY"),
+  authDomain: requiredEnv("NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN"),
+  measurementId: requiredEnv("NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID"),
+  messagingSenderId: requiredEnv("NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID"),
 };
src/lib/seed-db.ts (1)

1-37: Use the direct doc(firestore, path, id) pattern instead of doc(collection(), id) for better clarity.

While doc(collection(firestore, path), id) is valid, the Firebase v11+ modular API recommends the more direct pattern: doc(firestore, path, id). For the municipalities collection, use doc(firestore, "municipalities", municipality.id). For the user-specific permits subcollection, use doc(firestore, "users", userId, "permits", permit.id).

Comment thread .eslintrc.json
Comment on lines +1 to +3
{
"extends": "next/core-web-vitals"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Next.js 15 eslint next/core-web-vitals preset configuration requirements

💡 Result:

Next.js 15: next/core-web-vitals ESLint preset — what you need to configure

1) Install the required packages

You need eslint and eslint-config-next in your project (Next can also add them for you when you first run next lint). [1]

2) Choose the config format you’re using

A) Legacy .eslintrc* (extends string)

Use this if you’re on the classic ESLint config format:

{
  "extends": "next/core-web-vitals"
}

This enables the Core Web Vitals ruleset (it promotes some Next.js lint rules from warnings to errors). [2]

B) ESLint “flat config” (eslint.config.mjs)

In Next.js 15 docs, the flat-config way is to import the preset from eslint-config-next/core-web-vitals and export it:

// eslint.config.mjs
import { defineConfig, globalIgnores } from 'eslint/config'
import nextVitals from 'eslint-config-next/core-web-vitals'

export default defineConfig([
  ...nextVitals,
  // (optional) override ignores
  globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']),
])

This is the documented setup flow for using the core-web-vitals preset with flat config. [1]

3) (Optional) Combine with TypeScript preset

If you want the Next.js TypeScript ESLint add-on, extend/include next/typescript alongside next/core-web-vitals. [2]


🌐 Web query:

ESLint TypeScript parser configuration for Next.js projects

💡 Result:

Recommended (Next.js-managed parser; most projects)

In Next.js projects you typically do not set parser yourselfeslint-config-next already wires up the right parser/plugins/settings. Use the Next presets and (if you want TS rules) add the TS preset too. [1]

Flat config (eslint.config.mjs)

import { defineConfig } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";

export default defineConfig([
  ...nextVitals,
  ...nextTs,
]);

This is the “Next + TypeScript” setup Create Next App uses conceptually (Core Web Vitals + TS rules). [1]

Legacy config (.eslintrc.*)

{
  "extends": ["next/core-web-vitals", "next/typescript"]
}

next/typescript is based on plugin:@typescript-eslint/recommended``. [2]

If you specifically need typed linting (rules that require type info)

Configure @typescript-eslint/parser with type-aware parser options (modern recommendation: parserOptions.projectService: true). [3]

import tsParser from "@typescript-eslint/parser";

export default [
  {
    files: ["**/*.{ts,tsx}"],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        projectService: true
      }
    }
  }
];

Tip: Only do this when you actually enable type-aware rulesets; otherwise it can slow linting and complicate config. [3]

Sources: Next.js ESLint config docs [1], Next.js “With TypeScript” (next/typescript) [2], typescript-eslint parser typed-linting options [3].


Solid base ESLint preset for Next.js, but incomplete for TypeScript projects.

The "next/core-web-vitals" preset includes Next.js specific rules for Core Web Vitals compliance (promoting certain warnings to errors). However, if this is a TypeScript project, extend both presets:

{
  "extends": ["next/core-web-vitals", "next/typescript"]
}

No additional parserOptions or root fields are required—the Next.js presets handle parser configuration automatically. Add custom parser options only if you need type-aware linting (which requires projectService: true on @typescript-eslint/parser).

🤖 Prompt for AI Agents
In @.eslintrc.json around lines 1 - 3, The ESLint config currently extends only
"next/core-web-vitals"; for a TypeScript Next.js project update the "extends"
entry in .eslintrc.json to include both "next/core-web-vitals" and
"next/typescript" (i.e., change the extends value to an array containing those
two presets) so TypeScript-specific lint rules are applied by Next's presets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant