-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
refactor(remix-server-runtime): expose SessionStorage
's methods as arrow functions
#6330
refactor(remix-server-runtime): expose SessionStorage
's methods as arrow functions
#6330
Conversation
error Avoid referencing unbound methods which may cause unintentional scoping of `this`. If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead @typescript-eslint/unbound-method
🦋 Changeset detectedLatest commit: 45ac70c The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
this: void
to session methods that are commonly destructuredthis: void
to methods that are commonly destructured
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use arrow functions instead, as @JoshuaKGoldberg suggested in #6330 (comment)
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
this: void
to methods that are commonly destructured1c59001
to
45ac70c
Compare
SessionStorage
's methods as arrow functions
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Summary of changes
This is just the relevant parts of the code changes from #6325 instead of also tackling eslint-config changes.
SessionStorage
interface as arrow functions so destructuring is correctly part of the contract.Details
I attempted to add the typescript-eslint rules contained in "plugin:@typescript-eslint/recommended-requiring-type-checking" to a Remix based project and came across two common code issues:
and then on:
Both of these cause an
unbound-method
error:This error needed to be taken care of by the type definitions provided by the libraries.
@types/react-dom
v18.2.4 now includesthis: void
in the functions returned fromrenderToPipeableStream()
, so the first half is solved.This pull request is to address the changes needed in Remix.
This could subtly change the contract for external libraries returning
SessionStorage
, so it would be good to get this in before Remix v2.Testing Strategy:
Also tested on a Remix project with eslint and "plugin:@typescript-eslint/recommended-requiring-type-checking" enabled.