diff --git a/extension/eslint.config.js b/extension/eslint.config.js
index 9581650..1ebe37c 100644
--- a/extension/eslint.config.js
+++ b/extension/eslint.config.js
@@ -13,7 +13,14 @@
// TODO(hxjiang): fix problem reported and enable all the rules below.
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-explicit-any': 'off',
- '@typescript-eslint/no-unused-vars': 'off',
+ '@typescript-eslint/no-unused-vars': [
+ 'error',
+ {
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ caughtErrorsIgnorePattern: '^_'
+ }
+ ],
'n/no-missing-import': 'off',
'n/no-unpublished-import': 'off',
'n/no-extraneous-import': 'off',
diff --git a/extension/src/debugAdapter/goDebug.ts b/extension/src/debugAdapter/goDebug.ts
index 8f49254..9f0b0e1 100644
--- a/extension/src/debugAdapter/goDebug.ts
+++ b/extension/src/debugAdapter/goDebug.ts
@@ -237,25 +237,10 @@
goStatementLoc: DebugLocation;
}
-interface DebuggerCommand {
- name: string;
- threadID?: number;
- goroutineID?: number;
-}
-
interface ListBreakpointsOut {
Breakpoints: DebugBreakpoint[];
}
-interface RestartOut {
- DiscardedBreakpoints: DiscardedBreakpoint[];
-}
-
-interface DiscardedBreakpoint {
- breakpoint: DebugBreakpoint;
- reason: string;
-}
-
// Unrecovered panic and fatal throw breakpoint IDs taken from delve:
// https://github.com/go-delve/delve/blob/f90134eb4db1c423e24fddfbc6eff41b288e6297/pkg/proc/breakpoints.go#L11-L21
// UnrecoveredPanic is the name given to the unrecovered panic breakpoint.
@@ -946,7 +931,7 @@
protected initializeRequest(
response: DebugProtocol.InitializeResponse,
- args: DebugProtocol.InitializeRequestArguments
+ _args: DebugProtocol.InitializeRequestArguments
): void {
log('InitializeRequest');
// Set the capabilities that this debug adapter supports.
@@ -1013,8 +998,8 @@
}
protected async disconnectRequestHelper(
- response: DebugProtocol.DisconnectResponse,
- args: DebugProtocol.DisconnectArguments
+ _response: DebugProtocol.DisconnectResponse,
+ _args: DebugProtocol.DisconnectArguments
): Promise<void> {
// There is a chance that a second disconnectRequest can come through
// if users click detach multiple times. In that case, we want to
@@ -1042,7 +1027,7 @@
protected async configurationDoneRequest(
response: DebugProtocol.ConfigurationDoneResponse,
- args: DebugProtocol.ConfigurationDoneArguments
+ _args: DebugProtocol.ConfigurationDoneArguments
): Promise<void> {
log('ConfigurationDoneRequest');
if (this.stopOnEntry) {
@@ -2251,7 +2236,7 @@
let convertedBreakpoints: (DebugBreakpoint | null)[];
if (!this.delve?.isApiV1) {
// Unwrap breakpoints from v2 apicall
- convertedBreakpoints = newBreakpoints.map((bp, i) => {
+ convertedBreakpoints = newBreakpoints.map((bp) => {
return bp ? (bp as CreateBreakpointOut).Breakpoint : null;
});
} else {
@@ -2853,17 +2838,12 @@
// queryGOROOT returns `go env GOROOT`.
function queryGOROOT(cwd: any, env: any): Promise<string> {
return new Promise<string>((resolve) => {
- execFile(
- getBinPathWithPreferredGopathGoroot('go', []),
- ['env', 'GOROOT'],
- { cwd, env },
- (err, stdout, stderr) => {
- if (err) {
- return resolve('');
- }
- return resolve(stdout.trim());
+ execFile(getBinPathWithPreferredGopathGoroot('go', []), ['env', 'GOROOT'], { cwd, env }, (err, stdout) => {
+ if (err) {
+ return resolve('');
}
- );
+ return resolve(stdout.trim());
+ });
});
}
diff --git a/extension/src/goBaseCodelens.ts b/extension/src/goBaseCodelens.ts
index ece6a1e..f170c5a 100644
--- a/extension/src/goBaseCodelens.ts
+++ b/extension/src/goBaseCodelens.ts
@@ -21,8 +21,8 @@
}
public provideCodeLenses(
- document: vscode.TextDocument,
- token: vscode.CancellationToken
+ _document: vscode.TextDocument,
+ _token: vscode.CancellationToken
): vscode.ProviderResult<vscode.CodeLens[]> {
return [];
}
diff --git a/extension/src/goBrowsePackage.ts b/extension/src/goBrowsePackage.ts
index fe2520f..6856556 100644
--- a/extension/src/goBrowsePackage.ts
+++ b/extension/src/goBrowsePackage.ts
@@ -61,7 +61,7 @@
goRuntimePath,
['list', '-f', '{{.Dir}}:{{.GoFiles}}:{{.TestGoFiles}}:{{.XTestGoFiles}}', pkg],
options,
- (err, stdout, stderr) => {
+ (err, stdout) => {
if (!stdout || stdout.indexOf(':') === -1) {
if (showAllPkgsIfPkgNotFound) {
return showPackageList(workDir);
diff --git a/extension/src/goCover.ts b/extension/src/goCover.ts
index 1cdb444..6b90112 100644
--- a/extension/src/goCover.ts
+++ b/extension/src/goCover.ts
@@ -381,7 +381,7 @@
doc = fixDriveCasingInWindows(doc);
try {
doc = fs.realpathSync(doc);
- } catch (e) {
+ } catch (_) {
// Failed to resolve the path, but we can still try using the original.
}
}
@@ -392,7 +392,7 @@
let normalizedFilename = fixDriveCasingInWindows(filename);
try {
normalizedFilename = fs.realpathSync(normalizedFilename);
- } catch (e) {
+ } catch (_) {
// Failed to resolve the path, but we can still try using the original.
}
diff --git a/extension/src/goDebugConfiguration.ts b/extension/src/goDebugConfiguration.ts
index d798a88..5e536ea 100644
--- a/extension/src/goDebugConfiguration.ts
+++ b/extension/src/goDebugConfiguration.ts
@@ -396,13 +396,9 @@
return new Promise((resolve) => {
const child = spawn(getBinPath('dlv'), ['substitute-path-guess-helper']);
let stdoutData = '';
- let stderrData = '';
child.stdout.on('data', (data) => {
stdoutData += data;
});
- child.stderr.on('data', (data) => {
- stderrData += data;
- });
child.on('close', (code) => {
if (code !== 0) {
@@ -410,13 +406,13 @@
} else {
try {
resolve(JSON.parse(stdoutData));
- } catch (error) {
+ } catch (_) {
resolve(null);
}
}
});
- child.on('error', (error) => {
+ child.on('error', () => {
resolve(null);
});
});
diff --git a/extension/src/goEnvironmentStatus.ts b/extension/src/goEnvironmentStatus.ts
index 91eb321..a640285 100644
--- a/extension/src/goEnvironmentStatus.ts
+++ b/extension/src/goEnvironmentStatus.ts
@@ -490,7 +490,7 @@
if ((await stat(binpath)).isFile()) {
return new GoEnvironmentOption(binpath, dir.replace('go', 'Go '));
}
- } catch {
+ } catch (_) {
// ignore
}
})
@@ -527,7 +527,7 @@
try {
const response = await fetch('https://go.dev/dl/?mode=json');
webResults = (await response.json()) as GoVersionWebResult[];
- } catch (error) {
+ } catch (_) {
return [];
}
@@ -565,7 +565,7 @@
timestamp: now,
goVersions: results
});
- } catch (e) {
+ } catch (_) {
results = [];
}
}
diff --git a/extension/src/goGenerateTests.ts b/extension/src/goGenerateTests.ts
index 21875c1..977c573 100644
--- a/extension/src/goGenerateTests.ts
+++ b/extension/src/goGenerateTests.ts
@@ -286,7 +286,7 @@
args = args.concat(['-all', conf.dir]);
}
- cp.execFile(cmd, args, { env: toolExecutionEnvironment() }, (err, stdout, stderr) => {
+ cp.execFile(cmd, args, { env: toolExecutionEnvironment() }, (err, stdout) => {
outputChannel.info('Generating Tests: ' + cmd + ' ' + args.join(' '));
try {
diff --git a/extension/src/goImport.ts b/extension/src/goImport.ts
index 825a688..78101b6 100644
--- a/extension/src/goImport.ts
+++ b/extension/src/goImport.ts
@@ -10,8 +10,7 @@
import { ExecuteCommandRequest, ExecuteCommandParams } from 'vscode-languageserver-protocol';
import { toolExecutionEnvironment } from './goEnv';
import { promptForMissingTool } from './goInstallTools';
-import { getImportablePackages } from './goPackages';
-import { getBinPath, getImportPath, parseFilePrelude } from './util';
+import { getBinPath, getImportPath } from './util';
import { getEnvPath, getCurrentGoRoot } from './utils/pathUtils';
import { GoExtensionContext } from './context';
import { CommandFactory } from './commands';
@@ -142,7 +141,7 @@
}
const env = toolExecutionEnvironment();
- cp.execFile(goRuntimePath, ['list', '-f', '{{.Dir}}', importPath], { env }, (err, stdout, stderr) => {
+ cp.execFile(goRuntimePath, ['list', '-f', '{{.Dir}}', importPath], { env }, (err, stdout) => {
const dirs = (stdout || '').split('\n');
if (!dirs.length || !dirs[0].trim()) {
vscode.window.showErrorMessage(`Could not find package ${importPath}`);
diff --git a/extension/src/goInstallTools.ts b/extension/src/goInstallTools.ts
index 969d8b8..b4aa5ef 100644
--- a/extension/src/goInstallTools.ts
+++ b/extension/src/goInstallTools.ts
@@ -12,7 +12,7 @@
import path = require('path');
import semver = require('semver');
import { ConfigurationTarget } from 'vscode';
-import { extensionInfo, getGoConfig, getGoplsConfig } from './config';
+import { extensionInfo, getGoConfig } from './config';
import { toolExecutionEnvironment, toolInstallationEnvironment } from './goEnv';
import { addGoRuntimeBaseToPATH, clearGoRuntimeBaseFromPATH } from './goEnvironmentStatus';
import { GoExtensionContext } from './context';
@@ -132,7 +132,7 @@
// Compute the local toolchain version. (GOTOOLCHAIN=local go version)
const go = await getGoVersion(configuredGoForInstall, 'local');
if (go) return go;
- } catch (e) {
+ } catch (_) {
outputChannel.error(
`failed to run "go version" with "${configuredGoForInstall}". Provide a valid path to the Go binary`
);
@@ -661,7 +661,7 @@
missing = await tm.getMissingTools((tool: Tool) => {
return tool.isImportant;
}); // expect gopls and a linter.
- } catch (e) {
+ } catch (_) {
// ignore.
}
@@ -707,7 +707,7 @@
return Promise.all(
keys.map(
(tool) =>
- new Promise<Tool | null>((resolve, reject) => {
+ new Promise<Tool | null>((resolve) => {
const toolPath = getBinPath(tool.name);
resolve(path.isAbsolute(toolPath) ? null : tool);
})
@@ -836,7 +836,7 @@
const goVersion = lines[0] && lines[0].match(/\s+(go\d+.\d+\S*)/)?.[1];
const moduleVersion = lines[2].split(/\s+/)[3];
return { goVersion, moduleVersion };
- } catch (e) {
+ } catch (_) {
// either go version failed (e.g. the tool was compiled with a more recent version of go)
// or stdout is not in the expected format.
return { debugInfo };
diff --git a/extension/src/goPackages.ts b/extension/src/goPackages.ts
index 1a82e0d..dead903 100644
--- a/extension/src/goPackages.ts
+++ b/extension/src/goPackages.ts
@@ -107,7 +107,7 @@
}
function getAllPackagesNoCache(workDir: string): Promise<Map<string, PackageInfo>> {
- return new Promise<Map<string, PackageInfo>>((resolve, reject) => {
+ return new Promise<Map<string, PackageInfo>>((resolve) => {
// Use subscription style to guard costly/long running invocation
const callback = (pkgMap: Map<string, PackageInfo>) => {
resolve(pkgMap);
@@ -271,7 +271,7 @@
return Promise.resolve(new Map());
}
- return new Promise<Map<string, string>>((resolve, reject) => {
+ return new Promise<Map<string, string>>((resolve) => {
const childProcess = cp.spawn(
goRuntimePath,
['list', '-e', '-f', 'ImportPath: {{.ImportPath}} FolderPath: {{.Dir}}', ...targets],
@@ -282,7 +282,7 @@
chunks.push(stdout);
});
- childProcess.on('close', async (status) => {
+ childProcess.on('close', async () => {
const lines = chunks.join('').toString().split('\n');
const result = new Map<string, string>();
@@ -291,7 +291,7 @@
if (!matches || matches.length !== 3) {
return;
}
- const [_, pkgPath, folderPath] = matches;
+ const [, pkgPath, folderPath] = matches;
if (!pkgPath) {
return;
}
diff --git a/extension/src/goRunTestCodelens.ts b/extension/src/goRunTestCodelens.ts
index 4a885c4..97405fd 100644
--- a/extension/src/goRunTestCodelens.ts
+++ b/extension/src/goRunTestCodelens.ts
@@ -62,7 +62,7 @@
return ([] as CodeLens[]).concat(...codelenses);
}
- private async getCodeLensForPackage(document: TextDocument, token: CancellationToken): Promise<CodeLens[]> {
+ private async getCodeLensForPackage(document: TextDocument, _token: CancellationToken): Promise<CodeLens[]> {
const documentSymbolProvider = GoDocumentSymbolProvider(this.goCtx);
const symbols = await documentSymbolProvider.provideDocumentSymbols(document);
if (!symbols || symbols.length === 0) {
diff --git a/extension/src/goTest/run.ts b/extension/src/goTest/run.ts
index 68a2e5d..dd52ad9 100644
--- a/extension/src/goTest/run.ts
+++ b/extension/src/goTest/run.ts
@@ -70,7 +70,7 @@
clear() {}
- show(...args: unknown[]) {}
+ show(..._args: unknown[]) {}
hide() {}
dispose() {}
replace() {}
diff --git a/extension/src/language/form.ts b/extension/src/language/form.ts
index e78ad4a..c372231 100644
--- a/extension/src/language/form.ts
+++ b/extension/src/language/form.ts
@@ -889,7 +889,7 @@
let isMatch: boolean;
try {
isMatch = new RegExp(validator.pattern).test(text);
- } catch {
+ } catch (_) {
// If the regex pattern is invalid, skip over this validator.
continue;
}
@@ -1033,7 +1033,7 @@
if (defaultUriString) {
try {
defaultUri = vscode.Uri.parse(defaultUriString);
- } catch {
+ } catch (_) {
// Ignore invalid URIs
}
}
diff --git a/extension/src/language/goLanguageServer.ts b/extension/src/language/goLanguageServer.ts
index 07b0324..6784bca 100644
--- a/extension/src/language/goLanguageServer.ts
+++ b/extension/src/language/goLanguageServer.ts
@@ -334,7 +334,7 @@
const v = <serverVersionJSON>(res.serverInfo?.version ? JSON.parse(res.serverInfo.version) : {});
info.Version = v.Version || v.version;
info.GoVersion = v.GoVersion;
- } catch (e) {
+ } catch (_) {
// gopls is not providing any info, that's ok.
}
return info;
@@ -1315,7 +1315,7 @@
cfg.version = { version: v.Main.Version, goVersion: v.GoVersion };
return cfg.version;
}
- } catch (e) {
+ } catch (_) {
// do nothing
}
@@ -1324,7 +1324,7 @@
try {
const { stdout } = await execFile(cfg.path, ['version'], { env, cwd });
output = stdout;
- } catch (e) {
+ } catch (_) {
// The "gopls version" command is not supported, or something else went wrong.
// TODO: Should we propagate this error?
return;
@@ -1554,7 +1554,7 @@
if (modFileURI.fsPath === uriFsPath) {
return res[modFile];
}
- } catch (e) {
+ } catch (_) {
console.log(`gopls returned an unparseable file uri in govulncheck result: ${modFile}`);
}
}
diff --git a/extension/src/testUtils.ts b/extension/src/testUtils.ts
index 4b91770..0a024bb 100644
--- a/extension/src/testUtils.ts
+++ b/extension/src/testUtils.ts
@@ -166,7 +166,7 @@
export async function getTestFunctionsAndTestifyHint(
goCtx: GoExtensionContext,
doc: vscode.TextDocument,
- token?: vscode.CancellationToken
+ _token?: vscode.CancellationToken
): Promise<{ testFunctions?: vscode.DocumentSymbol[]; foundTestifyTestFunction?: boolean }> {
const documentSymbolProvider = GoDocumentSymbolProvider(goCtx, true);
const symbols = await documentSymbolProvider.provideDocumentSymbols(doc);
@@ -298,7 +298,7 @@
export async function getBenchmarkFunctions(
goCtx: GoExtensionContext,
doc: vscode.TextDocument,
- token?: vscode.CancellationToken
+ _token?: vscode.CancellationToken
): Promise<vscode.DocumentSymbol[] | undefined> {
const documentSymbolProvider = GoDocumentSymbolProvider(goCtx);
const symbols = await documentSymbolProvider.provideDocumentSymbols(doc);
@@ -425,7 +425,7 @@
let testResult = false;
try {
- testResult = await new Promise<boolean>(async (resolve, reject) => {
+ testResult = await new Promise<boolean>(async (resolve) => {
const testEnvVars = getTestEnvVars(testconfig.goConfig);
const tp = cp.spawn(goRuntimePath, args, { env: testEnvVars, cwd: testconfig.dir });
const outBuf = new LineBuffer();
@@ -464,7 +464,7 @@
statusBarItem.show();
- tp.on('close', (code, signal) => {
+ tp.on('close', (code) => {
outBuf.done();
errBuf.done();
@@ -696,7 +696,7 @@
* Iterates the list of currently running test processes and kills them all.
*/
export function cancelRunningTests(): Thenable<boolean> {
- return new Promise<boolean>((resolve, reject) => {
+ return new Promise<boolean>((resolve) => {
runningTestProcesses.forEach((tp) => {
killProcessTree(tp);
});
diff --git a/extension/src/util.ts b/extension/src/util.ts
index 582e9b0..5c4f9e4 100644
--- a/extension/src/util.ts
+++ b/extension/src/util.ts
@@ -360,7 +360,7 @@
if (fs.statSync(path.join(currentRoot, 'src')).isDirectory()) {
inferredGopath = currentRoot;
}
- } catch (e) {
+ } catch (_) {
// No op
}
}
@@ -370,7 +370,7 @@
if (fs.existsSync(path.join(inferredGopath, 'go.mod'))) {
inferredGopath = '';
}
- } catch (e) {
+ } catch (_) {
// No op
}
}
diff --git a/extension/src/utils/lsofProcessParser.ts b/extension/src/utils/lsofProcessParser.ts
index 5320b4f..70f88d5 100644
--- a/extension/src/utils/lsofProcessParser.ts
+++ b/extension/src/utils/lsofProcessParser.ts
@@ -24,7 +24,7 @@
return parseProcessesFromLsofArray(lines);
}
-function parseProcessesFromLsofArray(processArray: string[], includesEnv?: boolean): AttachItem[] {
+function parseProcessesFromLsofArray(processArray: string[]): AttachItem[] {
const processEntries: AttachItem[] = [];
let i = 0;
while (i < processArray.length) {
diff --git a/extension/src/utils/pathUtils.ts b/extension/src/utils/pathUtils.ts
index b3ce43b..01557de 100644
--- a/extension/src/utils/pathUtils.ts
+++ b/extension/src/utils/pathUtils.ts
@@ -158,7 +158,7 @@
if (exists) {
fs.accessSync(filePath, fs.constants.F_OK | fs.constants.X_OK);
}
- } catch (e) {
+ } catch (_) {
exists = false;
}
return exists;
@@ -167,7 +167,7 @@
export function fileExists(filePath: string): boolean {
try {
return fs.statSync(filePath).isFile();
- } catch (e) {
+ } catch (_) {
return false;
}
}
@@ -176,7 +176,7 @@
try {
const stat = promisify(fs.stat);
return (await stat(p)).isDirectory();
- } catch (e) {
+ } catch (_) {
return false;
}
}
diff --git a/extension/test/gopls/goTest.utils.ts b/extension/test/gopls/goTest.utils.ts
index f161de5..6c3b608 100644
--- a/extension/test/gopls/goTest.utils.ts
+++ b/extension/test/gopls/goTest.utils.ts
@@ -9,7 +9,7 @@
import { Workspace } from '../../src/goTest/utils';
import { MockTestWorkspace } from '../mocks/MockTest';
-export function getSymbols_Regex(doc: TextDocument, token: unknown): Thenable<DocumentSymbol[]> {
+export function getSymbols_Regex(doc: TextDocument, _token: unknown): Thenable<DocumentSymbol[]> {
const syms: DocumentSymbol[] = [];
const range = new Range(new Position(0, 0), new Position(0, 0));
doc.getText().replace(/^func (Test|Benchmark|Example|Fuzz)([A-Z]\w+)(\(.*\))/gm, (m, type, name, details) => {
diff --git a/extension/test/gopls/update.test.ts b/extension/test/gopls/update.test.ts
index dd3dd07..b6ad91e 100644
--- a/extension/test/gopls/update.test.ts
+++ b/extension/test/gopls/update.test.ts
@@ -4,8 +4,6 @@
*--------------------------------------------------------*/
import assert from 'assert';
-import * as vscode from 'vscode';
-import { getGoConfig } from '../../src/config';
import * as lsp from '../../src/language/goLanguageServer';
import * as goInstallTools from '../../src/goInstallTools';
import { getTool, Tool } from '../../src/goTools';
diff --git a/extension/test/integration/coverage.test.ts b/extension/test/integration/coverage.test.ts
index 6178522..41b9b9d 100644
--- a/extension/test/integration/coverage.test.ts
+++ b/extension/test/integration/coverage.test.ts
@@ -37,7 +37,7 @@
});
test('resolve import paths', async () => {
initForTest();
- const x = vscode.workspace.openTextDocument(coverFilePath);
+ await vscode.workspace.openTextDocument(coverFilePath);
await applyCodeCoverageToAllEditors(coverFilePath, fixtureSourcePath);
const files = Object.keys(coverageFilesForTest());
const aDotGo = files.includes(path.join(fixtureSourcePath, 'a', 'a.go'));
diff --git a/extension/test/integration/extension.test.ts b/extension/test/integration/extension.test.ts
index 15c6bdf..69bae7c 100644
--- a/extension/test/integration/extension.test.ts
+++ b/extension/test/integration/extension.test.ts
@@ -217,7 +217,7 @@
const file2contents = fs.readFileSync(file2path, 'utf8');
const fileEditPatches: any | FilePatch[] = await new Promise((resolve) => {
- cp.exec(`diff -u ${file1path} ${file2path}`, (err, stdout, stderr) => {
+ cp.exec(`diff -u ${file1path} ${file2path}`, (err, stdout) => {
const filePatches: FilePatch[] = getEditsFromUnifiedDiffStr(stdout);
if (!filePatches || filePatches.length !== 1) {
diff --git a/extension/test/integration/goDebug.test.ts b/extension/test/integration/goDebug.test.ts
index ee6b15b..030f4ae 100644
--- a/extension/test/integration/goDebug.test.ts
+++ b/extension/test/integration/goDebug.test.ts
@@ -233,7 +233,7 @@
* output event with any of the provided strings is observed.
*/
async function waitForOutputMessage(dc: DebugClient, ...patterns: string[]): Promise<DebugProtocol.Event> {
- return await new Promise<DebugProtocol.Event>((resolve, reject) => {
+ return await new Promise<DebugProtocol.Event>((resolve) => {
dc.on('output', (event) => {
for (const pattern of patterns) {
if (event.body.output.includes(pattern)) {
@@ -285,7 +285,7 @@
try {
await dc.send('illegal_request');
- } catch {
+ } catch (_) {
return;
}
throw new Error('does not report error on unknown request');
@@ -317,7 +317,7 @@
columnsStartAt1: true,
pathFormat: 'url'
});
- } catch (err) {
+ } catch (_) {
return; // want error
}
throw new Error("does not report error on invalid 'pathFormat' attribute");
@@ -346,7 +346,7 @@
value: { FOO: 'BAR' }
}
});
- const configStub = sandbox.stub(extConfig, 'getGoConfig').returns(goConfig);
+ sandbox.stub(extConfig, 'getGoConfig').returns(goConfig);
const config = {
name: 'Launch',
@@ -373,7 +373,7 @@
value: { FOO: 'BAR' }
}
});
- const configStub = sandbox.stub(extConfig, 'getGoConfig').returns(goConfig);
+ sandbox.stub(extConfig, 'getGoConfig').returns(goConfig);
const config = {
name: 'Launch',
@@ -496,7 +496,7 @@
await Promise.all([
dc.assertOutput('stderr', 'Error: unknown flag: --invalid\n', 5000),
dc.waitForEvent('terminated'),
- dc.initializeRequest().then((response) => {
+ dc.initializeRequest().then(() => {
// The current debug adapter does not respond to launch request but,
// instead, sends error messages and TerminatedEvent as delve is closed.
// The promise from dc.launchRequest resolves when the launch response
diff --git a/extension/test/integration/goDebugConfiguration.test.ts b/extension/test/integration/goDebugConfiguration.test.ts
index 44ecd9e..13be22c 100644
--- a/extension/test/integration/goDebugConfiguration.test.ts
+++ b/extension/test/integration/goDebugConfiguration.test.ts
@@ -36,7 +36,6 @@
let sandbox: sinon.SinonSandbox;
let tmpDir = '';
- const toolExecutionEnv: NodeJS.Dict<string> = {};
setup(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'godebugconfig_test'));
sandbox = sinon.createSandbox();
diff --git a/extension/test/integration/test.test.ts b/extension/test/integration/test.test.ts
index 83e1478..c584bd2 100644
--- a/extension/test/integration/test.test.ts
+++ b/extension/test/integration/test.test.ts
@@ -170,7 +170,7 @@
const result = await goTest(testConfig);
assert.equal(result, false); // we expect tests to fail.
} catch (e) {
- console.log('exception: ${e}');
+ console.log(`exception: ${e}`);
}
const testOutput = outputChannel.toString();
diff --git a/extension/test/mocks/MockCfg.ts b/extension/test/mocks/MockCfg.ts
index f0d9be1..d33843e 100644
--- a/extension/test/mocks/MockCfg.ts
+++ b/extension/test/mocks/MockCfg.ts
@@ -53,10 +53,10 @@
}
public update(
- section: string,
- value: any,
- configurationTarget?: boolean | vscode.ConfigurationTarget,
- overrideInLanguage?: boolean
+ _section: string,
+ _value: any,
+ _configurationTarget?: boolean | vscode.ConfigurationTarget,
+ _overrideInLanguage?: boolean
): Thenable<void> {
throw new Error('Method not implemented.');
}
diff --git a/extension/test/mocks/MockTest.ts b/extension/test/mocks/MockTest.ts
index 14553c9..89ae2e0 100644
--- a/extension/test/mocks/MockTest.ts
+++ b/extension/test/mocks/MockTest.ts
@@ -70,7 +70,7 @@
return this.m.get(id);
}
- replace(items: readonly TestItem[]): void {
+ replace(_items: readonly TestItem[]): void {
throw new Error('not impelemented');
}
}
@@ -141,15 +141,15 @@
this.onDidDispose = emitter.event;
}
- addCoverage(fileCoverage: FileCoverage): void {}
+ addCoverage(_fileCoverage: FileCoverage): void {}
onDidDispose: Event<void>;
- enqueued(test: TestItem): void {}
- started(test: TestItem): void {}
- skipped(test: TestItem): void {}
- failed(test: TestItem, message: TestMessage | readonly TestMessage[], duration?: number): void {}
- errored(test: TestItem, message: TestMessage | readonly TestMessage[], duration?: number): void {}
- passed(test: TestItem, duration?: number): void {}
- appendOutput(output: string): void {}
+ enqueued(_test: TestItem): void {}
+ started(_test: TestItem): void {}
+ skipped(_test: TestItem): void {}
+ failed(_test: TestItem, _message: TestMessage | readonly TestMessage[], _duration?: number): void {}
+ errored(_test: TestItem, _message: TestMessage | readonly TestMessage[], _duration?: number): void {}
+ passed(_test: TestItem, _duration?: number): void {}
+ appendOutput(_output: string): void {}
end(): void {}
}
@@ -161,7 +161,7 @@
resolveHandler?: (item: TestItem | undefined) => void | Thenable<void>;
refreshHandler: ((token: CancellationToken) => void | Thenable<void>) | undefined;
- createTestRun(request: TestRunRequest, name?: string, persist?: boolean): TestRun {
+ createTestRun(_request: TestRunRequest, _name?: string, _persist?: boolean): TestRun {
return new MockTestRun();
}
@@ -178,7 +178,7 @@
return new MockTestItem(id, label, uri, this);
}
- invalidateTestResults(items?: TestItem | readonly TestItem[]): void {}
+ invalidateTestResults(_items?: TestItem | readonly TestItem[]): void {}
dispose(): void {}
}
@@ -318,15 +318,15 @@
lineAt(line: number): TextLine;
lineAt(position: Position): TextLine;
- lineAt(position: any): TextLine {
+ lineAt(_position: any): TextLine {
throw new Error('Method not implemented.');
}
- offsetAt(position: Position): number {
+ offsetAt(_position: Position): number {
throw new Error('Method not implemented.');
}
- positionAt(offset: number): Position {
+ positionAt(_offset: number): Position {
throw new Error('Method not implemented.');
}
@@ -337,15 +337,15 @@
return this._contents;
}
- getWordRangeAtPosition(position: Position, regex?: RegExp): Range {
+ getWordRangeAtPosition(_position: Position, _regex?: RegExp): Range {
throw new Error('Method not implemented.');
}
- validateRange(range: Range): Range {
+ validateRange(_range: Range): Range {
throw new Error('Method not implemented.');
}
- validatePosition(position: Position): Position {
+ validatePosition(_position: Position): Position {
throw new Error('Method not implemented.');
}
}
diff --git a/extension/test/unit/mutex.test.ts b/extension/test/unit/mutex.test.ts
index b00258f..af525fd 100644
--- a/extension/test/unit/mutex.test.ts
+++ b/extension/test/unit/mutex.test.ts
@@ -47,7 +47,7 @@
const safeWorker = async (delay: number) => {
try {
await worker(delay);
- } catch (e) {
+ } catch (_) {
// swallow the exception
}
};