bxb100 / bxb100.github.io

This is my blog
https://blog.tomcat.run
MIT License
1 stars 0 forks source link

学习 ast-grep #52

Open bxb100 opened 3 months ago

bxb100 commented 3 months ago

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