Skip to content

fix: generated eslint config only imports what package.json installs - #121

Merged
spencer-osbrjp merged 2 commits into
mainfrom
i118-20260812-1
Aug 12, 2026
Merged

fix: generated eslint config only imports what package.json installs#121
spencer-osbrjp merged 2 commits into
mainfrom
i118-20260812-1

Conversation

@spencer-osbrjp

Copy link
Copy Markdown
Collaborator

Closes #118

Root cause

templates/linter/eslint/eslint.config.mjs.tmpl imported globals, typescript-eslint, eslint-plugin-react-hooks, and eslint-plugin-react-refresh unconditionally, but the registry's eslint entry only ships eslint + @eslint/js, and the react-plugin dependency rule fired only for vite-react. Every other base (the reporter used plain Astro) hit Cannot find package on its first husky pre-push lint. The **/*.{ts,tsx,vue,astro} glob also fed .astro/.vue files to a config with no matching parser.

Fix

  • globals + typescript-eslint move into the registry's eslint entry — an unconditional import is an unconditional dependency.
  • The react plugin imports are wrapped in the template's existing IsReactInt condition, and the dep rule now tracks the same condition (vite-react and astro-react, which was silently broken too).
  • The lint glob narrows to **/*.{ts,tsx} — matching what the shipped config can actually parse.

Plain-Astro output now matches the issue's "working config" verbatim.

Preventing the class

New TestGeneratedConfigImportsAreInstalled: scaffolds nine representative combos (every base × eslint, ox tooling, playwright, defaults) and asserts that every package imported by a generated top-level config file is installed by the generated package.json. Any future template/registry drift of this kind fails CI instead of the user's first push.

Testing

go test ./... green (the new guard test fails on the pre-fix templates for astro/astro-vue/vite-vue/nuxt/astro-react). E2E: scaffolded -t astro, confirmed the rendered config and devDependencies line up.

🤖 Generated with Claude Code

@spencer-osbrjp

Copy link
Copy Markdown
Collaborator Author

Second commit widens the fix to the root cause the first one exposed: BaseFramework.GetIntegration had an inverted nil check (returned an error whenever the registry WAS loaded), so IsReactInt/IsVueInt always returned false — the eslint template's react branch could never fire, and IsVueInt also compared against "react". Both repaired, with tests pinning every base's integration helpers and the positive react-plugin wiring (config imports and installed deps). The remaining pre-existing gap found nearby (BumpRegistry skipping backend/orm/database) is filed separately as #122.

spencer-osbrjp and others added 2 commits August 12, 2026 22:37
The eslint.config.mjs template imported globals, typescript-eslint, and the
react plugins unconditionally while the registry entry shipped only
eslint + @eslint/js — the react-plugin dep rule fired for vite-react alone,
so every other base failed its first pre-push lint with missing packages.

- globals + typescript-eslint move into the registry eslint entry
  (unconditional import -> unconditional dependency)
- react plugin imports are now conditional on the base's react integration,
  and the dep rule tracks the same condition (astro-react included)
- the files glob drops vue/astro extensions no shipped parser can handle

TestGeneratedConfigImportsAreInstalled guards the whole class: for every
representative combo, each package imported by a generated top-level config
file must be installed by the generated package.json.

Closes #118

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GetIntegration returned an error whenever the registry WAS loaded (and
would nil-deref when it wasn't), so IsReactInt/IsVueInt always returned
false — the eslint template's react branch could never fire, and IsVueInt
additionally compared against "react". Fixed both, guarded the nil entry,
and pinned every base's IsReactInt/IsVueInt plus the positive react-plugin
wiring (config imports AND installed deps) in tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@spencer-osbrjp
spencer-osbrjp merged commit 49332f5 into main Aug 12, 2026
2 checks passed
@spencer-osbrjp
spencer-osbrjp deleted the i118-20260812-1 branch August 12, 2026 14:39
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.

Generated eslint.config.mjs breaks first push: missing deps and unused React imports (Astro template)

1 participant