Skip to content

Commit 1ee5851

Browse files
committed
src/goModules,src/goTestExplorer: lint
1 parent ef064dc commit 1ee5851

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/goModules.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ async function runGoModEnv(folderPath: string): Promise<string> {
3636
return resolve('');
3737
}
3838
const [goMod] = stdout.split('\n');
39-
if (goMod == '/dev/null' || goMod == 'NUL')
40-
resolve('');
41-
else
42-
resolve(goMod);
39+
if (goMod === '/dev/null' || goMod === 'NUL') resolve('');
40+
else resolve(goMod);
4341
});
4442
});
4543
}

src/goTestExplorer.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function setupTestExplorer(context: ExtensionContext) {
3434
ctrl.root.label = 'Go';
3535
ctrl.root.canResolveChildren = true;
3636
ctrl.resolveChildrenHandler = (...args) => resolveChildren(ctrl, ...args);
37-
ctrl.runHandler = (request, token) => {
37+
ctrl.runHandler = (request) => {
3838
// TODO handle cancelation
3939
runTest(ctrl, request);
4040
};
@@ -402,8 +402,8 @@ async function walkWorkspaces(uri: Uri) {
402402
return found;
403403
}
404404

405-
async function walkPackages(uri: Uri, cb: (uri: Uri) => Promise<any>) {
406-
await walk(uri, async (dir, file, type) => {
405+
async function walkPackages(uri: Uri, cb: (uri: Uri) => Promise<unknown>) {
406+
await walk(uri, async (dir, file) => {
407407
if (file.endsWith('_test.go')) {
408408
await cb(dir);
409409
return WalkStop.Files;
@@ -538,7 +538,8 @@ class TestRunOutput<T> implements OutputChannel {
538538
}
539539

540540
clear() {}
541-
show(...args: any[]) {}
541+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
542+
show(...args: unknown[]) {}
542543
hide() {}
543544
dispose() {}
544545
}
@@ -548,7 +549,7 @@ function resolveTestName(ctrl: TestController, tests: Record<string, TestItem>,
548549
return;
549550
}
550551

551-
const parts = name.split(/[#\/]+/);
552+
const parts = name.split(/[#/]+/);
552553
let test = tests[parts[0]];
553554
if (!test) {
554555
return;
@@ -594,7 +595,7 @@ function consumeGoBenchmarkEvent<T>(
594595

595596
// Started: "BenchmarkFooBar"
596597
// Completed: "BenchmarkFooBar-4 123456 123.4 ns/op 123 B/op 12 allocs/op"
597-
const m = e.Output.match(/^(?<name>Benchmark[\/\w]+)(?:-(?<procs>\d+)\s+(?<result>.*))?(?:$|\n)/);
598+
const m = e.Output.match(/^(?<name>Benchmark[/\w]+)(?:-(?<procs>\d+)\s+(?<result>.*))?(?:$|\n)/);
598599
if (!m) {
599600
return;
600601
}
@@ -696,7 +697,7 @@ function processRecordedOutput<T>(run: TestRun<T>, test: TestItem, output: strin
696697
if (!entry) continue;
697698

698699
current.all += entry.groups.message;
699-
if (entry.groups.name == 'Error') {
700+
if (entry.groups.name === 'Error') {
700701
current.error = entry.groups.message;
701702
} else if (!entry.groups.name && current.error) current.error += entry.groups.message;
702703
}

0 commit comments

Comments
 (0)