From f294ca31f152230492fd8e911f3a89193e82dc12 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:37:41 -0400 Subject: [PATCH 1/2] refactor(@angular-devkit/build-angular): avoid for await...of with promise arrays The upcoming version of typescript Eslint rules will fail the `await-thenable` rule for cases of for await...of that use promise arrays. This change removes the usage to avoid lint failures during the version update. Ref: https://typescript-eslint.io/rules/await-thenable/#async-iteration-for-awaitof-loops --- packages/angular_devkit/build_angular/src/utils/tailwind.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/angular_devkit/build_angular/src/utils/tailwind.ts b/packages/angular_devkit/build_angular/src/utils/tailwind.ts index c49e20bbc8d6..dd1c3e4f6f81 100644 --- a/packages/angular_devkit/build_angular/src/utils/tailwind.ts +++ b/packages/angular_devkit/build_angular/src/utils/tailwind.ts @@ -28,7 +28,7 @@ export async function findTailwindConfigurationFile( ); // A configuration file can exist in the project or workspace root - for await (const { root, files } of dirEntries) { + for (const { root, files } of await Promise.all(dirEntries)) { for (const potentialConfig of tailwindConfigFiles) { if (files.has(potentialConfig)) { return join(root, potentialConfig); From c7d78b9c74280388dcfed194eed02f61cced6e25 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:46:28 -0400 Subject: [PATCH 2/2] refactor(@angular-devkit/schematics): avoid for await...of with promise arrays The upcoming version of typescript Eslint rules will fail the `await-thenable` rule for cases of for await...of that use promise arrays. This change removes the usage to avoid lint failures during the version update. Ref: https://typescript-eslint.io/rules/await-thenable/#async-iteration-for-awaitof-loops --- packages/angular_devkit/schematics/src/rules/base.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/angular_devkit/schematics/src/rules/base.ts b/packages/angular_devkit/schematics/src/rules/base.ts index 5b14e927db65..ab91954b83da 100644 --- a/packages/angular_devkit/schematics/src/rules/base.ts +++ b/packages/angular_devkit/schematics/src/rules/base.ts @@ -35,8 +35,14 @@ export function empty(): Source { export function chain(rules: Iterable | AsyncIterable): Rule { return async (initialTree, context) => { let intermediateTree: Observable | undefined; - for await (const rule of rules) { - intermediateTree = callRule(rule, intermediateTree ?? initialTree, context); + if (Symbol.asyncIterator in rules) { + for await (const rule of rules) { + intermediateTree = callRule(rule, intermediateTree ?? initialTree, context); + } + } else { + for (const rule of rules) { + intermediateTree = callRule(rule, intermediateTree ?? initialTree, context); + } } return () => intermediateTree;