Documentation comment not found for arrow function
createActionCreators
77 searchTerm: z.string().optional(),
78})
79
80const createActionCreators = (dispatch: React.Dispatch<Action>): ActionCreators => ({ 81 setParams: (payload: string[]) => dispatch({ type: 'SET_PARAMS', payload }),
82 setPage: (payload: string) => dispatch({ type: 'SET_PAGE', payload }),
83 setAttributes: (payload: string[]) => dispatch({ type: 'SET_ATTRIBUTES', payload }),
Documentation comment not found for arrow function
SearchStateProvider
88})
89
90const SearchStateContext = createContext<SearchStateContext | null>(null)
91export const SearchStateProvider = ({ children, initState }: SearchStateProviderProps) => { 92 const [state, dispatch] = useReducer(reducer, initState ?? initialState)
93
94 const routeActions = createActionCreators(dispatch)
Documentation comment not found for arrow function
useSearchState
100 )
101}
102
103export const useSearchState = () => {104 const context = useContext(SearchStateContext)
105 if (!context) throw new Error('Unable to load context')
106 const { searchParams, routeActions } = context
Documentation comment not found for arrow function
reducer
28 },
29}
30
31const reducer = (state: State, action: Action): State => { 32 console.log(state, action)
33 switch (action.type) {
34 case 'SET_PARAMS':
Documentation comment not found for arrow function
DefaultLauncher
322 )
323 }
324
325 const DefaultLauncher = (326 props: UnstyledButtonProps & { onClick: MouseEventHandler<HTMLButtonElement> }
327 ) => (
328 <UnstyledButton w='100%' {...props}>
Documentation comment not found for arrow function
FilterDisplay
297 const selectedCountIcon = <Text className={classes.count}>{selectedItems.length}</Text>
298
299 const TitleBar = ({ modalTitle = false }: { modalTitle?: boolean }) => {
300 const FilterDisplay = (props: typeof modalTitle extends true ? TitleProps : TextProps) =>301 modalTitle ? <Title order={2} mb={0} {...props} /> : <Text className={classes.label} {...props} />
302
303 return (
Documentation comment not found for arrow function
generateInitialData
227 ? [router.query.a]
228 : []
229
230 const generateInitialData = (opts?: { clear?: boolean }) => {231 if (!moreFilterOptionData) return []
232 const initialValues = moreFilterOptionData.map((filter) => ({
233 ...filter,
Documentation comment not found for arrow function
deselectAll
254
255 if (!moreFilterOptionData) return <Skeleton height={48} width='100%' radius='xs' />
256
257 const deselectAll = () => form.setValues(generateInitialData({ clear: true }))258
259 const filterListInclude: JSX.Element[] = []
260 const filterListExclude: JSX.Element[] = []
Documentation comment not found for arrow function
TitleBar
296
297 const selectedCountIcon = <Text className={classes.count}>{selectedItems.length}</Text>
298
299 const TitleBar = ({ modalTitle = false }: { modalTitle?: boolean }) => {300 const FilterDisplay = (props: typeof modalTitle extends true ? TitleProps : TextProps) =>
301 modalTitle ? <Title order={2} mb={0} {...props} /> : <Text className={classes.label} {...props} />
302
Documentation comment not found for arrow function
StateWrapper
8
9import { SearchBox as SearchBoxComp } from './SearchBox'
10
11const StateWrapper = (args: SetOptional<ComponentProps<typeof SearchBoxComp>, 'loadingManager'>) => {12 const [isLoading, setLoading] = useState(false)
13 const loadingManager = { isLoading, setLoading }
14 return <SearchBoxComp loadingManager={loadingManager} {...args} />
Documentation comment not found for arrow function
isValidBreadcrumbProps
123 )
124}
125
126export const isValidBreadcrumbProps = (props: PossibleBreadcrumbProps): props is BreadcrumbProps => {127 if (props.option === 'close') return true
128 else if (props.option === 'back') {
129 if (props.backTo === 'dynamicText') {
Documentation comment not found for arrow function
isString
27 buttonText: {},
28}))
29
30const isString = (...args: unknown[]) => args.every((val) => typeof val === 'string') 31
32export const Breadcrumb = (props: BreadcrumbProps) => {
33 const { option, backTo, backToText, onClick } = props
Documentation comment not found for arrow function
clickHandler
37 const router = useRouter()
38 const { searchParams } = useSearchState()
39
40 const clickHandler: MouseEventHandler<HTMLButtonElement> = (e) => { 41 if (typeof onClick === 'function') return onClick(e)
42
43 if (option === 'back') {
Documentation comment not found for arrow function
WithSearchState
152
153export type LayoutsDecorator = 'centeredFullscreen' | 'centeredHalf' | 'gridSingle' | 'gridDouble'
154
155export const WithSearchState = (Story: StoryFn, { parameters }: StoryContext) => (156 <SearchStateProvider initState={parameters.searchContext}>
157 <Story />
158 </SearchStateProvider>
Documentation comment not found for arrow function
getStaticProps
177 // }
178}
179
180export const getStaticProps: GetStaticProps<Record<string, unknown>, RoutedQuery<'/org/[slug]'>> = async ({181 locale,
182 params,
183}) => {
Documentation comment not found for arrow function
LoadingState
23import { api } from '~app/utils/api'
24import { getServerSideTranslations } from '~app/utils/i18n'
25
26const LoadingState = () => ( 27 <>
28 <Grid.Col sm={8} order={1}>
29 {/* Toolbar */}
Documentation comment not found for arrow function
getStaticProps
154 }
155 // }
156}
157export const getStaticProps: GetStaticProps = async ({ locale, params }) => {158 const urlParams = z.object({ slug: z.string(), orgLocationId: z.string() }).safeParse(params)
159 if (!urlParams.success) return { notFound: true }
160 const { slug, orgLocationId } = urlParams.data
Documentation comment not found for arrow function
LoadingState
20import { api } from '~app/utils/api'
21import { getServerSideTranslations } from '~app/utils/i18n'
22
23const LoadingState = () => ( 24 <>
25 <Grid.Col sm={8} order={1}>
26 {/* Toolbar */}
Documentation comment not found for arrow function
getStaticProps
251}
252Home.omitGrid = true
253
254export const getStaticProps: GetStaticProps = async ({ locale }) => {255 const ssg = await trpcServerClient({ session: null })
256 await ssg.review.getFeatured.prefetch(3)
257
Documentation comment not found for arrow function
loadOtel
18
19const isVercelActiveDev = process.env.VERCEL_ENV === 'preview' && process.env.VERCEL_GIT_COMMIT_REF !== 'dev'
20
21const loadOtel = async () => {22 if (process.env.NEXT_RUNTIME === 'nodejs') {
23 await import('./otel.mjs')
24 }
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;
}