mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
Exclude the worktrees the tooling was already meant to exclude
git, eslint and vitest each carry an exclusion for local development worktrees, and all three name /.worktrees/ while the convention actually in use is /.wt-*/. Every one of them was therefore walking eleven full copies of the source tree. The consequences differed by tool and none of them announced itself. pnpm lint took ten minutes instead of one and reported warnings from whatever commits those copies happened to sit on. vitest collected duplicate suites that drag in a second React instance, which fails in ways that have nothing to do with the working tree. git left them merely untracked, one git add -A away from committing the repository eleven times over. With the true warning count finally visible, teach no-unused-vars the underscore convention this codebase already follows and drop the five disable directives that convention made redundant. pnpm lint is clean. A non-underscore unused argument still warns; that was checked rather than assumed.
This commit is contained in:
1 parent
a463b1fa01
commit
a640e84142
8 files changed
+32
-8
No files matched your search
+6
-1
@@ -87,5 +87,10 @@ next-env.d.ts
|
||||
.audit-*.mjs
|
||||
|
||||
|
||||
# Isolated development worktrees
|
||||
# Isolated development worktrees. `/.wt-*/` is the convention actually in use;
|
||||
# each one is a full copy of the tree with its own node_modules, so leaving it
|
||||
# untracked-but-visible means one `git add -A` commits the repository eleven
|
||||
# times over. The same two names are excluded from eslint and vitest, for the
|
||||
# same reason in a different tool.
|
||||
/.wt-*/
|
||||
/.worktrees/
|
||||
@@ -16,6 +16,10 @@ const eslintConfig = defineConfig([
|
||||
// v1.31.4 — ignore local tool worktrees so a worktree on another
|
||||
// commit cannot poison `pnpm lint` locally.
|
||||
// CI never sees these paths; the rules protect the dev environment.
|
||||
// `.wt-*` is the convention actually in use; the two names below predate
|
||||
// it. Without the first pattern `pnpm lint` walks every worktree in the
|
||||
// root, which is both slow and exactly the poisoning this list prevents.
|
||||
".wt-*/**",
|
||||
".claude/**",
|
||||
".worktrees/**",
|
||||
// The project-local ESLint rule plugin is CommonJS (require/module
|
||||
@@ -32,6 +36,21 @@ const eslintConfig = defineConfig([
|
||||
{
|
||||
plugins: { healthlog: healthlogPlugin },
|
||||
rules: {
|
||||
// The codebase already marks a deliberately unused binding by prefixing
|
||||
// it with an underscore — a required-but-ignored route handler argument,
|
||||
// a mock signature that has to match the real one. The rule did not know
|
||||
// that convention, so seven such bindings warned and `pnpm lint` could
|
||||
// not be read as pass/fail. Teaching it the convention is what makes a
|
||||
// real warning visible again.
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
caughtErrorsIgnorePattern: "^_",
|
||||
destructuredArrayIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
"healthlog/queryKey-factory": "error",
|
||||
// v1.5.6 — every outbound fetch under src/lib + src/app must route
|
||||
// through the safeFetch wrapper (manual-redirect + timeout, and the
|
||||
|
||||
@@ -40,7 +40,6 @@ import { apiSuccess } from "@/lib/api-response";
|
||||
import { getAssistantFlags } from "@/lib/feature-flags";
|
||||
import { annotate } from "@/lib/logging/context";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const GET = apiHandler(async (_request: NextRequest) => {
|
||||
await requireAuth();
|
||||
annotate({ action: { name: "feature-flags.read" } });
|
||||
|
||||
@@ -62,7 +62,6 @@ const CATEGORY_ORDER: readonly MeasurementCategory[] = [
|
||||
"metabolic",
|
||||
] as const;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const GET = apiHandler(async (_request: NextRequest) => {
|
||||
await requireAuth();
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ import {
|
||||
TOMBSTONE_RETENTION_DAYS,
|
||||
} from "@/lib/auth/native-client";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const GET = apiHandler(async (_request: NextRequest) => {
|
||||
const { user } = await requireAuth();
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@ export interface GoalsChipPickerProps {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function GoalsChipPicker({ userId: _userId }: GoalsChipPickerProps) {
|
||||
const { t } = useTranslations();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -88,7 +88,6 @@ export type CycleGateResult =
|
||||
*/
|
||||
export async function requireCycleEnabled(
|
||||
userId: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_gender: string | null | undefined,
|
||||
): Promise<CycleGateResult> {
|
||||
const [profile, available] = await Promise.all([
|
||||
|
||||
+7
-2
@@ -31,8 +31,13 @@ export default defineConfig({
|
||||
"tests/integration/**",
|
||||
// Playwright E2E suite — driven separately via `pnpm e2e`.
|
||||
"e2e/**",
|
||||
// Local agent worktrees create copies of `src/` under `.claude/`
|
||||
// or `.worktrees/`; vitest must not collect stale duplicate suites.
|
||||
// Local tool worktrees create full copies of `src/` in the repo root;
|
||||
// vitest must not collect stale duplicate suites from them. The copies
|
||||
// also carry their own `node_modules`, so a collected duplicate drags in
|
||||
// a SECOND React instance and fails in ways that have nothing to do with
|
||||
// the working tree. `.wt-*` is the convention actually in use — the two
|
||||
// names below predate it and are kept because both still occur.
|
||||
".wt-*/**",
|
||||
".claude/worktrees/**",
|
||||
".worktrees/**",
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user