Documentation comment not found for arrow function
reset
82 await handleSubmit({ amount, cause });
83 };
84
85 const reset = () => { 86 setIsAnyoneInNeed(false);
87 setSelectedCauses({});
88 setCause('');
Documentation comment not found for arrow function
handleSubmitForm
66 const selectCause = (id) => (value) =>
67 setSelectedCauses({ ...selectedCauses, [id]: value });
68
69 const handleSubmitForm = async (event) => { 70 event.preventDefault();
71
72 if (!cause) {
Documentation comment not found for arrow function
selectCause
63 setModalOpen(true);
64 };
65
66 const selectCause = (id) => (value) => 67 setSelectedCauses({ ...selectedCauses, [id]: value });
68
69 const handleSubmitForm = async (event) => {
Documentation comment not found for arrow function
showModal
58
59 const hideModal = () => setModalOpen(false);
60
61 const showModal = (message) => { 62 setModalText(message);
63 setModalOpen(true);
64 };
Documentation comment not found for arrow function
hideModal
56 }
57 }, [isAnyoneInNeed, selectedCauses]);
58
59 const hideModal = () => setModalOpen(false); 60
61 const showModal = (message) => {
62 setModalText(message);
Documentation comment not found for function declaration
MainDonationForm
28 { id: 4, label: 'Seniors in Need' },
29];
30
31export default function MainDonationForm({ inNeed = false }) { 32 const [modalText, setModalText] = React.useState('');
33 const [isModalOpen, setModalOpen] = React.useState(false);
34 const [amount, setAmount] = React.useState(0);
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;
}