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