Skip to content

replace in checks with Object.hasOwn#292956

Merged
meganrogge merged 1 commit intomainfrom
eslint-fix
Feb 4, 2026
Merged

replace in checks with Object.hasOwn#292956
meganrogge merged 1 commit intomainfrom
eslint-fix

Conversation

@meganrogge
Copy link
Contributor

@meganrogge meganrogge commented Feb 4, 2026

part of #276071

Copilot AI review requested due to automatic review settings February 4, 2026 22:45
@meganrogge meganrogge self-assigned this Feb 4, 2026
@meganrogge meganrogge added this to the February 2026 milestone Feb 4, 2026
@meganrogge meganrogge enabled auto-merge (squash) February 4, 2026 22:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in operator checks with Object.hasOwn() for safer property existence checks
  • Converted for...in loops to Object.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

@meganrogge meganrogge merged commit 2a55ee3 into main Feb 4, 2026
27 of 28 checks passed
@meganrogge meganrogge deleted the eslint-fix branch February 4, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants