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

Add Tsc lint #130

Closed
wants to merge 20 commits into from
Closed

Add Tsc lint #130

wants to merge 20 commits into from

Conversation

Duddino
Copy link
Member

@Duddino Duddino commented May 11, 2023

Abstract

Add typescript linting. It takes type information from jsdoc comments, or is able to deduce it itself
For instance:

function test(hi) {
	return Number.parseInt(hi);
}

Will automatically mark the function as test(hi: any): number.
Added @typescript-eslint/no-floating-promises, the lint will now catch non awaited promises. If the behavior is intentional, .then(()=>{}) can be used.

@Duddino Duddino self-assigned this May 11, 2023
@Duddino Duddino added the Documentation Improvements or additions to documentation label May 11, 2023
Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

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

The changes generally look good - nice cleanup! Only one nit, applying to a comment.

However, on a clean dev build, getting a runtime error!

# After switching from Master to #130
npm ci
npm run dev

image

scripts/mempool.js Outdated Show resolved Hide resolved
@Duddino
Copy link
Member Author

Duddino commented May 13, 2023

I encountered that bug in #121 but forgot about it. If we look at the code (in master) we are importing the wallet first and loading the network after that, it only worked because the wallet code was async and the settings code wasn't (and we weren't awaiting), since the scheduler waits for the tick to finish it would execute after the network and work. This is the reason I added no-floating-promises, so we can't have these confusing things that break when you make the function async

JSKitty
JSKitty previously approved these changes May 14, 2023
Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

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

tACK e0fb36d, working now - no errors, the extra hardened typing will certainly help prevent many future MPW bugs, great job!! 💜 💪

Liquid369
Liquid369 previously approved these changes May 23, 2023
Copy link

@Liquid369 Liquid369 left a comment

Choose a reason for hiding this comment

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

tACK 27cf487

Went through this a few times! I did not really encounter any issue gg LGTM

@Duddino
Copy link
Member Author

Duddino commented Dec 14, 2023

Closing as stale

@Duddino Duddino closed this Dec 14, 2023
@Duddino Duddino added the Stale Old and unmaintained. label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation Stale Old and unmaintained.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants