Showing 45 of 71 total issues
Function useFetch
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function useFetch<T = any, E = Error>(
to: RequestInfo,
opts?: RequestInit
): RequestState<T, E> {
const [manualRefetch, forceRefetch] = useReducer(s => (s + 1) % 10, 0)
Function handler
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handler: http.RequestListener = (req, res) => {
switch (req.url) {
// mock json todo object route
case '/todos/1':
res.writeHead(200, { 'Content-Type': 'application/json' })
Function sendRequest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const sendRequest = async () => {
if (!memoTo) {
return
}
Function handler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const handler: http.RequestListener = (req, res) => {
switch (req.url) {
// mock json todo object route
case '/todos/1':
res.writeHead(200, { 'Content-Type': 'application/json' })
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Definition for rule 'tsdoc/syntax' was not found. Open
import {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
React Hook useEffect has missing dependencies: 'E' and 'T'. Either include them or remove the dependency array. Open
}, [memoTo, memoOpts, manualRefetch, receiveResponse, receiveError])
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'tsdoc/syntax' was not found. Open
import { useState } from 'react'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'tsdoc/syntax' was not found. Open
/* eslint-disable @typescript-eslint/no-explicit-any */
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Missing return type on function. Open
const useDidMount = () => {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
React Hook useEffect has a missing dependency: 'callback.name'. Either include it or remove the dependency array. Open
}, [delayedCallback])
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'tsdoc/syntax' was not found. Open
import type React from 'react'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'tsdoc/syntax' was not found. Open
/**
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ,
Open
opts?: O extends void ? P : O,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'tsdoc/syntax' was not found. Open
/**
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Missing return type on function. Open
const useMount = (effect: EffectCallback) => {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'tsdoc/syntax' was not found. Open
import { useCallback, DependencyList } from 'react'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Missing return type on function. Open
const useDelayedCallback = <T extends (...args: any[]) => any>(
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'tsdoc/syntax' was not found. Open
export const sleep = (delay: number) =>
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Missing return type on function. Open
export const sleep = (delay: number) =>
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Don't use object
as a type. The object
type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using Record<string unknown></string>
instead, as it allows you to more easily inspect and use the keys. Open
const bKeys = Object.keys(b as object).sort()
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/