8000 init template missing test-file override → consumers' tests trip size rules under `pnpm lint` · Issue #9 · habit-hooks/habit-hooks · GitHub
[go: up one dir, main page]

Skip to content

init template missing test-file override → consumers' tests trip size rules under pnpm lint #9

Closed

Description

@devill

Symptom

The bundled src/cli/init/templates/eslint-config.ts writes a flat config that turns ON max-lines-per-function: 12 and max-lines: 200 for every file, including test files. habit-hooks' own rule layer (TEST_FILE_EXCLUDE in src/config/defaults.ts:172) correctly exempts tests from these rules when habit-hooks runs — but the consumer's direct eslint . / pnpm lint invocation sees the unmoderated config and fires on every test file.

We hit exactly this dogfooding the rules on this repo (134 violations, ~105 in tests). Phase A added a test-file override to eslint.config.js to bring direct lint into line with habit-hooks's documented exemption:

{
  files: ['**/*.test.ts', '**/*.spec.ts', 'tests/**'],
  rules: {
    'max-lines-per-function': 'off',
    'max-lines': 'off',
  },
},

The bundled template should ship the same override, so a consumer who scaffolds a fresh setup doesn't immediately see pnpm lint failing on tests it should never have been checking against those thresholds.

Fix

Add the test-file override block to ESLINT_CONFIG_TEMPLATE in src/cli/init/templates/eslint-config.ts. Same glob list as TEST_FILE_EXCLUDE (['**/*.test.ts', '**/*.spec.ts', 'tests/**']) so the two layers agree.

Why this matters for the alpha

A first-time user who runs habit-hooks init and immediately runs pnpm lint will get a wall of test-file failures, which doesn't match the messaging in AGENT_SNIPPET or README. The init promise is "scaffold a sensible default" — this is the missing piece.

Activity

  1. added a commit that references this issue on Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0