chore: upgrade TypeScript & other ESLint related deps (#5963)

* chore: upgrade ESLint related deps

* Upgrade TS

* Fix lock

* Bump Babel

* Update config
This commit is contained in:
Joshua Chen 2021-11-18 21:15:37 +08:00 committed by GitHub
parent 2f7d6fea1e
commit 0374426ce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
104 changed files with 2662 additions and 2487 deletions

View file

@ -351,7 +351,9 @@ describe('mergeTranslations', () => {
describe('mapAsyncSequencial', () => {
function sleep(timeout: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, timeout));
return new Promise((resolve) => {
setTimeout(resolve, timeout);
});
}
test('map sequentially', async () => {
@ -390,7 +392,9 @@ describe('mapAsyncSequencial', () => {
describe('findAsyncSequencial', () => {
function sleep(timeout: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, timeout));
return new Promise((resolve) => {
setTimeout(resolve, timeout);
});
}
test('find sequentially', async () => {

View file

@ -10,7 +10,6 @@ import fs from 'fs-extra';
// Return an ordered list of locales we should try
export function codeTranslationLocalesToTry(locale: string): string[] {
// @ts-expect-error: TODO until available in TS, see https://github.com/microsoft/TypeScript/issues/37326
const intlLocale = Intl.Locale ? new Intl.Locale(locale) : undefined;
if (!intlLocale) {
return [locale];
@ -24,7 +23,7 @@ export function codeTranslationLocalesToTry(locale: string): string[] {
}
// if locale is like "pt-BR", we want to fallback to "pt"
else {
return [locale, intlLocale.language];
return [locale, intlLocale.language!];
}
}

View file

@ -259,7 +259,7 @@ export function removePrefix(str: string, prefix: string): string {
return str.startsWith(prefix) ? str.slice(prefix.length) : str;
}
export function getElementsAround<T extends unknown>(
export function getElementsAround<T>(
array: T[],
aroundIndex: number,
): {
@ -306,7 +306,7 @@ export function getPluginI18nPath({
);
}
export async function mapAsyncSequencial<T extends unknown, R extends unknown>(
export async function mapAsyncSequencial<T, R>(
array: T[],
action: (t: T) => Promise<R>,
): Promise<R[]> {
@ -389,9 +389,7 @@ export function reportMessage(
export function mergeTranslations(
contents: TranslationFileContent[],
): TranslationFileContent {
return contents.reduce((acc, content) => {
return {...acc, ...content};
}, {});
return contents.reduce((acc, content) => ({...acc, ...content}), {});
}
export function getSwizzledComponent(

View file

@ -16,11 +16,10 @@ const SPACE_FOR_APPENDING = 10;
const isMacOs = process.platform === `darwin`;
const isWindows = process.platform === `win32`;
export const isNameTooLong = (str: string): boolean => {
return isMacOs || isWindows
export const isNameTooLong = (str: string): boolean =>
isMacOs || isWindows
? str.length + SPACE_FOR_APPENDING > MAX_PATH_SEGMENT_CHARS // MacOS (APFS) and Windows (NTFS) filename length limit (255 chars)
: Buffer.from(str).length + SPACE_FOR_APPENDING > MAX_PATH_SEGMENT_BYTES; // Other (255 bytes)
};
export const shortName = (str: string): string => {
if (isMacOs || isWindows) {