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

cleanup (collections): Clean up examples, types and file structure #1116

Merged
merged 6 commits into from
Aug 10, 2021

Conversation

LionC
Copy link
Contributor

@LionC LionC commented Aug 8, 2021

This does several tedious clean up tasks in the collections module:

  • Unify all examples
    • Use ts tag for markdown code
    • Use assertEquals instead of console.assert to have actually working examples
  • Move tests into their own subfolder, as the actual folder is being browsed by users and got
    quite crowded
  • Flatten argument types. Even though Predicate and Selector read nicely, their meaning
    is not immediately clear and LSP hovers do not show their content. The types in the module are
    mostly straightforward anyways

@kt3k
Copy link
Member

kt3k commented Aug 9, 2021

@LionC Thank you for the clean-ups!

I mostly agree with these changes, but I'm not in favor of moving test files into their own folder. Other std modules put the test files next to the implementation, and in my view that flat structure is easier for the collaborators to work with because the corresponding implementations and tests are close to each other.

@LionC
Copy link
Contributor Author

LionC commented Aug 9, 2021

@LionC Thank you for the clean-ups!

I mostly agree with these changes, but I'm not in favor of moving test files into their own folder. Other std modules put the test files next to the implementation, and in my view that flat structure is easier for the collaborators to work with because the corresponding implementations and tests are close to each other.

The only problem I see with the current structure is that we explicitly allow importing single functions from this folder, which means users of the module need to navigate it.

I work on the module a lot right now, and even I have a hard time to reorientate myself at a glance when opening the folder, there is just a lot of files with similiar names directly next to each other, some being tests and some being implementations without a consistent ordering pattern (because of the default alphabetical sorting everywhere).

My opinion on this is not super strong, but I can say that working on the module and scanning the folders at a glance is already a lot nicer after moving the test files. I will leave final judgement to you and the others though :-)

@caspervonb
Copy link
Contributor

I will leave final judgement to you and the others though :-)

Test module next to the module being has been the way since the start and is the convention everywhere else so let's not randomly break from that for collections.

@LionC
Copy link
Contributor Author

LionC commented Aug 9, 2021

Done, please re-review @kt3k

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

@LionC Thanks! LGTM

@kt3k kt3k merged commit f579b51 into denoland:main Aug 10, 2021
@LionC LionC deleted the clean-up-collections branch August 23, 2021 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants