essential-eth icon indicating copy to clipboard operation
essential-eth copied to clipboard

Fix all eslint warnings

Open dawsbot opened this issue 3 years ago • 6 comments

Can be found via npm run lint

Screen Shot 2022-08-05 at 8 32 14 PM

dawsbot avatar Aug 06 '22 02:08 dawsbot

I want to take it.

erum-hassan avatar Aug 08 '22 01:08 erum-hassan

Go for it @erum-hassan ! 🙏

dawsbot avatar Aug 08 '22 16:08 dawsbot

Hey @erum-hassan , any updates on this?

dawsbot avatar Sep 12 '22 18:09 dawsbot

Hey @dawsbot I was going to knock this one out for you. It's seems like you got must of the lint issues. There are only these remaining that all come from this file: https://github.com/dawsbot/essential-eth/blob/ae50d17a1040c46c7149e9ff585dce8c9e65dfc9/src/providers/test/json-rpc-provider/get-fee-data.test.ts

/Users/jacobfirek/Documents/Projects/essential-eth/essential-eth/src/providers/test/json-rpc-provider/get-fee-data.test.ts
  16:7  warning  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  19:5  warning  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  21:7  warning  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  24:5  warning  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  26:7  warning  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  29:5  warning  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  31:7  warning  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment

I have thought of 3 solutions:

  • Add an exception to the lint rules for @ts-ignore.
  • set a default value incase of null.
  • Use the ! non-null assertion which would suppress the original warning, but throw a new warning warning Forbidden non-null assertion

Which would you like me to do or would you like to see this fixed in another way?

jtfirek avatar Apr 05 '23 22:04 jtfirek

Thanks for the detailed thoughts here @jtfirek - unfortunately I think the design of these tests is flawed at a big level because they are so dependent upon both ethers and having network access.

I'm hoping to provide a proper refactor to tests like this using mocks so that it's no-longer network-dependent and flaky. Do you have experience with mocking?

dawsbot avatar Apr 06 '23 20:04 dawsbot

I do not, but I'll learn it! I will put #201 on my todo list @dawsbot

jtfirek avatar Apr 06 '23 22:04 jtfirek