Open foot opened 1 year ago
e.g.
diff --git a/.eslintrc b/.eslintrc
index 9342ca8be..f29db0b58 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -4,7 +4,10 @@
"plugin:import/errors",
"plugin:import/warnings",
"plugin:@typescript-eslint/recommended",
- "plugin:import/typescript"
+ "plugin:import/typescript",
+ "plugin:react/recommended",
+ "plugin:react-hooks/recommended"
+
],
"plugins": [
"@typescript-eslint",
yarn lint
yarn run v1.22.19
$ eslint ui --max-warnings 0
/Users/simon/weave/weave-gitops/ui/App.tsx
61:10 error Component definition is missing display name react/display-name
61:13 error 'location' is missing in props validation react/prop-types
61:25 error 'location.search' is missing in props validation react/prop-types
206:27 error 'children' is missing in props validation react/prop-types
/Users/simon/weave/weave-gitops/ui/components/BucketDetail.tsx
27:20 error Missing "key" prop for element in array react/jsx-key
40:26 error Missing "key" prop for element in array react/jsx-key
41:22 error Missing "key" prop for element in array react/jsx-key
/Users/simon/weave/weave-gitops/ui/components/CheckboxActions.tsx
58:20 error React Hook "useToggleSuspend" is called in function "createDefaultSuspendHandler" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use" react-hooks/rules-of-hooks
/Users/simon/weave/weave-gitops/ui/components/Collapsible.tsx
15:24 error 'children' is missing in props validation react/prop-types
/Users/simon/weave/weave-gitops/ui/components/DagGraph.tsx
154:21 error Invalid property 'fill' found on tag 'foreignObject', but it is only allowed on: altGlyph, circle, ellipse, g, line, marker, mask, path, polygon, polyline, rect, svg, symbol, text, textPath, tref, tspan, use, animate, animateColor, animateMotion, animateTransform, set react/no-unknown-property
/Users/simon/weave/weave-gitops/ui/components/DependenciesView.tsx
52:7 error React Hook "useListObjects" is called conditionally. React Hooks must be called in the exact same order in every component render react-hooks/rules-of-hooks
80:6 warning React Hook React.useEffect has a missing dependency: 'automation'. Either include it or remove the dependency array react-hooks/exhaustive-deps
112:25 error `'` can be escaped with `'`, `‘`, `'`, `’` react/no-unescaped-entities
112:31 error `'` can be escaped with `'`, `‘`, `'`, `’` react/no-unescaped-entities
/Users/simon/weave/weave-gitops/ui/components/DirectedGraph.tsx
77:17 error Invalid property 'fill' found on tag 'foreignObject', but it is only allowed on: altGlyph, circle, ellipse, g, line, marker, mask, path, polygon, polyline, rect, svg, symbol, text, textPath, tref, tspan, use, animate, animateColor, animateMotion, animateTransform, set react/no-unknown-property
/Users/simon/weave/weave-gitops/ui/components/ErrorBoundary.tsx
57:6 warning React Hook useEffect has a missing dependency: 'hasError'. Either include it or remove the dependency array react-hooks/exhaustive-deps
/Users/simon/weave/weave-gitops/ui/components/Flex.tsx
47:7 error 'children' is missing in props validation react/prop-types
/Users/simon/weave/weave-gitops/ui/components/Form.tsx
48:6 warning React Hook React.useEffect has a missing dependency: 'onChange'. Either include it or remove the dependency array. If 'onChange' changes too often, find the parent component that defines it and wrap that definition in useCallback react-hooks/exhaustive-deps
/Users/simon/weave/weave-gitops/ui/components/GitRepositoryDetail.tsx
34:11 error Missing "key" prop for element in array react/jsx-key
49:11 error Missing "key" prop for element in array react/jsx-key
54:26 error Missing "key" prop for element in array react/jsx-key
/Users/simon/weave/weave-gitops/ui/components/HelmChartDetail.tsx
29:11 error Missing "key" prop for element in array react/jsx-key
46:26 error Missing "key" prop for element in array react/jsx-key
47:22 error Missing "key" prop for element in array react/jsx-key
/Users/simon/weave/weave-gitops/ui/components/HelmReleaseDetail.tsx
68:11 error Missing "key" prop for element in array react/jsx-key
87:22 error Missing "key" prop for element in array react/jsx-key
/Users/simon/weave/weave-gitops/ui/components/HelmRepositoryDetail.tsx
34:11 error Missing "key" prop for element in array react/jsx-key
48:17 error Missing "key" prop for element in array react/jsx-key
57:22 error Missing "key" prop for element in array react/jsx-key
/Users/simon/weave/weave-gitops/ui/components/Icon.tsx
196:14 error Component definition is missing display name react/display-name
202:14 error Component definition is missing display name react/display-name
205:14 error Component definition is missing display name react/display-name
208:14 error Component definition is missing display name react/display-name
/Users/simon/weave/weave-gitops/ui/components/ImageAutomation/updates/ImageAutomationUpdatesDetails.tsx
31:29 error React Hook "useFeatureFlags" is called in function "getInfoList" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use" react-hooks/rules-of-hooks
/Users/simon/weave/weave-gitops/ui/components/InfoModal.tsx
45:7 error Do not pass children as props. Instead, nest children between the opening and closing tags react/no-children-prop
/Users/simon/weave/weave-gitops/ui/components/KustomizationDetail.tsx
44:11 error Missing "key" prop for element in array react/jsx-key
59:11 error Missing "key" prop for element in array react/jsx-key
67:22 error Missing "key" prop for element in array react/jsx-key
/Users/simon/weave/weave-gitops/ui/components/Nav.tsx
104:24 error 'iconType' is missing in props validation react/prop-types
104:34 error 'color' is missing in props validation react/prop-types
104:41 error 'collapsed' is missing in props validation react/prop-types
104:52 error 'title' is missing in props validation react/prop-types
116:17 error Component definition is missing display name react/display-name
/Users/simon/weave/weave-gitops/ui/components/OCIRepositoryDetail.tsx
34:11 error Missing "key" prop for element in array react/jsx-key
47:17 error Missing "key" prop for element in array react/jsx-key
56:22 error Missing "key" prop for element in array react/jsx-key
/Users/simon/weave/weave-gitops/ui/components/Page.tsx
60:26 error 'error' is missing in props validation react/prop-types
/Users/simon/weave/weave-gitops/ui/components/PendoContainer.tsx
35:6 warning React Hook React.useEffect has a missing dependency: 'data'. Either include it or remove the dependency array react-hooks/exhaustive-deps
/Users/simon/weave/weave-gitops/ui/components/PodDetail.tsx
63:19 error 'pod' is missing in props validation react/prop-types
68:29 error 'pod.namespace' is missing in props validation react/prop-types
69:26 error 'pod.podIP' is missing in props validation react/prop-types
70:23 error Missing "key" prop for element in array react/jsx-key
70:47 error 'pod.podIPs' is missing in props validation react/prop-types
71:34 error 'pod.priorityClass' is missing in props validation react/prop-types
72:29 error 'pod.qosClass' is missing in props validation react/prop-types
87:19 error 'pod.tolerations' is missing in props validation react/prop-types
92:12 error 'pod.containers' is missing in props validation react/prop-types
92:23 error 'pod.containers.map' is missing in props validation react/prop-types
102:19 error Missing "key" prop for element in array react/jsx-key
111:19 error Missing "key" prop for element in array react/jsx-key
115:19 error Missing "key" prop for element in array react/jsx-key
119:22 error 'pod.containers' is missing in props validation react/prop-types
119:33 error 'pod.containers.length' is missing in props validation react/prop-types
127:20 error 'pod.volumes' is missing in props validation react/prop-types
/Users/simon/weave/weave-gitops/ui/components/Policies/PolicyDetails/PolicyDetails.tsx
107:29 error Do not pass children as props. Instead, nest children between the opening and closing tags react/no-children-prop
111:15 error Do not pass children as props. Instead, nest children between the opening and closing tags react/no-children-prop
/Users/simon/weave/weave-gitops/ui/components/Policies/PolicyViolations/PolicyViolationDetails.tsx
115:25 error Do not pass children as props. Instead, nest children between the opening and closing tags react/no-children-prop
119:11 error Do not pass children as props. Instead, nest children between the opening and closing tags react/no-children-prop
/Users/simon/weave/weave-gitops/ui/components/Policies/Utils/PolicyUtils.tsx
24:34 error 'title' is missing in props validation react/prop-types
24:41 error 'children' is missing in props validation react/prop-types
/Users/simon/weave/weave-gitops/ui/components/SubRouterTabs.tsx
27:23 error Component definition is missing display name react/display-name
/Users/simon/weave/weave-gitops/ui/components/YamlView.tsx
34:52 error React Hook "useInDarkMode" is called conditionally. React Hooks must be called in the exact same order in every component render react-hooks/rules-of-hooks
/Users/simon/weave/weave-gitops/ui/contexts/AppContext.tsx
74:6 warning React Hook React.useEffect has a missing dependency: 'clearAsyncError'. Either include it or remove the dependency array. Outer scope values like 'window.location' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
/Users/simon/weave/weave-gitops/ui/contexts/AuthContext.tsx
29:20 error React Hook "useLocation" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return? react-hooks/rules-of-hooks
56:47 error 'children' is missing in props validation react/prop-types
85:6 warning React Hook React.useCallback has missing dependencies: 'getUserInfo', 'history', and 'request'. Either include them or remove the dependency array react-hooks/exhaustive-deps
102:6 warning React Hook React.useCallback has a missing dependency: 'request'. Either include it or remove the dependency array react-hooks/exhaustive-deps
117:6 warning React Hook React.useCallback has a missing dependency: 'request'. Either include it or remove the dependency array react-hooks/exhaustive-deps
/Users/simon/weave/weave-gitops/ui/contexts/GithubAuthContext.tsx
29:52 error Do not pass children as props. Instead, nest children between the opening and closing tags react/no-children-prop
/Users/simon/weave/weave-gitops/ui/hooks/__tests__/common.test.tsx
28:10 warning React Hook React.useEffect has a missing dependency: 'req'. Either include it or remove the dependency array react-hooks/exhaustive-deps
51:10 warning React Hook React.useEffect has a missing dependency: 'req'. Either include it or remove the dependency array react-hooks/exhaustive-deps
77:10 warning React Hook React.useEffect has a missing dependency: 'req'. Either include it or remove the dependency array react-hooks/exhaustive-deps
/Users/simon/weave/weave-gitops/ui/hooks/common.ts
42:47 error React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return? react-hooks/rules-of-hooks
44:3 error React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return? react-hooks/rules-of-hooks
✖ 84 problems (73 errors, 11 warnings)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Notes from triage:
react/prop-types
displayName
, we can disable react/display-name
exhaustive-deps
for EE consistency.react/jsx-key
problemsreact-hooks/rules-of-hooks
react/no-children-prop
for consistency (this one is purely subjective)react/no-unescaped-entities
to avoid certain bugs
We're using some hooks conditionally etc which is a bit of a no-no.
But also things seems to be working okay..