fix(create): preserve shorthand fmt/lint config keys#1843
Open
fengmk2 wants to merge 4 commits into
Open
Conversation
✅ Deploy Preview for viteplus-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This comment was marked as resolved.
This comment was marked as resolved.
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`.
7e81e4e to
b16b9f3
Compare
Member
Author
|
@codex review |
There was a problem hiding this comment.
💡 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".
This comment was marked as duplicate.
This comment was marked as duplicate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
vp create(andvp migrate) injected duplicatefmt/lintkeys into a template'svite.config.tswhen those keys were declared via shorthand properties (fmt,/lint,).has_config_keyonly matchedkey: valuepairs, so a shorthand-declared key was treated as absent and a second inline block was added.Fix
Detect
shorthand_property_identifiernodes inhas_config_keyso a shorthand-declared key counts as present.Tests
has_config_key(shorthand in callback / object, nested negative)injectFmtDefaults/injectLintTypeCheckDefaults)migration-inline-config-shorthand(vp migrate) andcreate-monorepo-local-template-shorthand(vp createlocal template); both verified to reproduce the bug before the fixCloses #1836