-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdeeb97
commit 0f5e461
Showing
4 changed files
with
168 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
selene-lib/tests/lints/roblox_roact_non_exhaustive_deps/complex_deps.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
local React | ||
|
||
local function Component1() | ||
local a = {} | ||
React.useEffect(function() | ||
print(a) | ||
print(a.b) | ||
print(a[b]) | ||
end, { a }) | ||
end | ||
|
||
local function Component2() | ||
local a = {} | ||
React.useEffect(function() | ||
print(a) -- Bad | ||
print(a.b) | ||
print(a.b.c) | ||
print(a.b[c]) | ||
end, { a.b }) | ||
end | ||
|
||
local function Component3() | ||
local a = {} | ||
React.useEffect(function() | ||
print(a) -- Bad | ||
print(a.b) -- Bad, but already reported with `a` | ||
print(a.b.c) | ||
print(a.b.c.d) | ||
print(a.b.c[d]) | ||
end, { a.b.c }) | ||
end | ||
|
||
local function Component3() | ||
local a = {} | ||
React.useEffect(function() | ||
print(a.b) -- Bad | ||
print(a.b.c) -- Bad, but already reported with `a.b` | ||
print(a.b.c.d) | ||
end, { a.b.c.d }) | ||
end |
2 changes: 2 additions & 0 deletions
2
selene-lib/tests/lints/roblox_roact_non_exhaustive_deps/complex_deps.std.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
name: roblox |
24 changes: 24 additions & 0 deletions
24
selene-lib/tests/lints/roblox_roact_non_exhaustive_deps/complex_deps.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
error[roblox_roact_non_exhaustive_deps]: react hook useEffect has missing dependency: 'a' | ||
┌─ complex_deps.lua:19:10 | ||
│ | ||
19 │ end, { a.b }) | ||
│ ^^^^^^^ | ||
│ | ||
= help: either include it or remove the dependency array | ||
|
||
error[roblox_roact_non_exhaustive_deps]: react hook useEffect has missing dependency: 'a' | ||
┌─ complex_deps.lua:30:10 | ||
│ | ||
30 │ end, { a.b.c }) | ||
│ ^^^^^^^^^ | ||
│ | ||
= help: either include it or remove the dependency array | ||
|
||
error[roblox_roact_non_exhaustive_deps]: react hook useEffect has missing dependency: 'a.b' | ||
┌─ complex_deps.lua:39:10 | ||
│ | ||
39 │ end, { a.b.c.d }) | ||
│ ^^^^^^^^^^^ | ||
│ | ||
= help: either include it or remove the dependency array | ||
|