Replies: 8 comments 10 replies
-
I don’t think we currently support that, no. We could implement it, but it would always be an unsafe fix only, because there are many situations why people sometimes intentionally deviate from the expected list of dependencies.
Just to verify, are those all your
Do you have an example of this one?
It sounds like a bug, but do you have an example of some code that triggers this? It might be best to create an issue for it. |
Beta Was this translation helpful? Give feedback.
-
1 . It is implemented in ESLint( could possible be prettier). And for me, one of the features I cannot live without. In my case, I never calculate the dependency list myself. I would assume, that if I ever want to deviate from a complete list, then I would ignore just that line. I got hundreds of dependency lists that needs fixing (according to biome). I dont think it is true, cause those are not hand written by me, they are calculated by ESLint(could possible be prettier).
useEffect(() => {
if (previousFormData && formData[dateName] !== previousFormData[dateName]) {
const newQueryArgs = { ...queryArgs };
newQueryArgs[dateName] = formData[dateName];
navigate(location.pathname + "?" + queryString.stringify(newQueryArgs));
} else if (queryArgs && dateName in queryArgs && formData[dateName] !== queryArgs[dateName]) {
const change: any = {};
change[dateName] = queryArgs[dateName];
setFormData(change);
}
}, [dateName, previousFormData, formData, queryArgs, navigate, location]); ⚠ This hook specifies a dependency more specific that its captures: location
35 │ const { queryArgs } = useQueryArgs();
36 │
> 37 │ useEffect(() => {
│ ^^^^^^^^^
38 │ if (previousFormData && formData[dateName] !== previousFormData[dateName]) {
39 │ const newQueryArgs = { ...queryArgs };
ℹ This capture is more generic than...
40 │ newQueryArgs[dateName] = formData[dateName];
41 │ navigate(location.pathname + "?" + queryString.stringify(newQueryArgs));
> 42 │ } else if (queryArgs && dateName in queryArgs && formData[dateName] !== queryArgs[dateName]) {
│ ^^^^^^^^^^^^^^^^^^
43 │ const change: any = {};
44 │ change[dateName] = queryArgs[dateName];
ℹ ...this dependency.
45 │ setFormData(change);
46 │ }
> 47 │ }, [dateName, previousFormData, formData, queryArgs, navigate, location]);
│ ^^^^^^^^
48 │
49 │ return (
⚠ This hook does not specify all of its dependencies: formData[dateName]
35 │ const { queryArgs } = useQueryArgs();
36 │
> 37 │ useEffect(() => {
│ ^^^^^^^^^
38 │ if (previousFormData && formData[dateName] !== previousFormData[dateName]) {
39 │ const newQueryArgs = { ...queryArgs };
ℹ This dependency is not specified in the hook dependency list.
40 │ newQueryArgs[dateName] = formData[dateName];
41 │ navigate(location.pathname + "?" + queryString.stringify(newQueryArgs));
> 42 │ } else if (queryArgs && dateName in queryArgs && formData[dateName] !== queryArgs[dateName]) {
│ ^^^^^^^^^^^^^^^^^^
43 │ const change: any = {};
44 │ change[dateName] = queryArgs[dateName]; |
Beta Was this translation helpful? Give feedback.
-
any updates on this issue? |
Beta Was this translation helpful? Give feedback.
-
Any news here? |
Beta Was this translation helpful? Give feedback.
-
yeah this is tablestakes today imo. |
Beta Was this translation helpful? Give feedback.
-
So the remaining question is that quick fix of |
Beta Was this translation helpful? Give feedback.
-
Yes, I just encountered this issue while trying to migrate |
Beta Was this translation helpful? Give feedback.
-
By the way, I'd like to ask, will the value generated by Although it is possible to configure, I feel that having this rule by default might be more beginner-friendly. |
Beta Was this translation helpful? Give feedback.
-
I have been checking if biome can replace eslint and prettier for me.
Ran into 3 issues that for me are showstoppers:
Any suggestions would be most appreciated!
Beta Was this translation helpful? Give feedback.
All reactions