Skip to content

Cleanup some eslint exemptions#276581

Merged
lramos15 merged 5 commits intomainfrom
lramos15/vertical-mackerel
Nov 10, 2025
Merged

Cleanup some eslint exemptions#276581
lramos15 merged 5 commits intomainfrom
lramos15/vertical-mackerel

Conversation

@lramos15
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings November 10, 2025 19:51
@lramos15 lramos15 enabled auto-merge (squash) November 10, 2025 19:51
@lramos15 lramos15 self-assigned this Nov 10, 2025
@vs-code-engineering
Copy link

vs-code-engineering bot commented Nov 10, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/browser/parts/editor/editorGroupView.ts

@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 10, 2025
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 systematically removes eslint exemptions by improving type safety across the telemetry system. The changes replace loose any types with more specific types like unknown, ITelemetryData, and proper type annotations.

Key Changes:

  • Replaced any with unknown throughout the telemetry system for better type safety
  • Updated test assertions from in operator checks to direct property access with truthiness checks
  • Added type guards and proper type conversions in telemetry data handling code

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
eslint.config.js Removed 17 files from the no-restricted-syntax rule exemption list for any and in operator
src/vs/platform/telemetry/common/telemetry.ts Updated ITelemetryData index signature from any to string | unknown | undefined
src/vs/platform/telemetry/common/telemetryUtils.ts Replaced any with unknown in function signatures and added type guards; updated cleanData to handle undefined data
src/vs/platform/telemetry/common/telemetryService.ts Removed cast and added null coalescing when logging to appenders
src/vs/platform/telemetry/common/telemetryLogAppender.ts Changed log method parameter type from any to unknown
src/vs/platform/telemetry/common/telemetryIpc.ts Updated ITelemetryLog.data and method signatures to use ITelemetryData instead of any
src/vs/platform/telemetry/common/gdprTypings.ts Changed ClassifiedEvent mapped type values from any to unknown
src/vs/platform/telemetry/common/1dsAppender.ts Replaced any with unknown and added proper validated data handling
src/vs/platform/telemetry/browser/1dsAppender.ts Updated constructor parameter type from any to unknown
src/vs/platform/telemetry/node/1dsAppender.ts Updated constructor and response header types from any to appropriate types
src/vs/platform/telemetry/node/errorTelemetry.ts Changed Promise rejection types from any to unknown
src/vs/workbench/services/timer/browser/timerService.ts Added ITelemetryData import and double cast for metrics object
src/vs/workbench/browser/parts/editor/editorGroupView.ts Changed return type of toEditorTelemetryDescriptor from object to ITelemetryData
src/vs/workbench/api/common/extHostTelemetry.ts Added type definition for event data and added type guards for error properties
src/vs/workbench/services/telemetry/test/node/commonProperties.test.ts Replaced 'property' in obj checks with direct property access in assertions
src/vs/workbench/services/telemetry/test/browser/commonProperties.test.ts Replaced 'property' in obj checks with direct property access in assertions

from?: string;
target?: string;
[key: string]: any;
[key: string]: string | unknown | undefined;
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

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

The type definition string | unknown | undefined is redundant. Since unknown is the top type that includes all other types (including string and undefined), this union is equivalent to just unknown. Consider simplifying to:

[key: string]: unknown;
Suggested change
[key: string]: string | unknown | undefined;
[key: string]: unknown;

Copilot uses AI. Check for mistakes.
// Some telemetry modules prefer to break properties and measurmements up
// We mix common properties into the properties tab.
let updatedData = 'properties' in data ? (data.properties ?? {}) : data;
let updatedData = data.properties ? (data.properties ?? {}) : data;
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

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

The expression data.properties ? (data.properties ?? {}) is redundant. If data.properties is truthy, the nullish coalescing operator ?? {} will never use the fallback empty object since the value is already truthy. This should be simplified to:

let updatedData = data.properties ?? data;

This correctly uses data.properties if it exists (even if it's an empty object), otherwise falls back to data.

Suggested change
let updatedData = data.properties ? (data.properties ?? {}) : data;
let updatedData = data.properties ?? data;

Copilot uses AI. Check for mistakes.
}
*/
this._telemetryService.publicLog('startupTimeVaried', metrics);
this._telemetryService.publicLog('startupTimeVaried', metrics as unknown as ITelemetryData);
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

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

The double type cast as unknown as ITelemetryData is a code smell that suggests type system issues. This bypasses type safety and should be avoided. Consider either:

  1. Ensuring that IStartupMetrics properly extends or is compatible with ITelemetryData
  2. Creating a proper conversion function that maps IStartupMetrics to ITelemetryData
  3. If the GDPR annotation guarantees type safety, using publicLog2 with proper type parameters instead of publicLog
Suggested change
this._telemetryService.publicLog('startupTimeVaried', metrics as unknown as ITelemetryData);
type StartupTimeVariedClassification = {
owner: 'jrieken';
// The GDPR annotation includes all properties from IStartupMetrics
// so we use the include directive here. The actual classification is handled by the GDPR tooling.
};
this._telemetryService.publicLog2<IStartupMetrics, StartupTimeVariedClassification>('startupTimeVaried', metrics);

Copilot uses AI. Check for mistakes.
Tyriar
Tyriar previously approved these changes Nov 10, 2025
@lramos15 lramos15 requested a review from Tyriar November 10, 2025 21:01
@lramos15 lramos15 merged commit 6d5752b into main Nov 10, 2025
28 checks passed
@lramos15 lramos15 deleted the lramos15/vertical-mackerel branch November 10, 2025 21:21
Kosta-Github added a commit to Kosta-Github/vscode that referenced this pull request Nov 11, 2025
…nal-tooltips-markdown

* 'main' of https://github.com/microsoft/vscode: (56 commits)
  edits: show diff for sensitive edit confirmations (microsoft#276620)
  Enable Back button on the Manage Accounts picker (microsoft#276622)
  Ignore obsolete chat content parts when loading persisted session (microsoft#276615)
  settings cleanup (microsoft#276602)
  Remove unused `args: any` parameter
  Terminal suggest - include persistent options in suggestions and improve suggestion grouping (microsoft#276409)
  fix selections not being added (microsoft#276600)
  Embed AI search into the existing search view message (microsoft#276586)
  Cleanup some eslint exemptions (microsoft#276581)
  fix microsoft#276579 (microsoft#276590)
  SCM - cleanup some more eslint rules (microsoft#276571)
  Bump gpu types and skip lib check for gpu typing issue
  Fix in smoke tests
  Remove `forChatSessionTypeAndId`
  Fix one more import
  detect `press any/a key` and ask if user wants to send `a` to terminal (microsoft#276554)
  Filter subagent and todo tools from subagent requests (microsoft#276553)
  Expand hover setting to allow for key modifier mode (microsoft#274001)
  Allow partial monacoEnvironment.getWorker/getWorkerUrl
  Update imports
  ...
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Dec 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants