Repository navigation
test(cli): Cover the json-transform-uses-fields lint rule - #1816
Merged
Merged
Conversation
A jsonTransform replaces the default JSON path, including --fields filtering, so a transform that never read its fields argument made --fields a silent no-op. Fix the 12 commands that did: - alert issues/metrics create and edit: drop the identity transform so the default path filters. - alert issues/metrics delete, alert issues view, auth list, dashboard widget delete, issue merge, issue resolve, project delete: filter what the transform returns with the new filterFieldsIfSet helper. Guard against new cases with the sentry-cli/json-transform-uses-fields lint rule: an inline or same-module jsonTransform, or any top-level jsonTransform* function, must read its second parameter. Fixes #1808 Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Nov 2, 2026
BYK
enabled auto-merge (squash)
November 2, 2026 23:19
…m-fields # Conflicts: # packages/cli/src/commands/alert/issues/create.ts # packages/cli/src/commands/alert/issues/delete.ts # packages/cli/src/commands/alert/issues/edit.ts # packages/cli/src/commands/alert/metrics/create.ts # packages/cli/src/commands/alert/metrics/delete.ts # packages/cli/src/commands/alert/metrics/edit.ts # packages/cli/src/commands/auth/list.ts # packages/cli/src/commands/dashboard/widget/delete.ts
7 tasks done
This branch was successfully deployed
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.
Follow-up to #1808.
This PR started as the standalone #1808 fix: the 12
jsonTransforms that ignored--fields, plus thesentry-cli/json-transform-uses-fieldslint rule. #1783 has since merged with that same fix, so after mergingmainthe only change left isRuleTestercoverage for the rule inscripts/cli-lint-rules.test.mjs.The valid cases are inline, same-module, default-parameter and imported transforms that read
fields. The invalid cases are transforms that dropfields, name it but never use it, or are same-module/jsonTransform*functions with one parameter.--
View Session in Sentry