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

Use strictNullChecks in matrix-react-sdk #21967

Closed
54 tasks done
Tracked by #23542
novocaine opened this issue Apr 28, 2022 · 3 comments · Fixed by matrix-org/matrix-react-sdk#11194
Closed
54 tasks done
Tracked by #23542

Use strictNullChecks in matrix-react-sdk #21967

novocaine opened this issue Apr 28, 2022 · 3 comments · Fixed by matrix-org/matrix-react-sdk#11194
Assignees
Labels

Comments

@novocaine
Copy link
Contributor

novocaine commented Apr 28, 2022

Your use case

https://www.typescriptlang.org/tsconfig#strictNullChecks

This will reduce the number of runtime errors caused by unexpected null and undefined values by disallowing them as a value unless explicitly permitted.

Related: matrix-org/matrix-js-sdk#2112

Tasks

  1. A-Developer-Experience A-Testing T-Enhancement
    weeman1337
  2. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  3. A-Developer-Experience A-Testing T-Enhancement
    florianduros
  4. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  5. A-Developer-Experience A-Testing T-Enhancement
    kerryarchibald
  6. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  7. A-Developer-Experience A-Testing T-Enhancement
    kerryarchibald
  8. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  9. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  10. A-Developer-Experience A-Testing T-Enhancement
    weeman1337
  11. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  12. A-Developer-Experience A-Testing T-Enhancement
    kerryarchibald
  13. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  14. A-Developer-Experience A-Testing T-Enhancement
    weeman1337
  15. A-Developer-Experience A-Testing T-Enhancement
    kerryarchibald
  16. A-Developer-Experience T-Enhancement
    kerryarchibald
  17. A-Developer-Experience A-Testing O-Uncommon S-Tolerable T-Task
    kerryarchibald
  18. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  19. A-Developer-Experience A-Testing T-Enhancement
    weeman1337
  20. A-Developer-Experience A-Testing T-Enhancement
    weeman1337
  21. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  22. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  23. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  24. A-Developer-Experience A-Testing T-Enhancement
    alunturner
  25. A-Developer-Experience
    kerryarchibald
  26. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  27. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  28. A-Developer-Experience A-Testing T-Enhancement
    kerryarchibald
  29. A-Developer-Experience A-Testing T-Enhancement
    weeman1337
  30. A-Developer-Experience O-Uncommon S-Tolerable T-Enhancement
    kerryarchibald
  31. A-Developer-Experience A-Testing T-Task
  32. A-Developer-Experience A-Testing T-Enhancement
    alunturner
  33. A-Developer-Experience A-Testing T-Task
    alunturner
  34. A-Developer-Experience A-Testing T-Task
    t3chguy
  35. A-Developer-Experience A-Testing T-Task
    weeman1337
  36. A-Developer-Experience A-Testing T-Enhancement
    t3chguy
  37. A-Developer-Experience A-Testing T-Enhancement
  38. A-Developer-Experience A-Testing T-Enhancement
    weeman1337
  39. A-Developer-Experience A-Testing T-Enhancement
    alunturner
  40. A-Developer-Experience O-Uncommon S-Tolerable
    alunturner
  41. kerryarchibald

Have you considered any alternatives?

No response

Additional context

No response

@MadLittleMods
Copy link
Contributor

MadLittleMods commented May 6, 2022

We currently have 5738 errors when enabling strictNullChecks on matrix-react-sdk.

It would be nice to start using this for all of our new code and only apply strictNullChecks to the changes in the PR (from the git diff). We can run Typescript against the files that changed and filter the errors/warnings to only the line numbers that changed.

Looks like there are some options for ESLint which we could base off of:

For staged files:


Alternatively, we could add an extra assertion that the the number of strictNullChecks can't go up from the number on develop which means you have to fix any new code introduced.

@novocaine
Copy link
Contributor Author

Thanks @MadLittleMods, that seems like a great approach.

If you're interested in helping working through that backlog .. we could use as many hands as we can get to chip away at it

@t3chguy
Copy link
Member

t3chguy commented Feb 24, 2023

Things remaining:

Found 18 errors in 9 files.

Errors  Files
     1  ../matrix-js-sdk/src/client.ts:7235
     1  src/components/structures/InteractiveAuth.tsx:113
     4  src/components/structures/RoomView.tsx:1102
     1  src/components/structures/TimelinePanel.tsx:650
     1  src/components/views/dialogs/BaseDialog.tsx:97
     1  src/components/views/dialogs/ScrollableBaseModal.tsx:46
     3  src/components/views/spaces/SpaceTreeLevel.tsx:107
     2  src/Lifecycle.ts:675
     4  src/Searching.ts:488

@t3chguy t3chguy pinned this issue May 10, 2023
@t3chguy t3chguy unpinned this issue May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants