Skip to content

fix(create): remove nested monorepo lint config - #2667

Open
semimikoh wants to merge 1 commit into
voidzero-dev:mainfrom
semimikoh:fix/create-monorepo-lint-config
Open

fix(create): remove nested monorepo lint config#2667
semimikoh wants to merge 1 commit into
voidzero-dev:mainfrom
semimikoh:fix/create-monorepo-lint-config

Conversation

@semimikoh

Copy link
Copy Markdown
Contributor

Summary

  • remove the generated library lint block when scaffolding a Vite+ monorepo
  • preserve the lint configuration for standalone vite:library projects
  • add an AST-based top-level config key removal helper and regression coverage

Fixes #2640

Test plan

  • cargo test -p vp_migration remove_config_key
  • cargo fmt --check -- crates/vp_migration/src/vite_config.rs crates/vp_migration/src/lib.rs packages/cli/binding/src/migration.rs
  • git diff --check

@fengmk2

fengmk2 commented Sep 11, 2026

Copy link
Copy Markdown
Member

Can you add a new snapshot test case to cover this bug fix?

@fengmk2 fengmk2 self-assigned this Sep 11, 2026
@fengmk2

fengmk2 commented Sep 11, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-11T08:13:37.047660Z dd80e94 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@semimikoh
semimikoh force-pushed the fix/create-monorepo-lint-config branch from dd80e94 to e988fd6 Compare September 11, 2026 08:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd80e94f48

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vp_migration/src/vite_config.rs Outdated
continue;
}
let Some(parent_object) = node.parent() else { continue };
if parent_object.kind() != "object" || !is_recognized_config_object(&parent_object) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict removal to direct config objects

When a defineConfig callback contains a nested function that returns an object with a lint property—for example, an inline plugin hook—is_recognized_config_object considers that returned object part of the Vite config because it accepts any return beneath the callback. Consequently, this destructive transform removes both the top-level lint configuration and the unrelated nested property. Use the existing is_direct_recognized_config_object predicate, which explicitly excludes nested-function returns, and cover this case with a regression test.

Useful? React with 👍 / 👎.

: 'utils';
const libraryProjectPath = path.join(fullPath, libraryDir);
setPackageName(libraryProjectPath, libraryPackageName);
removeNestedLibraryLintConfig(libraryProjectPath);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply lint removal to libraries added to existing monorepos

When vp create vite:library is run inside an existing monorepo, execution downloads the same LibraryTemplateRepo through executeBuiltinTemplate (packages/cli/src/create/templates/builtin.ts:33-52) and then goes directly through rewriteMonorepoProject (packages/cli/src/create/bin.ts:1229-1244); neither path calls this helper. That generated workspace member therefore retains the same unsupported nested lint block, so the regression remains for the normal add-a-library flow even though the initial vite:monorepo library is fixed. Invoke this cleanup from the shared library scaffold path when the destination is a monorepo member.

Useful? React with 👍 / 👎.

The standalone library template enables lint type checking, but nested lint configuration is not supported in monorepos.

Remove the generated library's lint block during monorepo scaffolding while preserving it for standalone libraries. Apply the cleanup when adding libraries to existing monorepos as well.

Use an AST-based config-key transform restricted to direct config objects, and add CLI snapshot coverage for both creation paths.
@semimikoh
semimikoh force-pushed the fix/create-monorepo-lint-config branch from e988fd6 to 9932a48 Compare September 11, 2026 09:12
@semimikoh

Copy link
Copy Markdown
Contributor Author

@fengmk2 I added snapshot test coverage for this bug fix. Thanks for the suggestion!

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.

vp create monorepo vite.config.ts is invalid

2 participants