mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-15 07:45:50 +02:00
refactor: use js-yaml to parse both JSON and YAML (#5806)
This commit is contained in:
parent
9f13f8f7af
commit
1363a25819
6 changed files with 21 additions and 35 deletions
|
@ -44,9 +44,7 @@ export async function readDefaultCodeTranslationMessages({
|
|||
for (const fileName of localesToTry) {
|
||||
const filePath = path.resolve(dirPath, `${fileName}.json`);
|
||||
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
if (await fs.pathExists(filePath)) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const fileContent = await fs.readFile(filePath, 'utf8');
|
||||
return JSON.parse(fileContent);
|
||||
}
|
||||
|
|
|
@ -313,7 +313,6 @@ export async function mapAsyncSequencial<T extends unknown, R extends unknown>(
|
|||
const results: R[] = [];
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const t of array) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const result = await action(t);
|
||||
results.push(result);
|
||||
}
|
||||
|
@ -326,7 +325,6 @@ export async function findAsyncSequential<T>(
|
|||
): Promise<T | undefined> {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const t of array) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
if (await predicate(t)) {
|
||||
return t;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue