Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
ποΈ Demote or merge pseudo-features into lib/ and owning features (#2609)
Luke Vellab90ea360f008
diff --git a/CLAUDE.md b/CLAUDE.mdindex 53edd723e..52a33135d 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -188,6 +188,7 @@ Always use gitmoji prefixes in commit messages. Follow the gitmoji convention (h- `constants.ts`- `utils.ts` β pure domain helpers, co-located `*.test.ts`- `client.tsx` β client entry: providers, context, hooks, stores (no separate `hooks.ts` or store files)+- `service.ts` β external integration client (class/factory wrapping a third-party API), must start with `import "server-only"`- `components/` β feature UI (no components at feature root)- `assets/` β static files used by the feature- NOT allowed: `index.ts` barrels, `helpers.ts`, `queries.ts`, `hooks.ts`, `lib/`, `libs/`diff --git a/apps/web/biome.json b/apps/web/biome.jsonindex d45002abf..00439d5ff 100644--- a/apps/web/biome.json+++ b/apps/web/biome.json@@ -127,7 +127,6 @@"src/components/invite-dialog.tsx","src/components/layouts/poll-layout.tsx","src/components/logo.tsx",- "src/components/nav-user.tsx","src/components/new-participant-modal.tsx","src/components/poll-status.tsx","src/components/poll/desktop-poll.tsx",@@ -143,12 +142,9 @@"src/components/poll/voting-form.tsx","src/components/pro-badge.tsx","src/components/upgrade-button.tsx",- "src/components/user-dropdown.tsx","src/components/user-provider.tsx","src/components/visibility.tsx","src/features/billing/components/pay-wall-dialog.tsx",- "src/features/navigation/command-menu/command-menu.tsx",- "src/features/quick-create/quick-create-widget.tsx","src/lib/auth.ts","src/lib/feature-flags/config.ts","src/lib/safe-action/server.ts"@@ -190,6 +186,26 @@}}}+ },+ {+ "includes": [+ "src/features/**",+ "!src/features/**/components/**",+ "!src/features/**/assets/**"+ ],+ "linter": {+ "rules": {+ "style": {+ "useFilenamingConvention": {+ "level": "warn",+ "options": {+ "match": "(?:data|mutations|actions|schema|types|ability|constants|utils|service)[.]ts|client[.]tsx|.+[.]test[.]tsx?",+ "filenameCases": ["kebab-case"]+ }+ }+ }+ }+ }}]}diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsxindex d71e0c690..e394b91b0 100644--- a/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsx+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsx@@ -9,7 +9,7 @@ import {SidebarMenuItem,} from "@rallly/ui/sidebar";import { HoverPrefetchLink } from "@/components/hover-prefetch-link";-import { useSpaceMenu } from "@/features/navigation/config";+import { useSpaceMenu } from "@/features/navigation/client";export function SpaceSidebarMenu() {const { config } = useSpaceMenu();diff --git a/apps/web/src/app/[locale]/(space)/settings/preferences/components/theme-preference.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/components/theme-preference.tsxindex 711b63d55..7e9545006 100644--- a/apps/web/src/app/[locale]/(space)/settings/preferences/components/theme-preference.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/preferences/components/theme-preference.tsx@@ -3,8 +3,8 @@import { RadioGroup, RadioGroupItem } from "@rallly/ui/radio-group";import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react";import React from "react";-import { useTheme } from "@/features/theme/client";import { Trans } from "@/i18n/client";+import { useTheme } from "@/lib/theme";function ThemeOption({value,diff --git a/apps/web/src/app/[locale]/layout.tsx b/apps/web/src/app/[locale]/layout.tsxindex 56ee688d5..1cb503cb5 100644--- a/apps/web/src/app/[locale]/layout.tsx+++ b/apps/web/src/app/[locale]/layout.tsx@@ -12,12 +12,12 @@ import type { Params } from "@/app/[locale]/types";import { SkipNavLink } from "@/components/skip-nav-link";import { BrandingProvider } from "@/features/branding/client";import { getInstanceBrandingConfig } from "@/features/branding/data";-import { ThemeProvider } from "@/features/theme/client";import { I18nProvider } from "@/i18n/client";import { initI18next } from "@/i18n/i18n";import { TimeZoneSync } from "@/lib/datetime/timezone-sync";import { FeatureFlagsProvider } from "@/lib/feature-flags/client";import { featureFlagConfig } from "@/lib/feature-flags/config";+import { ThemeProvider } from "@/lib/theme";import { TRPCProvider } from "@/trpc/client/provider";import { PostHogPageView } from "../posthog-page-view";diff --git a/apps/web/src/app/api/better-auth/[...all]/route.ts b/apps/web/src/app/api/better-auth/[...all]/route.tsindex 68a0cf8c8..df04915b1 100644--- a/apps/web/src/app/api/better-auth/[...all]/route.ts+++ b/apps/web/src/app/api/better-auth/[...all]/route.ts@@ -1,6 +1,6 @@import { toNextJsHandler } from "better-auth/next-js";-import { withPostHog } from "@/features/analytics/posthog";import { authLib } from "@/lib/auth";+import { withPostHog } from "@/lib/posthog";const { POST: authPost, GET: authGet } = toNextJsHandler(authLib);diff --git a/apps/web/src/app/api/stripe/webhook/route.ts b/apps/web/src/app/api/stripe/webhook/route.tsindex d6c9467ec..d2e145867 100644--- a/apps/web/src/app/api/stripe/webhook/route.ts+++ b/apps/web/src/app/api/stripe/webhook/route.ts@@ -3,9 +3,9 @@ import { stripe } from "@rallly/billing";import * as Sentry from "@sentry/nextjs";import type { NextRequest } from "next/server";import { NextResponse } from "next/server";-import { withPostHog } from "@/features/analytics/posthog";import { handleStripeWebhookEvent } from "@/features/billing/webhook/mutations";import { isSelfHosted } from "@/lib/constants";+import { withPostHog } from "@/lib/posthog";const handler = async (request: NextRequest) => {if (isSelfHosted) {diff --git a/apps/web/src/app/api/trpc/[trpc]/route.ts b/apps/web/src/app/api/trpc/[trpc]/route.tsindex d7367e710..847e104ca 100644--- a/apps/web/src/app/api/trpc/[trpc]/route.ts+++ b/apps/web/src/app/api/trpc/[trpc]/route.ts@@ -4,9 +4,9 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch";import { getHTTPStatusCodeFromError } from "@trpc/server/http";import { ipAddress } from "@vercel/functions";import type { NextRequest } from "next/server";-import { withPostHog } from "@/features/analytics/posthog";import { getSession } from "@/lib/auth";import { getLocaleFromRequest } from "@/lib/locale/server";+import { withPostHog } from "@/lib/posthog";import type { TRPCContext } from "@/trpc/context";import { appRouter } from "@/trpc/routers";diff --git a/apps/web/src/components/nav-user.tsx b/apps/web/src/components/nav-user.tsxindex fffb999d1..de4407665 100644--- a/apps/web/src/components/nav-user.tsx+++ b/apps/web/src/components/nav-user.tsx@@ -31,9 +31,9 @@ import { useRouter } from "next/navigation";import React from "react";import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";import { RouterLoadingIndicator } from "@/components/router-loading-indicator";-import { useTheme } from "@/features/theme/client";import { Trans } from "@/i18n/client";import { signOut } from "@/lib/auth-client";+import { useTheme } from "@/lib/theme";import { trpc } from "@/trpc/client";export function NavUser() {diff --git a/apps/web/src/components/user-dropdown.tsx b/apps/web/src/components/user-dropdown.tsxindex 4c868f182..2ae281fb0 100644--- a/apps/web/src/components/user-dropdown.tsx+++ b/apps/web/src/components/user-dropdown.tsx@@ -32,10 +32,10 @@ import Link from "next/link";import { useRouter } from "next/navigation";import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";import { useUser } from "@/components/user-provider";-import { useTheme } from "@/features/theme/client";import { Trans, useTranslation } from "@/i18n/client";import { signOut } from "@/lib/auth-client";import { useFeatureFlag } from "@/lib/feature-flags/client";+import { useTheme } from "@/lib/theme";export const UserDropdown = ({ className }: { className?: string }) => {const { t } = useTranslation();diff --git a/apps/web/src/features/developer/data.ts b/apps/web/src/features/api-keys/data.tssimilarity index 94%rename from apps/web/src/features/developer/data.tsrename to apps/web/src/features/api-keys/data.tsindex 0f82cf69f..75cd674d4 100644--- a/apps/web/src/features/developer/data.ts+++ b/apps/web/src/features/api-keys/data.ts@@ -1,8 +1,8 @@import "server-only";-import { posthog } from "@/features/analytics/posthog";import type { SpaceTier } from "@/features/space/schema";import { isSelfHosted } from "@/lib/constants";+import { posthog } from "@/lib/posthog";/*** Determines if a user has access to API features (API keys, developer tools)diff --git a/apps/web/src/features/auth/mutations.ts b/apps/web/src/features/auth/mutations.tsindex 66404a479..c4f9fe587 100644--- a/apps/web/src/features/auth/mutations.ts+++ b/apps/web/src/features/auth/mutations.ts@@ -2,7 +2,7 @@ import "server-only";import { prisma } from "@rallly/database";import { createLogger } from "@rallly/logger";import * as Sentry from "@sentry/nextjs";-import { posthog } from "@/features/analytics/posthog";+import { posthog } from "@/lib/posthog";const logger = createLogger("auth/merge-user");diff --git a/apps/web/src/features/billing/actions.ts b/apps/web/src/features/billing/actions.tsindex c7b468560..362c9c1bc 100644--- a/apps/web/src/features/billing/actions.ts+++ b/apps/web/src/features/billing/actions.ts@@ -5,12 +5,12 @@ import { absoluteUrl } from "@rallly/utils/absolute-url";import { redirect } from "next/navigation";import * as z from "zod";import { createStripePortalSession } from "@/features/billing/mutations";-import type { CustomerMetadata } from "@/features/billing/schema";-import { getActiveSpaceForUser } from "@/features/space/data";import type {+ CustomerMetadata,SubscriptionCheckoutMetadata,SubscriptionMetadata,-} from "@/features/subscription/schema";+} from "@/features/billing/schema";+import { getActiveSpaceForUser } from "@/features/space/data";import { AppError } from "@/lib/errors/app-error";import { authActionClient } from "@/lib/safe-action/server";import { validateRedirectUrl } from "@/lib/utils/redirect";diff --git a/apps/web/src/features/billing/schema.ts b/apps/web/src/features/billing/schema.tsindex 0f402fd73..5356479e7 100644--- a/apps/web/src/features/billing/schema.ts+++ b/apps/web/src/features/billing/schema.ts@@ -7,3 +7,19 @@ export const customerMetadataSchema = z.object({userId: z.string(),});export type CustomerMetadata = z.infer<typeof customerMetadataSchema>;++export const subscriptionCheckoutMetadataSchema = z.object({+ userId: z.string(),+ spaceId: z.string().optional(),+});++export type SubscriptionCheckoutMetadata = z.infer<+ typeof subscriptionCheckoutMetadataSchema+>;++export const subscriptionMetadataSchema = z.object({+ userId: z.string(),+ spaceId: z.string(),+});++export type SubscriptionMetadata = z.infer<typeof subscriptionMetadataSchema>;diff --git a/apps/web/src/features/billing/webhook/mutations.ts b/apps/web/src/features/billing/webhook/mutations.tsindex ab64fdb47..bebf2c9ff 100644--- a/apps/web/src/features/billing/webhook/mutations.ts+++ b/apps/web/src/features/billing/webhook/mutations.ts@@ -10,8 +10,10 @@ import * as Sentry from "@sentry/nextjs";import { after } from "next/server";import { getInstanceBranding } from "@/emails/branding";import { env } from "@/env";-import { posthog } from "@/features/analytics/posthog";-import { customerMetadataSchema } from "@/features/billing/schema";+import {+ customerMetadataSchema,+ subscriptionMetadataSchema,+} from "@/features/billing/schema";import {getSubscriptionDetails,isSubscriptionActive,@@ -19,7 +21,7 @@ import {} from "@/features/billing/webhook/utils";import { licenseManager } from "@/features/licensing/mutations";import { licenseCheckoutMetadataSchema } from "@/features/licensing/schema";-import { subscriptionMetadataSchema } from "@/features/subscription/schema";+import { posthog } from "@/lib/posthog";async function getExpandedSubscription(subscriptionId: string) {return stripe.subscriptions.retrieve(subscriptionId, {diff --git a/apps/web/src/features/calendars/services/google-calendar.ts b/apps/web/src/features/calendars/google/service.tssimilarity index 59%rename from apps/web/src/features/calendars/services/google-calendar.tsrename to apps/web/src/features/calendars/google/service.tsindex a67cefdac..10bdf2768 100644--- a/apps/web/src/features/calendars/services/google-calendar.ts+++ b/apps/web/src/features/calendars/google/service.ts@@ -1,28 +1,33 @@+import "server-only";+import type { calendar_v3 } from "googleapis";import { google } from "googleapis";import * as z from "zod";-import type {- CalendarInfo,- CalendarService,-} from "@/features/calendars/services/types";-import type { GoogleServiceParams } from "@/features/google/service";-import { GoogleService } from "@/features/google/service";+import { env } from "@/env";+import type { CalendarInfo, CalendarService } from "@/features/calendars/types";-export class GoogleCalendarService- extends GoogleService- implements CalendarService-{+export class GoogleCalendarService implements CalendarService {private readonly client: calendar_v3.Calendar;static credentialsSchema = z.object({accessToken: z.string(),refreshToken: z.string().optional(),});- constructor(params: GoogleServiceParams) {- super(params);+ constructor(params: {+ credentials: z.infer<typeof GoogleCalendarService.credentialsSchema>;+ }) {+ const oauth2Client = new google.auth.OAuth2({+ clientId: env.GOOGLE_CLIENT_ID,+ clientSecret: env.GOOGLE_CLIENT_SECRET,+ });++ oauth2Client.setCredentials({+ access_token: params.credentials.accessToken,+ refresh_token: params.credentials.refreshToken,+ });this.client = google.calendar({version: "v3",- auth: this.oauth2Client,+ auth: oauth2Client,});}diff --git a/apps/web/src/features/calendars/service.ts b/apps/web/src/features/calendars/service.tsindex 12f54ea77..48d87b84b 100644--- a/apps/web/src/features/calendars/service.ts+++ b/apps/web/src/features/calendars/service.ts@@ -1,4 +1,6 @@-import { GoogleCalendarService } from "@/features/calendars/services/google-calendar";+import "server-only";++import { GoogleCalendarService } from "@/features/calendars/google/service";type CalendarServiceProvider = {provider: string;diff --git a/apps/web/src/features/calendars/services/types.ts b/apps/web/src/features/calendars/types.tssimilarity index 100%rename from apps/web/src/features/calendars/services/types.tsrename to apps/web/src/features/calendars/types.tsdiff --git a/apps/web/src/features/google/service.ts b/apps/web/src/features/google/service.tsdeleted file mode 100644index 768131381..000000000--- a/apps/web/src/features/google/service.ts+++ /dev/null@@ -1,28 +0,0 @@-import "server-only";--import type { Auth } from "googleapis";-import { google } from "googleapis";-import { env } from "@/env";--export type GoogleServiceParams = {- credentials: {- accessToken: string;- refreshToken?: string;- };-};--export class GoogleService {- oauth2Client: Auth.OAuth2Client;-- constructor(readonly params: GoogleServiceParams) {- this.oauth2Client = new google.auth.OAuth2({- clientId: env.GOOGLE_CLIENT_ID,- clientSecret: env.GOOGLE_CLIENT_SECRET,- });-- this.oauth2Client.setCredentials({- access_token: params.credentials.accessToken,- refresh_token: params.credentials.refreshToken,- });- }-}diff --git a/apps/web/src/features/navigation/config.tsx b/apps/web/src/features/navigation/client.tsxsimilarity index 100%rename from apps/web/src/features/navigation/config.tsxrename to apps/web/src/features/navigation/client.tsxdiff --git a/apps/web/src/features/space/actions.ts b/apps/web/src/features/space/actions.tsindex 0a3c6cc57..56b0c8fc0 100644--- a/apps/web/src/features/space/actions.ts+++ b/apps/web/src/features/space/actions.ts@@ -2,9 +2,9 @@import { prisma } from "@rallly/database";import * as z from "zod";-import { posthog } from "@/features/analytics/posthog";import { setActiveSpace } from "@/features/user/mutations";import { AppError } from "@/lib/errors/app-error";+import { posthog } from "@/lib/posthog";import { authActionClient } from "@/lib/safe-action/server";export const setActiveSpaceAction = authActionClientdiff --git a/apps/web/src/features/subscription/schema.ts b/apps/web/src/features/subscription/schema.tsdeleted file mode 100644index a6abbffd9..000000000--- a/apps/web/src/features/subscription/schema.ts+++ /dev/null@@ -1,17 +0,0 @@-import * as z from "zod";--export const subscriptionCheckoutMetadataSchema = z.object({- userId: z.string(),- spaceId: z.string().optional(),-});--export type SubscriptionCheckoutMetadata = z.infer<- typeof subscriptionCheckoutMetadataSchema->;--export const subscriptionMetadataSchema = z.object({- userId: z.string(),- spaceId: z.string(),-});--export type SubscriptionMetadata = z.infer<typeof subscriptionMetadataSchema>;diff --git a/apps/web/src/lib/auth.ts b/apps/web/src/lib/auth.tsindex 3fa528f6b..356477e79 100644--- a/apps/web/src/lib/auth.ts+++ b/apps/web/src/lib/auth.ts@@ -25,7 +25,6 @@ import { after } from "next/server";import { cache } from "react";import { getInstanceBranding } from "@/emails/branding";import { env } from "@/env";-import { posthog } from "@/features/analytics/posthog";import { linkAnonymousUser } from "@/features/auth/mutations";import { isEmailBlocked, isTemporaryEmail } from "@/features/auth/utils";import { createSpace } from "@/features/space/mutations";@@ -34,6 +33,7 @@ import { getTranslation } from "@/i18n/server";import { getLocale } from "@/i18n/server/get-locale";import { hostOnlyCookieCleanup } from "@/lib/auth-plugins/host-only-cookie-cleanup";import { redis } from "@/lib/kv";+import { posthog } from "@/lib/posthog";import { getValueByPath } from "@/lib/utils/get-value-by-path";const kv = redis;diff --git a/apps/web/src/features/analytics/posthog.ts b/apps/web/src/lib/posthog.tssimilarity index 100%rename from apps/web/src/features/analytics/posthog.tsrename to apps/web/src/lib/posthog.tsdiff --git a/apps/web/src/features/theme/client.tsx b/apps/web/src/lib/theme.tsxsimilarity index 100%rename from apps/web/src/features/theme/client.tsxrename to apps/web/src/lib/theme.tsxdiff --git a/apps/web/src/trpc/routers/api-keys.ts b/apps/web/src/trpc/routers/api-keys.tsindex 117a96289..9f6e1e1ae 100644--- a/apps/web/src/trpc/routers/api-keys.ts+++ b/apps/web/src/trpc/routers/api-keys.ts@@ -1,8 +1,8 @@import { prisma } from "@rallly/database";import { TRPCError } from "@trpc/server";import * as z from "zod";+import { isApiAccessEnabled } from "@/features/api-keys/data";import { createApiKey } from "@/features/api-keys/utils";-import { isApiAccessEnabled } from "@/features/developer/data";import { router, spaceOwnerProcedure } from "../trpc";const apiAccessProcedure = spaceOwnerProcedure.use(async ({ ctx, next }) => {diff --git a/apps/web/src/trpc/routers/polls.ts b/apps/web/src/trpc/routers/polls.tsindex ace76dd11..27f84ea75 100644--- a/apps/web/src/trpc/routers/polls.ts+++ b/apps/web/src/trpc/routers/polls.ts@@ -9,7 +9,6 @@ import { TRPCError } from "@trpc/server";import { after } from "next/server";import * as z from "zod";import { getInstanceBranding, getSpaceBranding } from "@/emails/branding";-import { posthog } from "@/features/analytics/posthog";import { moderateContent } from "@/features/moderation/mutations";import {canUserManagePoll,@@ -19,6 +18,7 @@ import {import { formatEventDateTime } from "@/features/scheduled-event/utils";import { getActiveSpaceForUser } from "@/features/space/data";import { dayjs } from "@/lib/dayjs";+import { posthog } from "@/lib/posthog";import { createIcsEvent } from "@/lib/utils/ics";import {createRateLimitMiddleware,diff --git a/apps/web/src/trpc/routers/polls/comments.ts b/apps/web/src/trpc/routers/polls/comments.tsindex bb953b8a9..a095f476e 100644--- a/apps/web/src/trpc/routers/polls/comments.ts+++ b/apps/web/src/trpc/routers/polls/comments.ts@@ -6,9 +6,9 @@ import { TRPCError } from "@trpc/server";import { after } from "next/server";import * as z from "zod";import { getInstanceBranding } from "@/emails/branding";-import { posthog } from "@/features/analytics/posthog";import { getNotificationRecipient } from "@/features/notifications/data";import { hasPollAdminAccess } from "@/features/poll/data";+import { posthog } from "@/lib/posthog";import {createRateLimitMiddleware,publicProcedure,diff --git a/apps/web/src/trpc/routers/polls/participants.ts b/apps/web/src/trpc/routers/polls/participants.tsindex 430fa9bf2..45cdba0ac 100644--- a/apps/web/src/trpc/routers/polls/participants.ts+++ b/apps/web/src/trpc/routers/polls/participants.ts@@ -8,9 +8,9 @@ import { TRPCError } from "@trpc/server";import { after } from "next/server";import * as z from "zod";import { getInstanceBranding, getSpaceBranding } from "@/emails/branding";-import { posthog } from "@/features/analytics/posthog";import { getNotificationRecipient } from "@/features/notifications/data";import { hasPollAdminAccess } from "@/features/poll/data";+import { posthog } from "@/lib/posthog";import { getGravatarUrl } from "@/lib/utils/gravatar";import {createRateLimitMiddleware,diff --git a/apps/web/src/trpc/routers/spaces.ts b/apps/web/src/trpc/routers/spaces.tsindex 5f7b72846..e09ccbebe 100644--- a/apps/web/src/trpc/routers/spaces.ts+++ b/apps/web/src/trpc/routers/spaces.ts@@ -7,7 +7,6 @@ import { TRPCError } from "@trpc/server";import { after } from "next/server";import * as z from "zod";import { getInstanceBranding } from "@/emails/branding";-import { posthog } from "@/features/analytics/posthog";import { defineAbilityForSpace } from "@/features/space/ability";import {createSpaceDTO,@@ -25,6 +24,7 @@ import {toDBRole,} from "@/features/space/utils";import { setActiveSpace } from "@/features/user/mutations";+import { posthog } from "@/lib/posthog";import {deleteImageFromS3,getImageUploadUrl,diff --git a/apps/web/src/trpc/routers/user.ts b/apps/web/src/trpc/routers/user.tsindex e4b9ea3bd..15cf636e4 100644--- a/apps/web/src/trpc/routers/user.ts+++ b/apps/web/src/trpc/routers/user.ts@@ -3,12 +3,12 @@ import { prisma } from "@rallly/database";import { sendRawEmail } from "@rallly/emails";import { TRPCError } from "@trpc/server";import * as z from "zod";-import { posthog } from "@/features/analytics/posthog";import { feedbackSchema } from "@/features/feedback/schema";import { defaultNotificationPreferences } from "@/features/notifications/constants";import { getNotificationPreferences } from "@/features/notifications/data";import { activityEventTypes } from "@/features/notifications/schema";import { defineAbilityFor } from "@/features/user/ability";+import { posthog } from "@/lib/posthog";import {createRateLimitMiddleware,privateProcedure,diff --git a/scripts/check-feature-structure.mjs b/scripts/check-feature-structure.mjsindex ed6965db1..499d5511c 100644--- a/scripts/check-feature-structure.mjs+++ b/scripts/check-feature-structure.mjs@@ -5,6 +5,10 @@* Every feature directory (and any sub-concern directory within it) may only* contain the allowed file names below, co-located tests, and the directories* `components/` and `assets/` (whose contents are unrestricted).+ *+ * A useFilenamingConvention override in apps/web/biome.json mirrors this rule+ * at warn severity for in-editor feedback (JS/TS files only) β keep the two+ * in sync when the vocabulary changes.*/import fs from "node:fs";import path from "node:path";@@ -25,38 +29,13 @@ const ALLOWED_FILES = new Set(["constants.ts","utils.ts","client.tsx",+ "service.ts",]);const TEST_FILE_PATTERN = /\.test\.tsx?$/;const UNRESTRICTED_DIRS = new Set(["components", "assets"]);-// Grandfathered exceptions. This list only shrinks β do not add to it.-// Tracked by RAL-1287 / RAL-1288. Paths are relative to-// apps/web/src/features/; entries ending in "/" exempt a whole directory.-const GRANDFATHERED = [- "analytics/posthog.ts",- "calendars/service.ts",- "calendars/services/",- "google/service.ts",- "navigation/config.tsx",-];--const usedGrandfatherEntries = new Set();--function isGrandfathered(relativePath) {- for (const entry of GRANDFATHERED) {- if (- entry === relativePath ||- (entry.endsWith("/") && relativePath.startsWith(entry))- ) {- usedGrandfatherEntries.add(entry);- return true;- }- }- return false;-}-const offenders = [];function walk(dir) {@@ -73,14 +52,10 @@ function walk(dir) {if (UNRESTRICTED_DIRS.has(entry.name)) {continue;}- if (isGrandfathered(`${relativePath}/`)) {- continue;- }walk(absolutePath);} else if (!ALLOWED_FILES.has(entry.name) &&- !TEST_FILE_PATTERN.test(entry.name) &&- !isGrandfathered(relativePath)+ !TEST_FILE_PATTERN.test(entry.name)) {offenders.push(relativePath);}@@ -98,18 +73,6 @@ for (const entry of fs.readdirSync(FEATURES_DIR, { withFileTypes: true })) {}}-const staleEntries = GRANDFATHERED.filter(- (entry) => !usedGrandfatherEntries.has(entry),-);-if (staleEntries.length > 0) {- console.warn(- "Warning: stale grandfather entries in scripts/check-feature-structure.mjs (remove them):",- );- for (const entry of staleEntries) {- console.warn(` ${entry}`);- }-}-if (offenders.length > 0) {console.error(`Found ${offenders.length} file(s) in apps/web/src/features/ that don't match the feature folder vocabulary:\n`,