mirror of
https://github.com/luau-lang/luau.git
synced 2025-03-04 03:01:41 +00:00
![]() Adds the `CollapseClauseToAssert` lint, which triggers in the following code: ``` -- `if`-clause can be collapsed to an `assert` if X then error("SomeErrorMessage") end ``` * Any number of conditions for the `if` * No `else` block * `error` cannot be given a `level` argument * Error string must be constant (no string interpolation/concatenation) to avoid slowdowns * Body must _only_ be an `error` call Inspired due to the following code on luau-lang.org: https://luau-lang.org/2023/03/31/luau-recap-march-2023.html#:~:text=if%20not%20x%20then%20error(%27first%20argument%20is%20nil%27)%20end |
||
---|---|---|
.. | ||
include/Luau | ||
src |