From 05676dc6dddc2ba572c22f999a7a8a35547e3a09 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Thu, 29 Jul 2021 21:39:24 +0300 Subject: [PATCH] Added a paragraph for 'DuplicateConditions' lint --- docs/_posts/2021-07-30-luau-recap-july-2021.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/_posts/2021-07-30-luau-recap-july-2021.md b/docs/_posts/2021-07-30-luau-recap-july-2021.md index c6e2766a..b0a0cbb7 100644 --- a/docs/_posts/2021-07-30-luau-recap-july-2021.md +++ b/docs/_posts/2021-07-30-luau-recap-july-2021.md @@ -87,6 +87,21 @@ table.remove(t, #t - 1) table.insert(t, string.find("hello", "h")) ``` +Another new check is 'DuplicateConditions'. The name speaks for itself, `if` statement chains with duplicate conditions and expressions containing `and`/`or` operations with redundant parts will now be detected: +```lua +if x then + -- ... +elseif not x then + -- ... +elseif x̳ then -- Condition has already been checked on line 1 + -- ... +end + +local success = a and a̳ -- Condition has already been checked on column 17 + +local good = (a or b) or a̳ -- Condition has already been checked on column 15 +``` + We've also fixed an incorrect lint warning when `typeof` is used to check for `EnumItem`. ## Editor features