mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 22:35:43 +08:00
Update lint.md (#54)
Add documentation for the upcoming DuplicateCondition lint
This commit is contained in:
parent
7c7eb800f5
commit
1f548d4753
@ -284,3 +284,10 @@ table.insert(t, 0, 42) -- table.insert uses index 0 but arrays are 1-based; did
|
|||||||
|
|
||||||
table.insert(t, #t+1, 42) -- table.insert will append the value to the table; consider removing the second argument for efficiency
|
table.insert(t, #t+1, 42) -- table.insert will append the value to the table; consider removing the second argument for efficiency
|
||||||
```
|
```
|
||||||
|
## DuplicateCondition (24)
|
||||||
|
|
||||||
|
When checking multiple conditions via `and/or` or `if/elseif`, a copy & paste error may result in checking the same condition redundantly. This almost always indicates a bug, so a warning is emitted when use of a duplicate condition is detected.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
assert(self._adorns[normID1] and self._adorns[normID1]) -- Condition has already been checked on column 8
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user