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

change: [M3-8242] - Update TypeScript to latest #10573

Conversation

bnussman-akamai
Copy link
Member

@bnussman-akamai bnussman-akamai commented Jun 12, 2024

Description πŸ“

  • Updates TypeScript to the latest version πŸ“¦
  • Performs two small code changes that were needed because this new typescript version caught some new errors β›”
  • Ignores deprecates for v5 changes πŸ”•
    • This PR will be followed up by a massive PR to fix those deprecations (there will be about ~250 errors to fix)
  • Updates some eslint packages πŸ“¦ for compatibility with this newer TypeScript version because of the following errors observed
    • Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead
    • Error while loading rule '@typescript-eslint/no-loss-of-precision': @typescript-eslint/no-loss-of-precision requires at least ESLint v7.1.0
  • Fixes some errors that now surface due to the eslint upgrade πŸ”§
  • Removes some super old Redux helpers πŸ—‘οΈ

Why ❓

  • TypeScript is super crucial to Cloud Manager's existance
  • v5.5 is going to bring a lot of nice stuff that will likely have a positive impact on Cloud Manager
    • For example, check this out

How to test πŸ§ͺ

  • Verify eslint works
    • Verify eslint works in your IDE
    • Verify the lint Github Actions jobs pass
  • Verify TypeScript works
    • Verify Typechecking works locally in your IDE
    • Verify the typecheck Github Actions job passes

As an Author I have considered πŸ€”

  • πŸ‘€ Doing a self review
  • ❔ Our contribution guidelines
  • 🀏 Splitting feature into small PRs
  • βž• Adding a changeset
  • πŸ§ͺ Providing/Improving test coverage
  • πŸ” Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • πŸ‘£ Providing comprehensive reproduction steps
  • πŸ“‘ Providing or updating our documentation
  • πŸ•› Scheduling a pair reviewing session
  • πŸ“± Providing mobile support
  • β™Ώ Providing accessibility support

@bnussman-akamai bnussman-akamai added the Dependencies Pull requests that update a dependency file label Jun 12, 2024
@bnussman-akamai bnussman-akamai self-assigned this Jun 12, 2024
@bnussman-akamai bnussman-akamai requested a review from a team as a code owner June 12, 2024 17:29
@bnussman-akamai bnussman-akamai requested review from dwiley-akamai and hkhalil-akamai and removed request for a team June 12, 2024 17:29
Copy link

github-actions bot commented Jun 12, 2024

Coverage Report: βœ…
Base Coverage: 82.76%
Current Coverage: 82.76%

@@ -227,7 +227,7 @@ export const printInvoice = async (
unit: 'px',
});

const convertedInvoiceDate = invoice.date && dateConversion(invoice.date);
const convertedInvoiceDate = dateConversion(invoice.date);
Copy link
Member Author

Choose a reason for hiding this comment

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

It's amazing this passed typechecking previously 😳

Screenshot 2024-06-12 at 2 00 09β€―PM

export const SortableTableHead = <T extends unknown>(
props: SortableTableHeadProps<T>
) => {
export const SortableTableHead = <T,>(props: SortableTableHeadProps<T>) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

eslint didn't like extends unknown which makes sense to me because extends unknown is useless

@@ -32,6 +32,7 @@ export const RouteAccordion = ({ configIndex, route, routeIndex }: Props) => {
sx={{ backgroundColor: '#f4f5f6', paddingLeft: 1, paddingRight: 1.4 }}
>
{/* TODO ACLB: Implement RulesTable */}
<>Todo</>
Copy link
Member Author

Choose a reason for hiding this comment

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

The Accordion props types requires children. This is fine because this code isn't customer facing.

Copy link
Member Author

Choose a reason for hiding this comment

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

I cleaned up some old Redux code because it isn't referenced elsewhere in the app and contained some eslint errors

Copy link
Contributor

Choose a reason for hiding this comment

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

Beautiful! Love to see dead code removed from the project.

Comment on lines +39 to +40
"ignoreDeprecations": "5.0",
"suppressImplicitAnyIndexErrors": true,
Copy link
Member Author

Choose a reason for hiding this comment

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

suppressImplicitAnyIndexErrors will be deprecated in v5.5 so the next PR will be removing these two lines and fixing all 250 of the errors this causes 😬

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. This will also be an improvement for type safety!

Copy link
Contributor

@hkhalil-akamai hkhalil-akamai left a comment

Choose a reason for hiding this comment

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

Thanks for taking on this update!

βœ… CI passing
βœ… Typescript and eslint working in IDE
βœ… No type errors

Comment on lines +39 to +40
"ignoreDeprecations": "5.0",
"suppressImplicitAnyIndexErrors": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. This will also be an improvement for type safety!

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

TS works, confirmed it's on Version 5.4.5 βœ…
eslint works βœ…
GitHub Actions jobs pass βœ…
Local typechecking βœ…

@@ -34,73 +34,6 @@ export type ThunkDispatch = _ThunkDispatch<ApplicationState, undefined, Action>;

export type MapState<S, O> = _MapStateToProps<S, O, ApplicationState>;

export interface HasStringID {
Copy link
Contributor

Choose a reason for hiding this comment

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

@bnussman Thanks for keeping the codebase clean πŸ‘

@bnussman-akamai bnussman-akamai merged commit 22026a3 into linode:develop Jun 14, 2024
18 checks passed
nikhagra-akamai pushed a commit to nikhagra-akamai/manager that referenced this pull request Jun 19, 2024
* update typescript to latest and ignore deprecations

* Added changeset: Update TypeScript to latest

* fix eslint errors and remove unused code

---------

Co-authored-by: Banks Nussman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Pull requests that update a dependency file Ready for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants