Documentation comment not found for arrow function
toggleSidebar
18 const [isOpen, setIsOpen] = useState(true);
19 const location = useLocation();
20
21 const toggleSidebar = () => setIsOpen(!isOpen);22
23 return (
24 <div
Documentation comment not found for arrow function
Sidebar
14 items: SidebarItem[];
15};
16
17export const Sidebar = ({ title, items }: SidebarProps) => {18 const [isOpen, setIsOpen] = useState(true);
19 const location = useLocation();
20
Description
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"]
Bad Practice
function sum(a, b) {
return a + b;
}
Recommended
/**
* 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;
}