fix: treat Sanity blueprint files as convention entries - #1748
Draft
skoshx wants to merge 2 commits into
Draft
Conversation
Fixes #1747 sanity.blueprint.ts is a Sanity Studio convention file loaded by filename by the Sanity CLI (sanity blueprints deploy), similar to sanity.config.ts and sanity.cli.ts. It was incorrectly reported as unused by react-doctor/unused-file. Added sanity.blueprint.{ts,js} to the alwaysUsed list in FRAMEWORK_PATTERNS for Sanity, with a regression test. Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
commit: |
Contributor
Interactive terminal E2ETerminal Control verified the built CLI at
|
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.
Root Cause
sanity.blueprint.tsis a Sanity Studio convention file that the Sanity CLI loads by filename (viasanity blueprints deploy), similar to how it loadssanity.config.tsandsanity.cli.ts. The Blueprints feature was introduced in Sanity Studio v3 and is documented at https://www.sanity.io/docs/compute-and-ai/blueprints.The file was incorrectly reported as unused by
react-doctor/unused-filebecause it was not included in thealwaysUsedarray inFRAMEWORK_PATTERNSfor Sanity.Scope Decision
What was changed:
sanity.blueprint.{ts,js}to thealwaysUsedlist in the Sanity framework pattern definitionWhat was deliberately not changed:
src: "./functions/auto-redirect"indefineDocumentFunction). These are runtime paths resolved by the Sanity CLI and are outside the scope of this fix.Expected impact:
This fix will only affect Sanity Studio projects (with
sanityor@sanity/*dependencies) that have asanity.blueprint.tsorsanity.blueprint.jsfile. Those files will no longer be incorrectly flagged as unused.Testing
treats Sanity blueprint configuration as a convention entryCloses #1747