Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add no-unused-vars and await-thenable eslint rules #4242

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

usame-algan
Copy link
Member

What it solves

Resolves #4238

How this PR fixes it

  • Remove await from act
  • Start using userEvent instead of fireEvent to fix promise issues
  • Start importing act from react because of deprecation
  • Remove validate from NameInput as its not being used
  • Track "Learn more" clicks on the activity apps banner

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Sep 24, 2024

Copy link

github-actions bot commented Sep 24, 2024

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 954.46 KB (-57 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Eleven Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/address-book 26.08 KB (🟢 -15 B) 980.54 KB
/apps 50.18 KB (-1 B) 1004.63 KB
/apps/custom 41.81 KB (-1 B) 996.27 KB
/home 60.23 KB (🟡 +20 B) 1014.69 KB
/new-safe/advanced-create 35.13 KB (🟢 -15 B) 989.59 KB
/new-safe/create 34.39 KB (🟢 -15 B) 988.85 KB
/new-safe/load 16.4 KB (🟢 -11 B) 970.86 KB
/settings/notifications 27.02 KB (🟢 -14 B) 981.48 KB
/transactions 73.52 KB (🟢 -9 B) 1 MB
/transactions/history 73.48 KB (🟢 -9 B) 1 MB
/transactions/msg 29.52 KB (-1 B) 983.97 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@katspaugh katspaugh changed the title fix: Add no-unused-vars and await-thenable eslint rules chore: Add no-unused-vars and await-thenable eslint rules Sep 24, 2024
Copy link
Member

@schmanu schmanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing how much unecessary or wrong code was found with this. Def. shows its value 🚀

I think one test needs to be adjusted though.

@@ -82,7 +82,7 @@ describe('CheckWallet', () => {
;(useIsSafeOwner as jest.MockedFunction<typeof useIsSafeOwner>).mockReturnValueOnce(true)

const renderButtonWithNetworkCheck = () =>
render(<CheckWallet checkNetwork={true}>{(isOk) => <button disabled={true}></button>}</CheckWallet>)
render(<CheckWallet checkNetwork={true}>{() => <button disabled={true}></button>}</CheckWallet>)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it really be always true?
Should the disabled state not depend on the isOk?

Suggested change
render(<CheckWallet checkNetwork={true}>{() => <button disabled={true}></button>}</CheckWallet>)
render(<CheckWallet checkNetwork={true}>{(isOk) => <button disabled={!isOk}></button>}</CheckWallet>)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Pushed the fix. Now the test also makes sense again.

Copy link

github-actions bot commented Sep 24, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.23% (-0.02% 🔻)
12007/15348
🔴 Branches
58.25% (+0.02% 🔼)
3086/5298
🟡 Functions
65.31% (-0.01% 🔻)
1892/2897
🟡 Lines
79.74% (-0.03% 🔻)
10838/13591
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / index.tsx
82.35% (-8.82% 🔻)
66.67% (-16.67% 🔻)
50% (-12.5% 🔻)
83.87% (-9.68% 🔻)
🟡
... / CounterfactualForm.tsx
68.18% (-1.82% 🔻)
42.86% 66.67%
68.25% (-1.9% 🔻)

Test suite run success

1485 tests passing in 203 suites.

Report generated by 🧪jest coverage report action from 6910cf8

@usame-algan usame-algan merged commit 79b18d2 into dev Sep 25, 2024
14 of 15 checks passed
@usame-algan usame-algan deleted the extend-eslint branch September 25, 2024 09:33
@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add eslint rule for unused vars and redundant awaits
2 participants