replace in checks with Object.hasOwn#292956
Merged
meganrogge merged 1 commit intomainfrom Feb 4, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the in operator with Object.hasOwn() and converts for...in loops to Object.keys() to comply with a new ESLint rule that disallows the in operator. The changes affect task system components, terminal contribution features, and the terminal-suggest extension.
Changes:
- Replaced
inoperator checks withObject.hasOwn()for safer property existence checks - Converted
for...inloops toObject.keys()for more predictable iteration - Added type assertions where needed to maintain type safety after the refactoring
- Removed affected files from the ESLint allowlist
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| eslint.config.js | Removed 10 files from the no-in rule allowlist that are being fixed in this PR |
| src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts | Converted for...in to Object.keys() in 3 locations; replaced in checks with Object.hasOwn() in 2 locations; improved type guard at line 1414 using CustomTask.is() and ContributedTask.is() instead of in operator |
| src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.ts | Replaced in operator with Object.hasOwn() for checking terminalId property |
| src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts | Converted 4 for...in loops to Object.keys(); replaced 3 in operator checks with Object.hasOwn() with appropriate type assertions |
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.ts | Replaced in operator checks with Object.hasOwn() in 5 locations; updated IConfiguredTask interface to include missing properties; added type casts to maintain type safety |
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.ts | Refactored JSON parsing validation to use Object.hasOwn() with improved type safety; added null check before property access |
| extensions/terminal-suggest/src/terminalSuggestMain.ts | Replaced in operator with Object.hasOwn() for checking shell property |
| extensions/terminal-suggest/src/test/env/pathExecutableCache.test.ts | Replaced in operator with Object.hasOwn() in test assertions |
| extensions/terminal-suggest/src/fig/figInterface.ts | Added type guard for function before using Object.hasOwn() on spec object; replaced in operator with Object.hasOwn() for args property checks with type assertions |
| extensions/terminal-suggest/src/fig/fig-autocomplete-shared/specMetadata.ts | Replaced in operator with Object.hasOwn() for type discrimination with explicit return type annotations |
| extensions/terminal-suggest/src/fig/fig-autocomplete-shared/mixins.ts | Replaced in operator with Object.hasOwn() in filter predicate |
DonJayamanne
approved these changes
Feb 4, 2026
DonJayamanne
approved these changes
Feb 4, 2026
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.
part of #276071