-
-
Notifications
You must be signed in to change notification settings - Fork 322
fix: isFile/isDirectory edge cases #635
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
fix: isFile/isDirectory edge cases #635
Conversation
|
Thanks @markmartirosian. Yeah let's try a try-catch, this feels a bit redundant. |
|
@webpro done |
webpro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant try-catch only at the new call-site, here it's not necessary with the no-throw options
|
@webpro isn't this scenario general? Here's an illustration, '.profile' is a regular file. > const fs = require('fs')
> fs.statSync('.profile/excludes', { throwIfNoEntry: false })
Uncaught Error: ENOTDIR: not a directory, stat '.profile/excludes'
at Object.statSync (node:fs:1659:25) {
errno: -20,
code: 'ENOTDIR',
syscall: 'stat',
path: '.profile/excludes'
} |
|
Isn't it odd, are we being lied to by Then we could just do without this option? |
|
@webpro yes very unexpected, I'm on
|
|
@webpro made the changes |
|
Thanks @markmartirosian! Good stuff. |
|
🚀 This pull request is included in v5.17.0-canary.0. See Release 5.17.0-canary.0 for release notes. Using Knip in a commercial project? Please consider sponsoring me. |

Closes #634