gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.62k stars 1.76k forks source link

Enable plugin:react/recommended ESLint rules #34329

Open ravicious opened 1 year ago

ravicious commented 1 year ago

The recommended set of lint rules includes many helpful rules such as react/jsx-key.

Just simply enabling the recommended rules causes ~260 errors to pop up. Majority of the violations are for:

Disabling those rules and running an autofix brings us to only about 20 violations which can be directly addressed:

``` /Users/rav/src/teleport/e/web/teleport/src/Billing/Summary/Cycle.tsx 126:13 error Missing "key" prop for element in iterator react/jsx-key 171:13 error Missing "key" prop for element in iterator react/jsx-key /Users/rav/src/teleport/web/packages/design/src/Card/Card.story.tsx 41:9 error Missing "key" prop for element in iterator react/jsx-key /Users/rav/src/teleport/web/packages/design/src/Menu/Menu.jsx 34:14 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node 37:12 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node 45:22 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node /Users/rav/src/teleport/web/packages/design/src/Modal/Portal.jsx 61:24 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node 112:10 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node 116:24 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node /Users/rav/src/teleport/web/packages/design/src/Modal/RootRef.jsx 23:16 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node 28:17 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node /Users/rav/src/teleport/web/packages/design/src/Popover/Popover.jsx 330:31 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node /Users/rav/src/teleport/web/packages/design/src/Popover/Transition.jsx 22:18 error Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode react/no-find-dom-node /Users/rav/src/teleport/web/packages/design/src/ResourceIcon/ResourceIcon.story.tsx 30:9 error Missing "key" prop for element in iterator react/jsx-key /Users/rav/src/teleport/web/packages/shared/components/UnifiedResources/UnifiedResources.tsx 395:25 error Missing "key" prop for element in iterator react/jsx-key /Users/rav/src/teleport/web/packages/teleport/src/Player/ProgressBar/Slider/Slider.jsx 270:7 error Do not mutate state directly. Use setState() react/no-direct-mutation-state 273:7 error Do not mutate state directly. Use setState() react/no-direct-mutation-state ```
ravicious commented 11 months ago

Violations in existing files could be also ignored, see #35027.