-
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
Code and interface improvements after enabling some eslint recommended rules requiring type checking #6325
Code and interface improvements after enabling some eslint recommended rules requiring type checking #6325
Conversation
…date @types/react-dom to fixes 26 more lint errors. 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
…g unbound-method warning
error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises
error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises
…lls. error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises
🦋 Changeset detectedLatest commit: c901bf2 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 |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Thanks for taking the time to add these changes @ngbrown! 🙏 However, I'm going to close this in favor of @JoshuaKGoldberg's #6248. |
Hi @MichaelDeBoey I understand my changes in Should I open a separate pull request with just the code changes? Should I submit several pull requests with different groups of changes? I put in three |
@ngbrown I'm sorry, I thought all of them were related to adding the internal ESLint ruleset If not, could you create separate PRs for those changes please? |
@MichaelDeBoey I was using the eslint ruleset as the "test" to drive the changes. Sorry if that was confusing. |
Summary of changes
this: void
to functions in theSessionStorage
andSessionIdStorageStrategy
interfaces so destructuring is correctly part of the contract.void
operator to Promises that are not being awaited.internal-type-checked.js
andrules/type-checked.js
toremix-eslint-config
to handle typescript-eslint rules that require type information and using the@typescript-eslint/parser
.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 therenderToPipeableStream()
function definition, so the first half is solved.This pull request is to address the changes needed in Remix. At the same time, I tried to improve code quality by addressing some of the issues raised when enabling the type checked linting rules.
Adding
this: void
could subtly change the contract for external libraries returningSessionStorage
, so it would be good to get this in before Remix v2.I tried my best to incorporate the rules from
plugin:@typescript-eslint/recommended-requiring-type-checking
in a way that seemed consistent with the other rules, but I'm open to suggestions. Running these rules requires more memory from the node process and may take longer.I could also split out the code changes from the linting changes and have this pull request just be the code improvements.
Testing Strategy: