Skip to content

Commit d273ca5

Browse files
chore(deps): update dependency eslint to v10 (#402)
Co-authored-by: cobalt <61329810+cobaltt7@users.noreply.github.com> Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
1 parent e3152d4 commit d273ca5

5 files changed

Lines changed: 312 additions & 783 deletions

File tree

modules/word-chain/handle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ export default async function handleWordChain(message: Message): Promise<void> {
106106
return;
107107
}
108108

109-
const letter = latest && latest.word.at(-1)?.toLowerCase();
109+
const letter = latest?.word.at(-1)?.toLowerCase();
110110
const current = normalize(word);
111-
if (letter && letter !== current[0]) {
111+
if (latest && letter && letter !== current[0]) {
112112
await reject(
113113
`${
114114
constants.emojis.statuses.no

modules/word-chain/misc.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ const languageIndex = await fetch(
5656
});
5757
return JSON.parse(response.expandtemplates.wikitext) as Record<string, string>;
5858
} catch (error) {
59-
// TODO: use SuppressedError
60-
throw new AggregateError([error], "Error parsing `expandtemplates` API result", {
61-
cause: text,
62-
});
59+
if (Error.isError(error) && !error.cause) error.cause = text;
60+
throw error;
6361
}
6462
});
6563
const languageList = Object.entries(languageIndex).map(([code, name]): [string, Language] => [
@@ -86,10 +84,8 @@ export async function isWord(word: string, language: Language): Promise<boolean>
8684
try {
8785
return JSON.parse(text) as WiktionaryQueryPrefixsearchResult | WiktionaryError;
8886
} catch (error) {
89-
// TODO: use SuppressedError
90-
throw new AggregateError([error], "Error parsing `parse` API result", {
91-
cause: text,
92-
});
87+
if (Error.isError(error) && !error.cause) error.cause = text;
88+
throw error;
9389
}
9490
});
9591
if ("error" in search) return false;
@@ -111,10 +107,8 @@ export async function isWord(word: string, language: Language): Promise<boolean>
111107
try {
112108
return JSON.parse(text) as WiktionaryParseResult | WiktionaryError;
113109
} catch (error) {
114-
// TODO: use SuppressedError
115-
throw new AggregateError([error], "Error parsing `parse` API result", {
116-
cause: text,
117-
});
110+
if (Error.isError(error) && !error.cause) error.cause = text;
111+
throw error;
118112
}
119113
});
120114
if ("error" in metadata) continue;

0 commit comments

Comments
 (0)