litmuschaos / litmus

Litmus helps SREs and developers practice chaos engineering in a Cloud-native way. Chaos experiments are published at the ChaosHub (https://hub.litmuschaos.io). Community notes is at https://hackmd.io/a4Zu_sH4TZGeih-xCimi3Q
https://litmuschaos.io
Apache License 2.0
4.35k stars 684 forks source link

FIX: Eslint warning and add yarn lint in eslint in CI #4105

Open punithnayak opened 1 year ago

punithnayak commented 1 year ago

What happened: There are a bunch of eslint warnings

yarn run v1.22.19
warning ../../../../package.json: No license field
$ eslint --ext .ts --ext .tsx src

/home/punith/Desktop/litmus/chaoscenter/web/src/components/PipelineDiagram/Nodes/StartNode/StartNodeStage.tsx
  10:32  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/PipelineDiagram/Nodes/StartNode/StartNodeStep.tsx
  10:31  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/PipelineDiagram/Nodes/utils.tsx
  9:45  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/PipelineDiagram/PipelineGraph/PipelineGraph.tsx
   31:22  warning  Unexpected any. Specify a different type                                                                                                                                     @typescript-eslint/no-explicit-any
  101:6   warning  React Hook useLayoutEffect has missing dependencies: 'redrawSVGLinks', 'renderSVGLinksDelayed', and 'shouldDelayRender'. Either include them or remove the dependency array  react-hooks/exhaustive-deps
  141:6   warning  React Hook useEffect has a missing dependency: 'panZoom'. Either include it or remove the dependency array                                                                   react-hooks/exhaustive-deps

/home/punith/Desktop/litmus/chaoscenter/web/src/components/PipelineDiagram/PipelineGraph/PipelineGraphUtils.ts
  180:24  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/PipelineDiagram/hooks/useIntersection.ts
  39:6  warning  React Hook useEffect has a missing dependency: 'compareFn'. Either include it or remove the dependency array. If 'compareFn' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps

/home/punith/Desktop/litmus/chaoscenter/web/src/components/PipelineDiagram/hooks/useResizeObserver.ts
  31:39  warning  Forbidden non-null assertion                                                                                                        @typescript-eslint/no-non-null-assertion
  56:6   warning  React Hook useEffect has missing dependencies: 'onResize' and 'parentSelector'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SchedulePanel.tsx
  16:17  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/CustomTab/CustomTab.tsx
  10:16  warning  Unexpected any. Specify a different type                                                                        @typescript-eslint/no-explicit-any
  23:6   warning  React Hook useEffect has a missing dependency: 'formikProps'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/DailyTab/DailyTab.tsx
  12:16  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/Expression/Expression.tsx
  9:16  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/ExpressionBreakdown/ExpressionBreakdown.tsx
  10:18  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  35:39  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/HourlyTab/HourlyTab.tsx
  12:16  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/MinutesTab/MinutesTab.tsx
  12:16  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/MonthlyTab/MonthlyTab.tsx
  22:16  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/WeeklyTab/WeeklyTab.tsx
  20:16  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/SchedulePanel/SubComponents/YearlyTab/YearlyTab.tsx
  20:16  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/TimeSelect/TimeSelect.tsx
  20:85  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/components/Toothpick/Toothpick.tsx
  19:85  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/context/AppStoreContext.tsx
  55:5  warning  React Hook React.useCallback has a missing dependency: 'history'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

/home/punith/Desktop/litmus/chaoscenter/web/src/strings/String.tsx
  54:62  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/strings/StringsContext.tsx
  11:53  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/utils/destructure.ts
  1:43  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/utils/downloadYaml.ts
   8:56  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  11:37  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/utils/faultTunableForm.ts
  30:81  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  39:71  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  59:50  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/utils/testUtils.tsx
  32:60  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/views/AddHubModalWizard/AddHubModalWizard.tsx
  297:32  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/views/ChaosFault/ChaosFault.tsx
  98:56  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/views/ChaosHub/ChaosFaults/ChaosFaults.tsx
  58:6  warning  React Hook React.useEffect has missing dependencies: 'currentPage' and 'filteredFaults'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

/home/punith/Desktop/litmus/chaoscenter/web/src/views/ChaosHub/PredefinedExperiments/PredefinedExperiments.tsx
  55:6  warning  React Hook React.useEffect has missing dependencies: 'currentPage' and 'filteredExperiments'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

/home/punith/Desktop/litmus/chaoscenter/web/src/views/EditHubModalWizard/EditHubModalWizard.tsx
  296:32  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/views/ExperimentCreationFaultConfiguration/Tabs/FaultTunablesTab/getTypeBasedFaultEnvInput.tsx
  31:29  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  44:29  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/punith/Desktop/litmus/chaoscenter/web/src/views/ExperimentCreationFaultConfiguration/Tabs/Probes/AddProbeStepWizard/ProbePropertiesStep.tsx
  15:42  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

What you expected to happen: There should be no warnings

Where can this issue be corrected? (optional)

This issue is seen in litmus/chaoscenter/web

How to reproduce it (as minimally and precisely as possible): 1) cd litmus/chaoscenter/ 2) runyarn lint `

Anything else we need to know?:

swastik959 commented 1 year ago

As far as I know these warnings are not because of any sort of liniting mistake they just basically suggest to specify the datatype and add some dependency matix for a few functions to maintain the readability of code tsx Is really useful but it annoys me in this context

punithnayak commented 1 year ago

@swastik959 So what must be done here

punithnayak commented 1 year ago

Hey @swastik959 @saranya-jena there are mainly two types of error seen 1)@typescript-eslint/no-explicit-any 2)React Hook useEffect has a missing dependency: 'formikProps'. Either include it or remove the dependency array react-hooks/exhaustive-deps

for the first one, I will try to create a valid interface for the cond use will use one among the listed(https://kinsta.com/knowledgebase/react-hook-useeffect-has-a-missing-dependency/) techniques fine?

Saranya-jena commented 1 year ago

@arkajyotiMukherjee Can you comment here?