Skip to content

Commit ae1848a

Browse files
authored
Ensure code compiles in strict mode (#4044)
For #611 Fixes to part of the code (not all)
1 parent 43ef0ce commit ae1848a

70 files changed

Lines changed: 289 additions & 169 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,7 @@
19031903
"@types/chai-as-promised": "^7.1.0",
19041904
"@types/copy-webpack-plugin": "^4.4.2",
19051905
"@types/del": "^3.0.0",
1906+
"@types/diff-match-patch": "^1.0.32",
19061907
"@types/dotenv": "^4.0.3",
19071908
"@types/download": "^6.2.2",
19081909
"@types/enzyme": "^3.1.14",

src/client/activation/downloadChannelRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const frequencyForBetalLSDownloadCheck = 1000 * 60 * 60 * 24; // One day.
1313

1414
@injectable()
1515
export class DownloadDailyChannelRule implements IDownloadChannelRule {
16-
public async shouldLookForNewLanguageServer(currentFolder?: FolderVersionPair): Promise<boolean> {
16+
public async shouldLookForNewLanguageServer(_currentFolder?: FolderVersionPair): Promise<boolean> {
1717
return true;
1818
}
1919
}

src/client/activation/downloader.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import {
2020
IPlatformData
2121
} from './types';
2222

23+
// tslint:disable:no-require-imports no-any
24+
2325
const downloadFileExtension = '.nupkg';
2426

2527
@injectable()
@@ -113,9 +115,9 @@ export class LanguageServerDownloader implements ILanguageServerDownloader {
113115
throw error;
114116
}
115117
});
116-
const requestProgress = await import('request-progress');
118+
const requestProgress = require('request-progress');
117119
requestProgress(req)
118-
.on('progress', (state) => {
120+
.on('progress', (state: any) => {
119121
// https://www.npmjs.com/package/request-progress
120122
const received = Math.round(state.size.transferred / 1024);
121123
const total = Math.round(state.size.total / 1024);
@@ -124,7 +126,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader {
124126
message: `${title}${received} of ${total} KB (${percentage}%)`
125127
});
126128
})
127-
.on('error', (err) => {
129+
.on('error', (err: any) => {
128130
deferred.reject(err);
129131
})
130132
.on('end', () => {
@@ -161,7 +163,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader {
161163
if (!await this.fs.directoryExists(destinationFolder)) {
162164
await this.fs.createDirectory(destinationFolder);
163165
}
164-
zip.extract(null, destinationFolder, (err) => {
166+
zip.extract(null, destinationFolder, (err: any) => {
165167
if (err) {
166168
deferred.reject(err);
167169
} else {
@@ -172,7 +174,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader {
172174
}).on('extract', () => {
173175
extractedFiles += 1;
174176
progress.report({ message: `${title}${Math.round(100 * extractedFiles / totalFiles)}%` });
175-
}).on('error', e => {
177+
}).on('error', (e: any) => {
176178
deferred.reject(e);
177179
});
178180
return deferred.promise;

src/client/activation/languageServer/analysisOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class LanguageServerAnalysisOptions implements ILanguageServerAnalysisOpt
5656
}
5757
@traceDecorators.error('Failed to get analysis options')
5858
public async getAnalysisOptions(): Promise<LanguageClientOptions> {
59-
const properties = new Map<string, {}>();
59+
const properties: { [key: string]: {}} = {};
6060
let interpreterData: InterpreterData | undefined;
6161
let pythonPath = '';
6262

src/client/activation/languageServer/languageServerFolderService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class LanguageServerFolderService implements ILanguageServerFolderService
3131
}
3232

3333
serverVersion = await this.getLatestLanguageServerVersion()
34-
.catch(ex => undefined);
34+
.catch(() => undefined);
3535

3636
if (currentFolder && (!serverVersion || serverVersion.version.compare(currentFolder.version) <= 0)) {
3737
return path.basename(currentFolder.path);

src/client/application/diagnostics/checks/envPathVariable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const InvalidEnvPathVariableMessage = 'The environment variable \'{0}\' seems to
2020
' The existence of such a character is known to have caused the {1} extension to not load. If the extension fails to load please modify your paths to remove this \'"\' character.';
2121

2222
export class InvalidEnvironmentPathVariableDiagnostic extends BaseDiagnostic {
23-
constructor(message) {
23+
constructor(message: string) {
2424
super(DiagnosticCodes.InvalidEnvironmentPathVariableDiagnostic,
2525
message, DiagnosticSeverity.Warning, DiagnosticScope.Global);
2626
}
@@ -78,7 +78,7 @@ export class EnvironmentPathVariableDiagnosticsService extends BaseDiagnosticsSe
7878
const currentProc = this.serviceContainer.get<ICurrentProcess>(ICurrentProcess);
7979
const pathValue = currentProc.env[this.platform.pathVariableName];
8080
const pathSeparator = this.serviceContainer.get<IPathUtils>(IPathUtils).delimiter;
81-
const paths = pathValue.split(pathSeparator);
81+
const paths = (pathValue || '').split(pathSeparator);
8282
return paths.filter(item => item.indexOf('"') >= 0).length > 0;
8383
}
8484
}

src/client/application/diagnostics/checks/invalidDebuggerType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const InvalidDebuggerTypeMessage = 'Your launch.json file needs to be updated to
2121
'not work. Would you like to automatically update your launch.json file now?';
2222

2323
export class InvalidDebuggerTypeDiagnostic extends BaseDiagnostic {
24-
constructor(message) {
24+
constructor(message: string) {
2525
super(DiagnosticCodes.InvalidDebuggerTypeDiagnostic,
2626
message, DiagnosticSeverity.Error, DiagnosticScope.WorkspaceFolder);
2727
}

src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class InvalidPythonPathInDebuggerService extends BaseDiagnosticsService i
102102
// tslint:disable-next-line:no-object-literal-type-assertion
103103
command: {
104104
diagnostic, invoke: async (): Promise<void> => {
105-
const launchJson = this.getLaunchJsonFile(workspc.workspaceFolders[0]);
105+
const launchJson = this.getLaunchJsonFile(workspc.workspaceFolders![0]);
106106
await openFile(launchJson);
107107
}
108108
}

src/client/application/diagnostics/checks/lsNotSupported.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { DiagnosticCommandPromptHandlerServiceId, MessageCommandPrompt } from '.
1515
import { DiagnosticScope, IDiagnostic, IDiagnosticHandlerService } from '../types';
1616

1717
export class LSNotSupportedDiagnostic extends BaseDiagnostic {
18-
constructor(message) {
18+
constructor(message: string) {
1919
super(DiagnosticCodes.LSNotSupportedDiagnostic,
2020
message, DiagnosticSeverity.Warning, DiagnosticScope.Global);
2121
}

0 commit comments

Comments
 (0)