Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit cc29e87

Browse files
authored
Revert "fix as-any linting warnings" (#892)
Reverts microsoft/vscode-python-environments#891 the tests weren't passing and I didn't realize it would merge it in without that criteria met
1 parent ad44e33 commit cc29e87

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed

.github/instructions/generic.instructions.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ Provide project context and coding guidelines that AI should follow when generat
3030
## Documentation
3131

3232
- Add clear docstrings to public functions, describing their purpose, parameters, and behavior.
33-
34-
## Learnings
35-
36-
- Avoid using 'any' types in TypeScript; import proper types from VS Code API and use specific interfaces for mocks and test objects (1)

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ export default [{
3535
eqeqeq: "warn",
3636
"no-throw-literal": "warn",
3737
semi: "warn",
38-
"@typescript-eslint/no-explicit-any": "error",
38+
"@typescript-eslint/no-explicit-any": "warn",
3939
},
4040
}];

src/test/features/terminalEnvVarInjectorBasic.unit.test.ts

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
import * as sinon from 'sinon';
55
import * as typeMoq from 'typemoq';
6-
import { Disposable, GlobalEnvironmentVariableCollection, workspace, WorkspaceFolder } from 'vscode';
7-
import { DidChangeEnvironmentVariablesEventArgs } from '../../api';
6+
import { GlobalEnvironmentVariableCollection, workspace } from 'vscode';
87
import { EnvVarManager } from '../../features/execution/envVariableManager';
98
import { TerminalEnvVarInjector } from '../../features/terminal/terminalEnvVarInjector';
109

@@ -19,7 +18,8 @@ suite('TerminalEnvVarInjector Basic Tests', () => {
1918
let envVarManager: typeMoq.IMock<EnvVarManager>;
2019
let injector: TerminalEnvVarInjector;
2120
let mockScopedCollection: MockScopedCollection;
22-
let workspaceFoldersStub: WorkspaceFolder[];
21+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
22+
let workspaceFoldersStub: any;
2323

2424
setup(() => {
2525
envVarCollection = typeMoq.Mock.ofType<GlobalEnvironmentVariableCollection>();
@@ -40,25 +40,19 @@ suite('TerminalEnvVarInjector Basic Tests', () => {
4040
};
4141

4242
// Setup environment variable collection to return scoped collection
43-
envVarCollection.setup((x) => x.getScoped(typeMoq.It.isAny())).returns(() => mockScopedCollection as never);
43+
envVarCollection.setup((x) => x.getScoped(typeMoq.It.isAny())).returns(() => mockScopedCollection as any);
4444
envVarCollection.setup((x) => x.clear()).returns(() => {});
4545

4646
// Setup minimal mocks for event subscriptions
4747
envVarManager
4848
.setup((m) => m.onDidChangeEnvironmentVariables)
49-
.returns(() => {
50-
// Return a mock Event function that returns a Disposable when called
51-
const mockEvent = (_listener: (e: DidChangeEnvironmentVariablesEventArgs) => void) =>
49+
.returns(
50+
() =>
5251
({
5352
dispose: () => {},
54-
} as Disposable);
55-
return mockEvent;
56-
});
57-
58-
// Mock workspace.onDidChangeConfiguration to return a Disposable
59-
sinon.stub(workspace, 'onDidChangeConfiguration').returns({
60-
dispose: () => {},
61-
} as Disposable);
53+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
54+
} as any),
55+
);
6256
});
6357

6458
teardown(() => {
@@ -91,21 +85,12 @@ suite('TerminalEnvVarInjector Basic Tests', () => {
9185
envVarManager.reset();
9286
envVarManager
9387
.setup((m) => m.onDidChangeEnvironmentVariables)
94-
.returns(() => {
88+
.returns((_handler) => {
9589
eventHandlerRegistered = true;
96-
// Return a mock Event function that returns a Disposable when called
97-
const mockEvent = (_listener: (e: DidChangeEnvironmentVariablesEventArgs) => void) =>
98-
({
99-
dispose: () => {},
100-
} as Disposable);
101-
return mockEvent;
90+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
91+
return { dispose: () => {} } as any;
10292
});
10393

104-
// Mock workspace.onDidChangeConfiguration to return a Disposable
105-
sinon.stub(workspace, 'onDidChangeConfiguration').returns({
106-
dispose: () => {},
107-
} as Disposable);
108-
10994
// Act
11095
injector = new TerminalEnvVarInjector(envVarCollection.object, envVarManager.object);
11196

0 commit comments

Comments
 (0)