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

TSConfig include parsing throws an error on non-file paths #1060

Closed
JoshuaKGoldberg opened this issue Nov 2, 2022 · 0 comments · Fixed by #1062
Closed

TSConfig include parsing throws an error on non-file paths #1060

JoshuaKGoldberg opened this issue Nov 2, 2022 · 0 comments · Fixed by #1062
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛

Comments

@JoshuaKGoldberg
Copy link
Owner

🐛 Bug Report

  • TypeStat version: 0.6.2
  • TypeScript version: 4.8.4
  • Node version: 18.7.0

Actual Behavior

josh ~/repos/typescript-static-analysis-hidden-gems $ npm run typestat:incompleteTypes

> [email protected] typestat:incompleteTypes
> typestat --config ./src/typestat/incompleteTypes/typestat.json

Usage: typestat [options]

Options:
  -c --config [config]    path to a TypeStat config file
  -l --logfile [logfile]  path to a logfile to print detailed logs in
  -V --version            output the package version
  -h, --help              display help for command

Error: ENOTDIR: not a directory, scandir '/Users/josh/repos/typescript-static-analysis-hidden-gems/next-env.d.ts'

This is happening because include is ["next-env.d.ts", "**/*.ts", "**/*.tsx"], and TypeStat is trying to read each of those as a directory:

.flatMap((include) =>
fs.readdirSync(path.join(rootDir, include)).map((fileName) => path.join(rootDir, include, fileName)),
)

Expected Behavior

TypeStat should use the same mechanisms that TypeScript internally uses to convert TSConfig includes into a list of files.

Reproduction

JoshuaKGoldberg/typescript-static-analysis-hidden-gems@213dd04

@JoshuaKGoldberg JoshuaKGoldberg added type: bug Something isn't working :( 🐛 status: accepting prs Please, send a pull request to resolve this! 🙏 labels Nov 2, 2022
@JoshuaKGoldberg JoshuaKGoldberg changed the title TSConfig include parsing throws an error TSConfig include parsing throws an error on non-file paths Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant