Skip to content

fix(create): preserve shorthand fmt/lint config keys#1843

Open
fengmk2 wants to merge 4 commits into
mainfrom
fix/1836-shorthand-config-keys
Open

fix(create): preserve shorthand fmt/lint config keys#1843
fengmk2 wants to merge 4 commits into
mainfrom
fix/1836-shorthand-config-keys

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jun 15, 2026

Copy link
Copy Markdown
Member

Problem

vp create (and vp migrate) injected duplicate fmt/lint keys into a template's vite.config.ts when those keys were declared via shorthand properties (fmt, / lint,). has_config_key only matched key: value pairs, so a shorthand-declared key was treated as absent and a second inline block was added.

Fix

Detect shorthand_property_identifier nodes in has_config_key so a shorthand-declared key counts as present.

Tests

  • Rust unit tests for has_config_key (shorthand in callback / object, nested negative)
  • TS tests for the inject path (injectFmtDefaults / injectLintTypeCheckDefaults)
  • Snap tests migration-inline-config-shorthand (vp migrate) and create-monorepo-local-template-shorthand (vp create local template); both verified to reproduce the bug before the fix

Closes #1836

@fengmk2 fengmk2 self-assigned this Jun 15, 2026
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 048b20d
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a30046ca2ad360008bafd11
😎 Deploy Preview https://deploy-preview-1843--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@fengmk2

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

fengmk2 added 2 commits June 15, 2026 21:11
vp create and vp migrate inject default fmt/lint blocks into the project's
vite.config.ts, guarded by has_config_key. That check only matched
`key: value` pairs, so a template that declares fmt/lint via shorthand
properties (`fmt,` / `lint,`) was treated as not having them and got a
duplicate inline key.

Detect shorthand_property_identifier nodes in has_config_key so a
shorthand-declared key counts as present.

Closes #1836
The pre-commit lint-staged glob does not cover .mjs/.json, so these two
files in the new create-monorepo snap fixture were committed unformatted
and failed `vp check`.
@fengmk2 fengmk2 force-pushed the fix/1836-shorthand-config-keys branch from 7e81e4e to b16b9f3 Compare June 15, 2026 13:11
@fengmk2

fengmk2 commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

@codex review

@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: b16b9f3341

ℹ️ 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/vite_migration/src/vite_config.rs
@fengmk2

This comment was marked as duplicate.

chatgpt-codex-connector[bot]

This comment was marked as duplicate.

@fengmk2 fengmk2 marked this pull request as ready for review June 15, 2026 13:42
@fengmk2 fengmk2 requested review from Brooooooklyn and cpojer June 15, 2026 13:42
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 mutates custom template vite.config.ts and creates duplicate config keys

1 participant