Disallow floating promises. (#14605)

This commit is contained in:
Christian Gunderman
2025-12-05 16:12:49 -08:00
committed by GitHub
parent 3cf44acc08
commit 025e450ac2
57 changed files with 128 additions and 4 deletions
@@ -72,6 +72,7 @@ describe('directoryCommand', () => {
describe('show', () => {
it('should display the list of directories', () => {
if (!showCommand?.action) throw new Error('No action');
// eslint-disable-next-line @typescript-eslint/no-floating-promises
showCommand.action(mockContext, '');
expect(mockWorkspaceContext.getDirectories).toHaveBeenCalled();
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
@@ -101,6 +102,7 @@ describe('directoryCommand', () => {
it('should show an error if no path is provided', () => {
if (!addCommand?.action) throw new Error('No action');
// eslint-disable-next-line @typescript-eslint/no-floating-promises
addCommand.action(mockContext, '');
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
@@ -92,6 +92,7 @@ function updateAction(context: CommandContext, args: string): Promise<void> {
extensions,
};
// eslint-disable-next-line @typescript-eslint/no-floating-promises
updateComplete.then((updateInfos) => {
if (updateInfos.length === 0) {
context.ui.addItem(
@@ -30,6 +30,7 @@ describe('statsCommand', () => {
it('should display general session stats when run with no subcommand', () => {
if (!statsCommand.action) throw new Error('Command has no action');
// eslint-disable-next-line @typescript-eslint/no-floating-promises
statsCommand.action(mockContext, '');
const expectedDuration = formatDuration(
@@ -50,6 +51,7 @@ describe('statsCommand', () => {
);
if (!modelSubCommand?.action) throw new Error('Subcommand has no action');
// eslint-disable-next-line @typescript-eslint/no-floating-promises
modelSubCommand.action(mockContext, '');
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
@@ -66,6 +68,7 @@ describe('statsCommand', () => {
);
if (!toolsSubCommand?.action) throw new Error('Subcommand has no action');
// eslint-disable-next-line @typescript-eslint/no-floating-promises
toolsSubCommand.action(mockContext, '');
expect(mockContext.ui.addItem).toHaveBeenCalledWith(