Skip to content
Go back

学习 ast-grep

Updated:
Edit page

demo: 替换 Promise.all inside await expression

Promise.all([
  await Promise.resolve(123),
  Promise.resolve(124),
  await Promise.resolve(125),
]);
Promise.all();

var a = {
  normalKey: prototype,
};
id: no-await-in-promise-all
language: TypeScript
rule:
  kind: await_expression
  pattern: await $B
  inside:
    pattern: Promise.all($$$)
    stopBy: end
    field: arguments
fix: $B
image

Footnotes

  1. https://ast-grep.github.io/advanced/core-concepts.html#ast-vs-cst


Edit page
Share this post on:

Previous Post
ForkJoinPool 来运行斐波那契递归
Next Post
流水账:如何在 recent file 中排除 google drive