You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a codebase with ~100 existing warnings, and we're trying to turn new ones into errors, but let existing ones stay as warnings. I saw from eslint/eslint#13264 (comment) that this isn't possible directly in ESLint, but we circumvented this by putting "FIXME" in our "message", which in-turn triggers a warning that we have enabled (no-warning-comments)
I was wondering, is there a way I can insert the original violation explanation itself into the "message", so that users don't need to uncomment to see the error?
Reason being in my case (react-hooks/exhaustive-deps) the details can be one of several things, and I want it to stand out in the comment for easy scanning.
Some examples of the actual error that I would want to inline into the comment:
React Hook useMemo has a missing dependency: 'variableName'. Either include it or remove the dependency array. eslint(react-hooks/exhaustive-deps)
React Hook useCallback has an unnecessary dependency: 'variableName'. Either exclude it or remove the dependency array. eslint(react-hooks/exhaustive-deps)
React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead. eslint(react-hooks/exhaustive-deps)
React Hook useEffect contains a call to 'functionName'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [variableName, variableName2, variableName3] as a second argument to the useEffect Hook. eslint(react-hooks/exhaustive-deps)
The 'variableName' logical expression could make the dependencies of useEffect Hook (at line 20) change on every render. Move it inside the useEffect callback. Alternatively, wrap the initialization of 'variableName' in its own useMemo() Hook. eslint(react-hooks/exhaustive-deps)
Assignments to the 'variableName' variable from inside React Hook useEffect will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside useEffect. eslint[react-hooks/exhaustive-deps)
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Thanks for this tooling!
We have a codebase with ~100 existing warnings, and we're trying to turn new ones into errors, but let existing ones stay as warnings. I saw from eslint/eslint#13264 (comment) that this isn't possible directly in ESLint, but we circumvented this by putting "FIXME" in our "message", which in-turn triggers a warning that we have enabled (no-warning-comments)
I was wondering, is there a way I can insert the original violation explanation itself into the "message", so that users don't need to uncomment to see the error?
Reason being in my case (
react-hooks/exhaustive-deps
) the details can be one of several things, and I want it to stand out in the comment for easy scanning.Some examples of the actual error that I would want to inline into the comment:
Thanks in advance.
The text was updated successfully, but these errors were encountered: