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

@ -8,7 +8,7 @@ import { escapeRegExp } from 'lodash';
import { MessageBodyHighlight } from './MessageBodyHighlight';
import { ContactName } from '../conversation/ContactName';
import { assert } from '../../util/assert';
import { assertDev } from '../../util/assert';
import type {
BodyRangesType,
LocalizerType,
@ -99,7 +99,7 @@ function getFilteredBodyRanges(
const rx = new RegExp(escapeRegExp(stripped));
const match = rx.exec(body);
assert(Boolean(match), `No match found for "${snippet}" inside "${body}"`);
assertDev(Boolean(match), `No match found for "${snippet}" inside "${body}"`);
const delta = match ? match.index + snippet.length : 0;
@ -125,7 +125,7 @@ function getFilteredBodyRanges(
start: bodyRangeMatch.index,
});
} else {
assert(
assertDev(
false,
`Body range does not exist? Count: ${i}, Length: ${filteredBodyRanges.length}`
);