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

Refactor to improve types for block-* rules #5426

Merged
merged 1 commit into from Jul 27, 2021

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Jul 27, 2021

Which issue, if any, is this issue related to?

Related to #4496
(see also #5418)

Is there anything in the PR that needs further explanation?

This change removes // @ts-nocheck from the block-* rules.
In addition, it improves the types of some utilities.

This change removes `// @ts-nocheck` from the `block-*` rules.
In addition, it improves the types of some utilities.
if (!hasBlock(statement)) {
return false;
return '';
Copy link
Member Author

Choose a reason for hiding this comment

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

[note] I don't know why this function has returned a boolean, but it seems to make sense that it returns a string instead.

For example, it appears returning a boolean is incorrect at the following place, but errors never occur.
Perhaps, it has no problems because of calling hasBlock() before blockString().

if (!hasBlock(statement) || hasEmptyBlock(statement)) {

source: blockString(statement),

@ybiquitous ybiquitous marked this pull request as ready for review July 27, 2021 14:57
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

It's great to see the quality of the code base improving with these refactors!

@jeddy3 jeddy3 changed the title Improve types for block-* rules Refactor to improve types for block-* rules Jul 27, 2021
@jeddy3 jeddy3 merged commit 2fed08b into v14 Jul 27, 2021
@jeddy3 jeddy3 deleted the improve-types-for-block-rules branch July 27, 2021 16:17
@ybiquitous
Copy link
Member Author

@jeddy3 Thank you so much for the quick review! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants