Skip to content

Commit

Permalink
Bugfixes and cleanup for the fs-provider package (#123)
Browse files Browse the repository at this point in the history
Hi,

I have spent some time with the fs-provider package. While doing that, I
have found some small Bugs and a many small code smells. Because of
that, I have decided to write some cleanups for the code. Here is a PR
with all of my cleanups.

Sorry for the many changes. I hope you appreciate the work. My goal was
to keep the logic as is (except for bugs) and only change syntax and
documentation.

Feel free to contact me if you have any questions about my code. Also,
feel free to reject this PR if you feel uncomfortable with these
changes.

Best wishes and thank you for the cool project
Kaladum

Here is an overview of the things I have changed:

- Organisation
   - Rename FileEntry.js to FSEntry.js to match the FSEntry type name
- Bugs
   - Fix missing await calls on some promises in async functions
- Fix getFile | findFile | findFileInRoots potentially returning
directories (also fixes many places where directory return values would
have been used as files)
- Fix empty directories being loaded every time (the check has
interpreted empty directories as unloaded directories)
   - Fix findFile possibly using files as directories
- Documentation
    -  Fix wrong JSDoc type declarations
- Split FSEntry into FSFileEntry and FSDirectoryEntry to clarify type
usages
    - Add many additional type declarations
    - Add some todo comments
- Syntax
   - Change let variable declarations to const when possible
   - Change some unintuitive variable names
   - Change promise .then chains to simple await calls
   - Change for i to for of loops when possible
   - Change || to ?? to use default values for null/undefined values
   - Move variables to a smaller scope when possible
   -  Fix minor format issues
  • Loading branch information
Kaladum authored Oct 16, 2024
1 parent 107459a commit 6b6a608
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 147 deletions.
Loading

0 comments on commit 6b6a608

Please sign in to comment.