Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Tech debt 1265: Enable strictNullChecks TS compiler option#1301

Merged
mmv08 merged 41 commits intodevelopmentfrom
1265-strictNullChecks
Sep 4, 2020
Merged

Tech debt 1265: Enable strictNullChecks TS compiler option#1301
mmv08 merged 41 commits intodevelopmentfrom
1265-strictNullChecks

Conversation

@mmv08
Copy link
Contributor

@mmv08 mmv08 commented Aug 28, 2020

This PR:

@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Aug 28, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 77 0
Ignored 6 N/A
  • Result: ✅ success

  • Annotations: 77 total


[warning] @typescript-eslint/explicit-module-boundary-types

Require explicit return and argument types on exported functions' and classes' public class methods


[warning] @typescript-eslint/no-non-null-assertion

Disallows non-null assertions using the ! postfix operator


Report generated by eslint-plus-action

@github-actions
Copy link

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 3 0
Warnings 15 0
Ignored 1 N/A
  • Result: ❌ failure

  • Annotations: 18 total


[failure] @typescript-eslint/no-unused-vars

Disallow unused variables


[warning] @typescript-eslint/explicit-module-boundary-types

Require explicit return and argument types on exported functions' and classes' public class methods


Report generated by eslint-plus-action

@mmv08 mmv08 marked this pull request as ready for review September 3, 2020 10:36
@mmv08 mmv08 requested a review from dasanra September 3, 2020 10:37
@ghost
Copy link

ghost commented Sep 3, 2020

Travis automatic deployment:
https://pr1301--safereact.review.gnosisdev.com/app

@ghost
Copy link

ghost commented Sep 3, 2020

Travis automatic deployment:
https://pr1301--safereact.review.gnosisdev.com/app

const nonce = useSelector(safeNonceSelector)
const modules = useSelector(safeModulesSelector)
const moduleData = getModuleData(modules) ?? null
const moduleData = modules ? getModuleData(modules) ?? null : null
Copy link
Collaborator

Choose a reason for hiding this comment

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

So getModuleData can return undefined?

Do we want to control this inside the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you mean? the return type is correct

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was just wondering if we should make the function to directly return null when result is undefined. Is not a big deal because it's only used here.
I feel that the logic to call the function gets a bit more complex to read just to ensure the result is null

Copy link
Contributor Author

@mmv08 mmv08 Sep 4, 2020

Choose a reason for hiding this comment

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

As I said I didn’t dive deep into the logic, my goal was to enable the option and make project compile without changing the logic/returned values

Copy link
Collaborator

Choose a reason for hiding this comment

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

As this method is only used here yet I would add the logic inside. Afterwards could be more complicated. But I leave the decision in your hands.

@ghost
Copy link

ghost commented Sep 3, 2020

Travis automatic deployment:
https://pr1301--safereact.review.gnosisdev.com/app

const nonce = useSelector(safeNonceSelector)
const modules = useSelector(safeModulesSelector)
const moduleData = getModuleData(modules) ?? null
const moduleData = modules ? getModuleData(modules) ?? null : null
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was just wondering if we should make the function to directly return null when result is undefined. Is not a big deal because it's only used here.
I feel that the logic to call the function gets a bit more complex to read just to ensure the result is null

@ghost
Copy link

ghost commented Sep 4, 2020

Travis automatic deployment:
https://pr1301--safereact.review.gnosisdev.com/app

@ghost
Copy link

ghost commented Sep 4, 2020

Travis automatic deployment:
https://pr1301--safereact.review.gnosisdev.com/app

1 similar comment
@ghost
Copy link

ghost commented Sep 4, 2020

Travis automatic deployment:
https://pr1301--safereact.review.gnosisdev.com/app

@dasanra
Copy link
Collaborator

dasanra commented Sep 4, 2020

Big work adding types here!

@mmv08 mmv08 merged commit bfed967 into development Sep 4, 2020
@mmv08 mmv08 deleted the 1265-strictNullChecks branch September 4, 2020 12:03
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2020
dispatch(fetchCurrencyRate(safeAddress, selectedCurrency))
break
}
case SET_CURRENCY_RATE:
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @mikheevm, want to ask you why did you removed this. Because while I was working on this ticket I found that this was part of the problem. Also, now the storage of the selected currency is broken, for example, if you choose EUR as your preferred currency and reload the page, you will see USD again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, as I communicated before we don't need to store the balances locally as the rates frequently change and it's fine to fetch this again on app startup. I didn't expect that SET_CURRENCY_RATE action is capable of storing currently selected currency, I thought SET_CURRENCY_CURRENCY action was responsible for that because that's literally the action name. Sorry for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem! thanks for the clarification :)

@dasanra dasanra restored the 1265-strictNullChecks branch September 9, 2020 14:56
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.

Enable strictNullChecks option for typescript configuration

3 participants