reset
15 setIsTouched(true);
16 };
17
18 const reset = () => {19 setInputValue("");
20 setIsTouched(false);
21 };
inputBlurHandler
11 setInputValue(event.target.value);
12 };
13
14 const inputBlurHandler = () => {15 setIsTouched(true);
16 };
17
valueChangeHandler
7 const isValid = validate(inputValue);
8 const hasError = !isValid && isTouched;
9
10 const valueChangeHandler = (event: React.ChangeEvent<HTMLInputElement>) => {11 setInputValue(event.target.value);
12 };
13
useInput
1import { useState } from "react";
2
3const useInput = (validate: (value: string) => boolean) => { 4 const [inputValue, setInputValue] = useState("");
5 const [isTouched, setIsTouched] = useState(false);
6
SignInPage
2import Blank from "../../layout/Blank";
3import SignIn from "./SignIn";
4
5export const SignInPage: React.VFC = () => { 6 return (
7 <Blank>
8 <SignIn />
It is recommended to have documentation comments above, or right inside a function/class declaration. This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skipdoccoverage option under the analyzers.meta
property in your .deepsource.toml
file.
For example, the following configuration will silence this issue for class expressions and method definitions:
[analyzers.meta]
skip_doc_coverage = ["class-expression", "method-definition"]
function sum(a, b) {
return a + b;
}
/**
* Function to add two numbers
* @param a The first number to add
* @param b The second number to add
* @returns The sum of two numbers
*/
function sum(a, b) {
return a + b;
}