Skip to content

Commit 09266cb

Browse files
committed
fix: resolve all lint issues
- Remove 'any' types in inputConverters.ts by using proper type inference from Zod schemas - Remove 'any' type in deepnoteInputBlockEditProtection.ts by using Uri type - Fix import restriction by moving SelectInputSettings and SelectInputWebviewMessage types to src/platform/notebooks/deepnote/types.ts - Re-export types from platform in webview-side types file for backward compatibility
1 parent 6a5982b commit 09266cb

File tree

5 files changed

+31
-22
lines changed

5 files changed

+31
-22
lines changed

src/notebooks/deepnote/converters/inputConverters.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ export class InputSliderBlockConverter extends BaseInputBlockConverter<typeof De
245245
value = parsed;
246246
} else if (existingMetadata.success) {
247247
// Parse existing value as number (it might be stored as string in schema)
248-
const existingValue = (existingMetadata.data as any).deepnote_variable_value;
248+
const existingValue = existingMetadata.data.deepnote_variable_value;
249249
const existingParsed = Number(existingValue);
250250
value = Number.isFinite(existingParsed) ? existingParsed : 0;
251251
} else {
252-
const defaultValue = (this.defaultConfig() as any).deepnote_variable_value;
252+
const defaultValue = this.defaultConfig().deepnote_variable_value;
253253
const defaultParsed = Number(defaultValue);
254254
value = Number.isFinite(defaultParsed) ? defaultParsed : 0;
255255
}
@@ -390,11 +390,7 @@ export class InputDateRangeBlockConverter extends BaseInputBlockConverter<typeof
390390
...(block.metadata ?? {}),
391391
...baseMetadata,
392392
deepnote_variable_value:
393-
value !== null
394-
? value
395-
: existingMetadata.success
396-
? (existingMetadata.data as any).deepnote_variable_value
397-
: null
393+
value !== null ? value : existingMetadata.success ? existingMetadata.data.deepnote_variable_value : null
398394
};
399395
}
400396
}

src/notebooks/deepnote/deepnoteInputBlockEditProtection.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
NotebookRange,
77
Position,
88
Range,
9+
Uri,
910
workspace,
1011
WorkspaceEdit
1112
} from 'vscode';
@@ -133,7 +134,7 @@ export class DeepnoteInputBlockEditProtection implements Disposable {
133134
}
134135

135136
// Group cells by notebook to apply edits efficiently
136-
const editsByNotebook = new Map<string, { uri: any; edits: NotebookEdit[] }>();
137+
const editsByNotebook = new Map<string, { uri: Uri; edits: NotebookEdit[] }>();
137138

138139
for (const { cell, blockType } of cellsToFix) {
139140
const expectedLanguage = this.expectedLanguages.get(blockType);

src/notebooks/deepnote/selectInputSettingsWebview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { inject, injectable } from 'inversify';
1717
import { IExtensionContext } from '../../platform/common/types';
1818
import { LocalizedMessages } from '../../messageTypes';
1919
import * as localize from '../../platform/common/utils/localize';
20-
import { SelectInputSettings } from '../../webviews/webview-side/selectInputSettings/types';
20+
import { SelectInputSettings } from '../../platform/notebooks/deepnote/types';
2121

2222
/**
2323
* Manages the webview panel for select input settings

src/platform/notebooks/deepnote/types.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@ import { IDisposable, Resource } from '../../common/types';
33
import { EnvironmentVariables } from '../../common/variables/types';
44
import { IntegrationConfig } from './integrationTypes';
55

6+
/**
7+
* Settings for select input blocks
8+
*/
9+
export interface SelectInputSettings {
10+
allowMultipleValues: boolean;
11+
allowEmptyValue: boolean;
12+
selectType: 'from-options' | 'from-variable';
13+
options: string[];
14+
selectedVariable: string;
15+
}
16+
17+
/**
18+
* Message types for select input settings webview
19+
*/
20+
export interface SelectInputWebviewMessage {
21+
type: 'init' | 'save' | 'locInit' | 'cancel';
22+
settings?: SelectInputSettings;
23+
locStrings?: Record<string, string>;
24+
}
25+
626
export const IIntegrationStorage = Symbol('IIntegrationStorage');
727
export interface IIntegrationStorage extends IDisposable {
828
/**
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
export interface SelectInputSettings {
5-
allowMultipleValues: boolean;
6-
allowEmptyValue: boolean;
7-
selectType: 'from-options' | 'from-variable';
8-
options: string[];
9-
selectedVariable: string;
10-
}
11-
12-
export interface WebviewMessage {
13-
type: 'init' | 'save' | 'locInit' | 'cancel';
14-
settings?: SelectInputSettings;
15-
locStrings?: Record<string, string>;
16-
}
4+
// Re-export types from platform for use in webview
5+
export type {
6+
SelectInputSettings,
7+
SelectInputWebviewMessage as WebviewMessage
8+
} from '../../../platform/notebooks/deepnote/types';

0 commit comments

Comments
 (0)