fix(linter): delete override block when update returns undefined in replaceOverride#34070
Merged
fix(linter): delete override block when update returns undefined in replaceOverride#34070
Conversation
…eplaceOverride ## Current Behavior When `replaceOverride` is called with an update function that returns `undefined`, the override block is not removed. This is inconsistent with the JSON code path which uses `splice` to remove the override. ## Expected Behavior When the update function returns `undefined`, the entire override block should be deleted from the flat config, matching the JSON path behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
AgentEnder
approved these changes
Jan 9, 2026
Contributor
|
View your CI Pipeline Execution ↗ for commit af483ec
☁️ Nx Cloud last updated this comment at |
FrozenPandaz
pushed a commit
that referenced
this pull request
Jan 14, 2026
…eplaceOverride (#34070) I found regression in `replaceOverride` behavior that isn't guarded against. There is migration from v17 (https://github.com/nrwl/nx/blob/20.8.x/packages/next/src/migrations/update-17-2-7/remove-eslint-rules-patch.ts#L17) that shows that when `update` function returns `undefined`, then that override entry should be removed. We had no other unit tests to cover this case previously, so it was missed until I tried cherry-picking the fix to `20.8.x` branch. There was also a bug with flat config in v20 and v21 where not passing `update` function for flat config leads to an error due to `update(data)` being called without checking if `update` exists (since it's optional). We never actually skip on passing `update` (which makes `replaceOverride` useless since it's noop), so I marked it as required arg now. ## Current Behavior When `replaceOverride` is called with an update function that returns `undefined`, the override block is not removed. This is inconsistent with the JSON code path which uses `splice` to remove the override. ## Expected Behavior When the update function returns `undefined`, the entire override block should be deleted from the flat config, matching the JSON path behavior. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> (cherry picked from commit 0fe39b2)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
I found regression in
replaceOverridebehavior that isn't guarded against. There is migration from v17 (https://github.com/nrwl/nx/blob/20.8.x/packages/next/src/migrations/update-17-2-7/remove-eslint-rules-patch.ts#L17) that shows that whenupdatefunction returnsundefined, then that override entry should be removed.We had no other unit tests to cover this case previously, so it was missed until I tried cherry-picking the fix to
20.8.xbranch.There was also a bug with flat config in v20 and v21 where not passing
updatefunction for flat config leads to an error due toupdate(data)being called without checking ifupdateexists (since it's optional). We never actually skip on passingupdate(which makesreplaceOverrideuseless since it's noop), so I marked it as required arg now.Current Behavior
When
replaceOverrideis called with an update function that returnsundefined, the override block is not removed. This is inconsistent with the JSON code path which usesspliceto remove the override.Expected Behavior
When the update function returns
undefined, the entire override block should be deleted from the flat config, matching the JSON path behavior.