TIL: Biome์ ์์ฒด์ ์ผ๋ก ๋ง๋ AST ์ฟผ๋ฆฌ ์ธ์ด์ธ GritQL์ ํตํด Plugin ์์คํ ์ ์ ๊ณตํ๋ค. [๋ฌธ์]
language js
// 4๊ฐ ์ด์์ ์๋ก ๋ค๋ฅธ useState๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ
or {
`function $name($args) { $body }`,
`$name = ($args) => { $body }`,
`$name = forwardRef(($args) => { $body })`,
`$name = React.forwardRef(($args) => { $body })`,
`$name = forwardRef(function($args) { $body })`,
`$name = React.forwardRef(function($args) { $body })`,
`$name = memo(($args) => { $body })`,
`$name = React.memo(($args) => { $body })`,
`$name = memo(function $name($args) { $body })`,
`$name = React.memo(function $name($args) { $body })`
} where {
$body <: contains `$t1 = useState($a1)` as $b1 where {
$body <: contains `$t2 = useState($a2)` as $b2 where {
or { not $a2 <: $a1, not $t2 <: $t1 },
$body <: contains `$t3 = useState($a3)` as $b3 where {
or { not $a3 <: $a1, not $t3 <: $t1 },
or { not $a3 <: $a2, not $t3 <: $t2 },
$body <: contains `$t4 = useState($a4)` as $b4 where {
or { not $a4 <: $a1, not $t4 <: $t1 },
or { not $a4 <: $a2, not $t4 <: $t2 },
or { not $a4 <: $a3, not $t4 <: $t3 },
register_diagnostic(
span = $name,
message = "์ปดํฌ๋ํธ ์์์ ๋๋ฌด ๋ง์ useState๋ฅผ ์ฐ๊ณ ์์ต๋๋ค."
)
}
}
}
}
}
































































