[skip ci] Re-add removed lint rules
This commit is contained in:
@@ -132,6 +132,9 @@
|
||||
"prefer-template": "error",
|
||||
"prefer-exponentiation-operator": "error",
|
||||
"prefer-object-spread": "error",
|
||||
"arrow-body-style": ["error", "as-needed"],
|
||||
"prefer-destructuring": "error",
|
||||
"no-nested-ternary": "error",
|
||||
"prefer-promise-reject-errors": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ export const useBackButton = () => {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const previousPage = historyToCheck.slice(-2)[0];
|
||||
const [previousPage] = historyToCheck.slice(-2);
|
||||
|
||||
const isPreviousPageCurrentPage = previousPage === location.pathname;
|
||||
const ignorePreviousPage = PAGES_TO_IGNORE.some((page) => !!previousPage.match(page));
|
||||
|
||||
@@ -162,7 +162,7 @@ export function Sources({ tabsMenuHeight }: { tabsMenuHeight: number }) {
|
||||
);
|
||||
}}
|
||||
itemContent={(index, groupIndex) => {
|
||||
const language = sourcesByLanguage[groupIndex][0];
|
||||
const [language] = sourcesByLanguage[groupIndex];
|
||||
const source = visibleSources[index];
|
||||
|
||||
return (
|
||||
|
||||
@@ -86,7 +86,7 @@ const handleDownload = async (
|
||||
return;
|
||||
}
|
||||
|
||||
const mangaId = mangaIds[0];
|
||||
const [mangaId] = mangaIds;
|
||||
const manga = Mangas.getFromCache(
|
||||
mangaId,
|
||||
gql`
|
||||
|
||||
@@ -86,8 +86,7 @@ export const useManageMangaLibraryState = (
|
||||
|
||||
let showAddToLibraryCategorySelectDialog: boolean;
|
||||
try {
|
||||
showAddToLibraryCategorySelectDialog = (await getMetadataServerSettings())
|
||||
.showAddToLibraryCategorySelectDialog;
|
||||
({ showAddToLibraryCategorySelectDialog } = await getMetadataServerSettings());
|
||||
} catch (e) {
|
||||
makeToast(t`Unable to load data`, 'error', getErrorMessage(e));
|
||||
return;
|
||||
|
||||
@@ -175,7 +175,7 @@ const getOutdatedMetadataKeys = (metadata: Metadata | undefined, migrationId: nu
|
||||
);
|
||||
|
||||
return Object.keys(metadata).filter((key) => {
|
||||
const appKeyPrefixOfKey = key.split('_')[0];
|
||||
const [appKeyPrefixOfKey] = key.split('_');
|
||||
|
||||
const isMetadataKeyOfApp = [...oldAppKeyPrefixes, APP_METADATA_KEY_PREFIX].includes(appKeyPrefixOfKey);
|
||||
if (!isMetadataKeyOfApp) {
|
||||
@@ -367,7 +367,7 @@ export const applyMetadataMigrations = (
|
||||
|
||||
METADATA_MIGRATIONS.forEach((migration, index) => {
|
||||
const migrationId = index + 1;
|
||||
const metadataToMigrate = migrationToMetadata[migrationId - 1][1];
|
||||
const [, metadataToMigrate] = migrationToMetadata[migrationId - 1];
|
||||
|
||||
const isMigrationRequired = appliedMigrationId < migrationId;
|
||||
if (!isMigrationRequired) {
|
||||
|
||||
@@ -79,9 +79,9 @@ export class Queue {
|
||||
}
|
||||
|
||||
private getNextItemToProcess<T>(): { key: Key; fn: QueueItemFunction<T>; promise: ControlledPromise<T> } {
|
||||
const [key] = [...this.pendingKeyToPriorityMap.entries()].toSorted(
|
||||
const [[key]] = [...this.pendingKeyToPriorityMap.entries()].toSorted(
|
||||
([, priorityA], [, priorityB]) => priorityB - priorityA,
|
||||
)[0];
|
||||
);
|
||||
const fn = this.pendingKeyToFnMap.get(key) as () => PromiseLike<T> | T;
|
||||
const promise = this.pendingKeyToPromiseMap.get(key) as ControlledPromise<T>;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export class ZustandUtil {
|
||||
const fn = args[0] as (state: unknown) => unknown;
|
||||
selector = sliceKey !== undefined ? (state: State) => fn(state[sliceKey]) : fn;
|
||||
} else if (args.length === 1) {
|
||||
const key = args[0];
|
||||
const [key] = args;
|
||||
selector =
|
||||
sliceKey !== undefined
|
||||
? (state: State) => (state[sliceKey] as Record<PropertyKey, unknown>)[key as PropertyKey]
|
||||
@@ -66,7 +66,7 @@ export class ZustandUtil {
|
||||
|
||||
static createActionName(...names: string[]) {
|
||||
const storeAndSlices = names.slice(0, -1);
|
||||
const action = names.slice(-1)[0];
|
||||
const [action] = names.slice(-1);
|
||||
|
||||
return `${storeAndSlices.join(':')}/${action}`;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ const extractTranslations = (poContent: string): Map<string, string> =>
|
||||
return translations;
|
||||
}
|
||||
|
||||
const msgId = msgIdMatch[1];
|
||||
const [, msgId] = msgIdMatch;
|
||||
if (!TARGET_MSG_IDS.has(msgId as MangaTypeMsgId)) {
|
||||
return translations;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ const doesLanguageOfChangeMeetTranslatePercentThreshold = (
|
||||
stats: WeblateLanguageStatistic[],
|
||||
): boolean => {
|
||||
// format: 'https://hosted.weblate.org/api/translations/suwayomi/suwayomi-webui/ar/'
|
||||
const code = change.translation.split('/').slice(-2)[0];
|
||||
const [code] = change.translation.split('/').slice(-2);
|
||||
const langaugeStats = getWeblateLanguageStatsFor(code, stats);
|
||||
|
||||
return meetsTranslatedPercentThreshold(langaugeStats.translated_percent);
|
||||
@@ -209,10 +209,10 @@ const getKnownContributorsByLanguage = async (): Promise<Record<string, string[]
|
||||
const contributorByLanguage: Record<string, string[]> = {};
|
||||
changelogLanguageLines.forEach((languageLine) => {
|
||||
const languageChangeRegex = /^- (.*) \(by (.*)\)$/g;
|
||||
const languageChangeRegexMatch = [...languageLine.matchAll(languageChangeRegex)][0];
|
||||
const [languageChangeRegexMatch] = [...languageLine.matchAll(languageChangeRegex)];
|
||||
|
||||
const language = languageChangeRegexMatch[1];
|
||||
const contributors = languageChangeRegexMatch[2].split(', ');
|
||||
const [, language, contributorsRaw] = languageChangeRegexMatch;
|
||||
const contributors = contributorsRaw.split(', ');
|
||||
|
||||
const knownContributors = contributorByLanguage[language] ?? [];
|
||||
contributorByLanguage[language] = [...new Set([...knownContributors, ...contributors])];
|
||||
|
||||
Reference in New Issue
Block a user