-
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(analyzer): useExhaustiveDependencies error when useState is on a …
- Loading branch information
1 parent
cb57b76
commit 5a88220
Showing
5 changed files
with
42 additions
and
1 deletion.
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
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
14 changes: 14 additions & 0 deletions
14
crates/rome_js_analyze/tests/specs/nursery/useExhaustiveDependencies/newline.js
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,14 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
export const OtherComponent = () => { | ||
const [stringContent, setString] = | ||
useState('Something'); | ||
|
||
useEffect(() => { | ||
setString((content) => { | ||
return `${content} other`; | ||
}); | ||
}, []); | ||
|
||
return stringContent; | ||
}; |
24 changes: 24 additions & 0 deletions
24
crates/rome_js_analyze/tests/specs/nursery/useExhaustiveDependencies/newline.js.snap
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 @@ | ||
--- | ||
source: crates/rome_js_analyze/tests/spec_tests.rs | ||
expression: newline.js | ||
--- | ||
# Input | ||
```js | ||
import { useState, useEffect } from 'react'; | ||
|
||
export const OtherComponent = () => { | ||
const [stringContent, setString] = | ||
useState('Something'); | ||
|
||
useEffect(() => { | ||
setString((content) => { | ||
return `${content} other`; | ||
}); | ||
}, []); | ||
|
||
return stringContent; | ||
}; | ||
|
||
``` | ||
|
||
|
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