tsc:allowUnreachableCode, eslint:no-unreachable, assert->assertDev

This commit is contained in:
Jamie Kyle 2022-09-15 12:17:15 -07:00 committed by GitHub
parent f627a05cf8
commit eb10aafd7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 213 additions and 176 deletions

View file

@ -19,7 +19,7 @@ import * as groups from '../../groups';
import * as log from '../../logging/log';
import { calling } from '../../services/calling';
import { getOwn } from '../../util/getOwn';
import { assert, strictAssert } from '../../util/assert';
import { assertDev, strictAssert } from '../../util/assert';
import * as universalExpireTimer from '../../util/universalExpireTimer';
import type {
ShowSendAnywayDialogActiontype,
@ -1533,7 +1533,7 @@ function createGroup(
composer?.step !== ComposerStep.SetGroupMetadata ||
composer.isCreating
) {
assert(false, 'Cannot create group in this stage; doing nothing');
assertDev(false, 'Cannot create group in this stage; doing nothing');
return;
}
@ -1915,7 +1915,7 @@ function toggleConversationInChooseMembers(
maxRecommendedGroupSize + 1
);
assert(
assertDev(
maxGroupSize > maxRecommendedGroupSize,
'Expected the hard max group size to be larger than the recommended maximum'
);
@ -2157,7 +2157,10 @@ function closeComposerModal(
): ConversationsStateType {
const { composer } = state;
if (composer?.step !== ComposerStep.ChooseGroupMembers) {
assert(false, "Can't close the modal in this composer step. Doing nothing");
assertDev(
false,
"Can't close the modal in this composer step. Doing nothing"
);
return state;
}
if (composer[modalToClose] !== OneTimeModalState.Showing) {
@ -2292,7 +2295,7 @@ export function reducer(
if (action.type === 'CLEAR_GROUP_CREATION_ERROR') {
const { composer } = state;
if (composer?.step !== ComposerStep.SetGroupMetadata) {
assert(
assertDev(
false,
"Can't clear group creation error in this composer state. Doing nothing"
);
@ -3263,7 +3266,7 @@ export function reducer(
case ComposerStep.SetGroupMetadata:
return state;
default:
assert(
assertDev(
false,
'Cannot transition to setting group metadata from this state'
);
@ -3285,7 +3288,10 @@ export function reducer(
},
};
default:
assert(false, 'Setting compose group avatar at this step is a no-op');
assertDev(
false,
'Setting compose group avatar at this step is a no-op'
);
return state;
}
}
@ -3304,7 +3310,7 @@ export function reducer(
},
};
default:
assert(false, 'Setting compose group name at this step is a no-op');
assertDev(false, 'Setting compose group name at this step is a no-op');
return state;
}
}
@ -3323,7 +3329,7 @@ export function reducer(
},
};
default:
assert(false, 'Setting compose group name at this step is a no-op');
assertDev(false, 'Setting compose group name at this step is a no-op');
return state;
}
}
@ -3331,7 +3337,7 @@ export function reducer(
if (action.type === 'SET_COMPOSE_SEARCH_TERM') {
const { composer } = state;
if (!composer) {
assert(
assertDev(
false,
'Setting compose search term with the composer closed is a no-op'
);
@ -3341,7 +3347,7 @@ export function reducer(
composer.step !== ComposerStep.StartDirectConversation &&
composer.step !== ComposerStep.ChooseGroupMembers
) {
assert(
assertDev(
false,
`Setting compose search term at step ${composer.step} is a no-op`
);
@ -3360,7 +3366,7 @@ export function reducer(
if (action.type === 'SET_IS_FETCHING_UUID') {
const { composer } = state;
if (!composer) {
assert(
assertDev(
false,
'Setting compose uuid fetch state with the composer closed is a no-op'
);
@ -3370,7 +3376,10 @@ export function reducer(
composer.step !== ComposerStep.StartDirectConversation &&
composer.step !== ComposerStep.ChooseGroupMembers
) {
assert(false, 'Setting compose uuid fetch state at this step is a no-op');
assertDev(
false,
'Setting compose uuid fetch state at this step is a no-op'
);
return state;
}
const { identifier, isFetching } = action.payload;
@ -3404,7 +3413,7 @@ export function reducer(
},
};
default:
assert(false, 'Setting editing avatar at this step is a no-op');
assertDev(false, 'Setting editing avatar at this step is a no-op');
return state;
}
}
@ -3430,7 +3439,7 @@ export function reducer(
},
};
default:
assert(false, 'Adding an avatar at this step is a no-op');
assertDev(false, 'Adding an avatar at this step is a no-op');
return state;
}
}
@ -3450,7 +3459,7 @@ export function reducer(
},
};
default:
assert(false, 'Removing an avatar at this step is a no-op');
assertDev(false, 'Removing an avatar at this step is a no-op');
return state;
}
}
@ -3478,7 +3487,7 @@ export function reducer(
},
};
default:
assert(false, 'Replacing an avatar at this step is a no-op');
assertDev(false, 'Replacing an avatar at this step is a no-op');
return state;
}
}
@ -3486,7 +3495,7 @@ export function reducer(
if (action.type === 'TOGGLE_CONVERSATION_IN_CHOOSE_MEMBERS') {
const { composer } = state;
if (composer?.step !== ComposerStep.ChooseGroupMembers) {
assert(
assertDev(
false,
'Toggling conversation members is a no-op in this composer step'
);