mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
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
This commit is contained in:
parent
909cfacf8a
commit
62a99b70b8
@ -35,8 +35,14 @@ export function empty(): Source {
|
||||
export function chain(rules: Iterable<Rule> | AsyncIterable<Rule>): Rule {
|
||||
return async (initialTree, context) => {
|
||||
let intermediateTree: Observable<Tree> | 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user