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

First steps towards enabling TypeScript strict mode #826

Merged
merged 9 commits into from
Jan 18, 2022
Merged

Conversation

seancolsen
Copy link
Contributor

@seancolsen seancolsen commented Nov 17, 2021

Works towards fixing #619 (but leaves much to be done later)

Done

  • Fix lots of error that appear when strict mode is on.
  • Leave strict mode off for now. We'll turn it on in a later PR.
  • Use undefined instead of null.
  • Target the low-hanging-fruit, ignoring TS strict errors that require more thought and carful testing.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the master branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@seancolsen
Copy link
Contributor Author

@pavish Here's a quick beginning to the process of making our typing more strict.

Making these changes across the codebase will be easy. We just need some clarity on on how to deal with null vs undefined. The diff in 1776359 will give you a sense of the kinds of changes we'll need to make. In lots of these scenarios, we can choose to resolve ambiguity towards null or towards undefined. I'd like to get some clarity on a general pattern to follow before continuing. Please weigh in within the discussion.

@pavish
Copy link
Member

pavish commented Nov 17, 2021

@seancolsen I've responded to the discussion. My preference would be to use undefined and only use null when serialization is required.

@seancolsen seancolsen changed the title Enable TypeScript strict mode First steps towards enabling TypeScript strict mode Dec 23, 2021
@seancolsen seancolsen marked this pull request as ready for review December 23, 2021 16:40
@seancolsen seancolsen requested a review from a team December 23, 2021 16:40
@seancolsen
Copy link
Contributor Author

@pavish this is ready for review now.

I kept this same PR in-place but stripped out all the complex changes, leaving only the simple ones that we should be safe to merge now, with strict mode off.

I still have the rest of my changes locally and will build another PR with them later to continue working towards closing #619.

@pavish pavish self-assigned this Dec 23, 2021
@kgodey kgodey added the pr-status: review A PR awaiting review label Dec 24, 2021
@pavish
Copy link
Member

pavish commented Jan 14, 2022

@seancolsen Could you please update this PR to resolve the merge conflicts? I'd like to merge this in before the other current open PRs at the time of this comment.

Copy link
Member

@pavish pavish left a comment

Choose a reason for hiding this comment

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

@seancolsen The PR looks good for the major part.

There is one major bug that needs to be fixed: Add schema modal does not open as mentioned in #826 (comment). Once this bug is fixed, we can merge this PR.

mathesar_ui/src/pages/schemas/Schemas.svelte Outdated Show resolved Hide resolved
mathesar_ui/src/pages/schemas/AddEditSchema.svelte Outdated Show resolved Hide resolved
The `isEditMode` is superfluous because is can be computed from the
value of `AddEditSchema`.
@seancolsen
Copy link
Contributor Author

@pavish ready for re-review

@codecov-commenter
Copy link

Codecov Report

Merging #826 (ce117aa) into master (b817587) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #826   +/-   ##
=======================================
  Coverage   93.29%   93.29%           
=======================================
  Files          86       86           
  Lines        3161     3161           
=======================================
  Hits         2949     2949           
  Misses        212      212           
Flag Coverage Δ
pytest-backend 93.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b817587...ce117aa. Read the comment docs.

@pavish
Copy link
Member

pavish commented Jan 18, 2022

@seancolsen Looks good to me.

@pavish pavish enabled auto-merge January 18, 2022 22:21
@pavish pavish merged commit 8d92794 into master Jan 18, 2022
@pavish pavish deleted the 619_ts_strict branch January 18, 2022 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants