giveth-gatsby icon indicating copy to clipboard operation
giveth-gatsby copied to clipboard

Fixes for console warnings (WIP)

Open geleeroyale opened this issue 3 years ago • 3 comments

Started with low hanging fruit

  • remove unused imports
  • Use React.Fragment to get around 'React' is declared but never used error

Still to do

  • Fix dependency arrays for some side effects
  • refactor stripe integration so we can remove it from code
  • Fix regex warnings (Unnecessary escape character)
  • Look at variables that were defined but not used
  • Look at variables that were declared but not used
  • Look at variables that were assigned a value but not used
  • Fix duplicate keys
  • Fix type errors
  • Look at keyboard/mouse events for non-interactive elements
  • Assign role to static HTML elements with event handlers
  • Add default case in case selection
  • Look at redundant nested blocks
  • Look at build warnings

geleeroyale avatar Feb 28 '21 11:02 geleeroyale

Full output for remaining errors:

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/GithubIssue.js
  63:80  warning  Unexpected use of comma operator  no-sequences

✖ 1 problem (0 errors, 1 warning)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/account/AccountBody.js
  12:7   warning  'UserSpan' is assigned a value but never used  no-unused-vars
  58:18  warning  'setQuery' is assigned a value but never used  no-unused-vars

✖ 2 problems (0 errors, 2 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/account/AccountNav.js
  52:15  warning  The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If
you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more:
https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid
  52:15  warning  Visible, non-interactive elements with click handlers must have at least one keyboard listener

                                                                                     jsx-a11y/click-events-have-key-events
  52:15  warning  Static HTML elements with event handlers require a role

                                                                                     jsx-a11y/no-static-element-interactions

✖ 3 problems (0 errors, 3 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/account/editProfileModal.js
    4:13  warning  'Auth' is defined but never used             no-unused-vars
   42:35  warning  'watch' is assigned a value but never used   no-unused-vars
   42:42  warning  'errors' is assigned a value but never used  no-unused-vars
  174:13  warning  No duplicate props allowed                   react/jsx-no-duplicate-props

✖ 4 problems (0 errors, 4 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/account/index.js
  17:7   warning  'UserSpan' is assigned a value but never used           no-unused-vars
  31:9   warning  'fromWalletAddress' is assigned a value but never used  no-unused-vars
  33:9   warning  'userWallets' is assigned a value but never used        no-unused-vars
  91:11  warning  No duplicate props allowed                              react/jsx-no-duplicate-props

✖ 4 problems (0 errors, 4 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/account/myDonations.js
  165:11  warning  'user' is assigned a value but never used

               no-unused-vars
  170:31  warning  'setCurrentProjectView' is assigned a value but never used

               no-unused-vars
  186:6   warning  React Hook React.useEffect has a missing dependency: 'props.donations'. Either include it or remove the dependency array. If
'setCurrentDonations' needs the current value of 'props.donations', you can also switch to useReducer instead of useState and read
'props.donations' in the reducer  react-hooks/exhaustive-deps

✖ 3 problems (0 errors, 3 warnings)
  0 errors and 1 warning potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/account/myProjects.js
  45:23  warning  'user' is assigned a value but never used   no-unused-vars
  46:10  warning  'query' is assigned a value but never used  no-unused-vars

✖ 2 problems (0 errors, 2 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/account/projectEdition/index.js
   45:5   warning  'setShowModal' is assigned a value but never used
                                                                          no-unused-vars
   54:19  warning  'setLoading' is assigned a value but never used
                                                                          no-unused-vars
   57:35  warning  'errors' is assigned a value but never used
                                                                          no-unused-vars
   63:9   warning  'connectBankAccount' is assigned a value but never used
                                                                          no-unused-vars
  357:5   warning  'web3' is assigned a value but never used
                                                                          no-unused-vars
  371:3   warning  React Hook useEffect contains a call to 'setMapLocation'. Without a list of dependencies, this can lead to an infinite chain of
updates. To fix this, pass [] as a second argument to the useEffect Hook  react-hooks/exhaustive-deps
  381:15  warning  'edit' is assigned a value but never used
                                                                          no-unused-vars
  395:6   warning  React Hook useEffect has missing dependencies: 'client', 'fetchedProject.projectBySlug.id', and 'updateProjectOnServer'. Either
include them or remove the dependency array                               react-hooks/exhaustive-deps

✖ 8 problems (0 errors, 8 warnings)
  0 errors and 2 warnings potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/confetti/index.js
  12:11  warning  'buttonStyle' is assigned a value but never used  no-unused-vars

✖ 1 problem (0 errors, 1 warning)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/create-project-form/index.js
   57:6  warning  React Hook useEffect has missing dependencies: 'logout' and 'validateToken'. Either include them or remove the dependency array
 react-hooks/exhaustive-deps
  227:6  warning  React Hook useEffect has missing dependencies: 'flashMessage' and 'usePopup'. Either include them or remove the dependency array
 react-hooks/exhaustive-deps

✖ 2 problems (0 errors, 2 warnings)
  0 errors and 2 warnings potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/create-project-form/inputs/ProjectEthAddressInput.js
  12:10  warning  'characterLength' is assigned a value but never used  no-unused-vars

✖ 1 problem (0 errors, 1 warning)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/create-project-form/inputs/ProjectImpactLocationInput.js
  11:10  warning  'showLocationInput' is assigned a value but never used     no-unused-vars
  11:29  warning  'setShowLocationInput' is assigned a value but never used  no-unused-vars

✖ 2 problems (0 errors, 2 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/donate/inProgressModal.js
  21:9  warning  Duplicate key 'alignItems'  no-dupe-keys

✖ 1 problem (0 errors, 1 warning)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/donate/onlyCrypto.js
   70:7   warning  'CheckboxLabel' is assigned a value but never used      no-unused-vars
   94:11  warning  'logout' is assigned a value but never used             no-unused-vars
   95:10  warning  'wallet' is assigned a value but never used             no-unused-vars
   97:10  warning  'notify' is assigned a value but never used             no-unused-vars
  101:26  warning  'setDonateToGiveth' is assigned a value but never used  no-unused-vars
  104:10  warning  'anonymous' is assigned a value but never used          no-unused-vars
  104:21  warning  'setAnonymous' is assigned a value but never used       no-unused-vars
  108:9   warning  'client' is assigned a value but never used             no-unused-vars

✖ 8 problems (0 errors, 8 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/donate/onlyFiat.js
  126:35  warning  'givethDonation' is assigned a value but never used  no-unused-vars

✖ 1 problem (0 errors, 1 warning)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/donate/success.js
   41:20  warning  'sessionId' is assigned a value but never used                                                  no-unused-vars
   42:21  warning  'setPdfBase64' is assigned a value but never used                                               no-unused-vars
  125:13  warning  Visible, non-interactive elements with click handlers must have at least one keyboard listener
jsx-a11y/click-events-have-key-events
  125:13  warning  Static HTML elements with event handlers require a role
jsx-a11y/no-static-element-interactions
  135:13  warning  Visible, non-interactive elements with click handlers must have at least one keyboard listener
jsx-a11y/click-events-have-key-events
  135:13  warning  Static HTML elements with event handlers require a role
jsx-a11y/no-static-element-interactions

✖ 6 problems (0 errors, 6 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/header.js
  172:10  warning  'navHidden' is assigned a value but never used      no-unused-vars
  172:21  warning  'setHideNavbar' is assigned a value but never used  no-unused-vars
  177:7   warning  Nested block is redundant                           no-lone-blocks

✖ 3 problems (0 errors, 3 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/popup.js
  58:9  warning  Visible, non-interactive elements with click handlers must have at least one keyboard listener
jsx-a11y/click-events-have-key-events
  58:9  warning  Non-interactive elements should not be assigned mouse or keyboard event listeners
jsx-a11y/no-noninteractive-element-interactions
  71:9  warning  Visible, non-interactive elements with click handlers must have at least one keyboard listener
jsx-a11y/click-events-have-key-events
  71:9  warning  Non-interactive elements should not be assigned mouse or keyboard event listeners
jsx-a11y/no-noninteractive-element-interactions

✖ 4 problems (0 errors, 4 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/project/donatorView.js
   20:3  warning  'GET_STRIPE_PROJECT_DONATIONS' is defined but never used


                                 no-unused-vars
  135:6  warning  React Hook useEffect has missing dependencies: 'client', 'currentProjectView', 'pageContext.project.admin', 'project.admin',
'project.donations', 'project.id', 'project.walletAddress', 'setCurrentProjectView', and 'user.id'. Either include them or remove the dependency
array. If 'setIsOwner' needs the current value of 'pageContext.project.admin', you can also switch to useReducer instead of useState and read
'pageContext.project.admin' in the reducer  react-hooks/exhaustive-deps
  153:7  warning  Expected a default case


                                 default-case

✖ 3 problems (0 errors, 3 warnings)
  0 errors and 1 warning potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/project/timeline/card.js
   19:3  warning  'GET_PROJECT_UPDATES' is defined but never used
no-unused-vars
  154:6  warning  React Hook useEffect has missing dependencies: 'client' and 'props'. Either include them or remove the dependency array
react-hooks/exhaustive-deps

✖ 2 problems (0 errors, 2 warnings)
  0 errors and 1 warning potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/project/updatesTab.js
  32:6   warning  React Hook useEffect has missing dependencies: 'currentProjectView' and 'setCurrentProjectView'. Either include them or remove
the dependency array  react-hooks/exhaustive-deps
  39:15  warning  'data' is assigned a value but never used
                    no-unused-vars

✖ 2 problems (0 errors, 2 warnings)
  0 errors and 1 warning potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/projectCard.js
   10:3   warning  'GET_PROJECT_REACTIONS' is defined but never used                                               no-unused-vars
  104:7   warning  'IconBtn' is assigned a value but never used                                                    no-unused-vars
  135:17  warning  'isLoggedIn' is assigned a value but never used                                                 no-unused-vars
  136:20  warning  'shadowed' is assigned a value but never used                                                   no-unused-vars
  140:7   warning  'reactionCount' is assigned a value but never used                                              no-unused-vars
  184:9   warning  Visible, non-interactive elements with click handlers must have at least one keyboard listener
jsx-a11y/click-events-have-key-events
  184:9   warning  Static HTML elements with event handlers require a role
jsx-a11y/no-static-element-interactions

✖ 7 problems (0 errors, 7 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/seo.js
  29:9   warning  'urlRegex' is assigned a value but never used  no-unused-vars
  29:28  warning  Unnecessary escape character: \:               no-useless-escape
  29:37  warning  Unnecessary escape character: \/               no-useless-escape
  29:55  warning  Unnecessary escape character: \^               no-useless-escape
  29:61  warning  Unnecessary escape character: \/               no-useless-escape
  29:64  warning  Unnecessary escape character: \+               no-useless-escape
  29:70  warning  Unnecessary escape character: \?               no-useless-escape
  29:78  warning  Unnecessary escape character: \#               no-useless-escape
  29:89  warning  Unnecessary escape character: \#               no-useless-escape

✖ 9 problems (0 errors, 9 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/torus/loginButton.js
  52:10  warning  'showOptions' is assigned a value but never used     no-unused-vars
  52:23  warning  'setShowOptions' is assigned a value but never used  no-unused-vars

✖ 2 problems (0 errors, 2 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/torus/userDetails.js
  149:11  warning  Non-interactive elements should not be assigned mouse or keyboard event listeners
jsx-a11y/no-noninteractive-element-interactions

✖ 1 problem (0 errors, 1 warning)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/user/donationsTable.js
    3:10  warning  'getEtherscanPrefix' is defined but never used            no-unused-vars
  151:28  warning  'setCurrentDonations' is assigned a value but never used  no-unused-vars
  154:18  warning  'setFilter' is assigned a value but never used            no-unused-vars
  191:11  warning  'copy' is assigned a value but never used                 no-unused-vars

✖ 4 problems (0 errors, 4 warnings)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/components/user/profileHeader.js
  51:11  warning  Duplicate key 'alignItems'  no-dupe-keys

✖ 1 problem (0 errors, 1 warning)

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/contextProvider/WalletProvider.js
   83:6   warning  React Hook useEffect has missing dependencies: 'initWallet' and 'localStorageUser.walletType'. Either include them or remove the
 dependency array                                               react-hooks/exhaustive-deps
  225:75  warning  Invalid typeof comparison value
                                                                valid-typeof
  280:18  warning  'sendEthersTransaction' is defined but never used
                                                                no-unused-vars
  373:6   warning  React Hook React.useMemo has missing dependencies: 'getAddressFromENS', 'login', 'sendTransaction', 'updateUser', and
'updateUserInfoOnly'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

✖ 4 problems (0 errors, 4 warnings)
  0 errors and 2 warnings potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/pages/index.js
  23:6  warning  React Hook React.useEffect has missing dependencies: 'location.state.flashMessage', 'location.state.welcome', 'popup', and
'popupShown'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

✖ 1 problem (0 errors, 1 warning)
  0 errors and 1 warning potentially fixable with the `--fix` option.

warn ESLintError: 
/Users/geleeroyale/Github/giveth-2/src/utils/index.js
  103:27  warning  Unnecessary escape character: \+  no-useless-escape
  103:80  warning  Unnecessary escape character: \+  no-useless-escape

✖ 2 problems (0 errors, 2 warnings)

success Re-building development bundle - 0.498s

geleeroyale avatar Feb 28 '21 11:02 geleeroyale

image

positonic avatar Apr 02 '21 12:04 positonic

@geleeroyale can we close this? or transfer to next?

laurenluz avatar Jun 09 '21 19:06 laurenluz