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

feat: support passing directories to deno check #20813

Closed
marvinhagemeister opened this issue Oct 6, 2023 · 10 comments · Fixed by #25001
Closed

feat: support passing directories to deno check #20813

marvinhagemeister opened this issue Oct 6, 2023 · 10 comments · Fixed by #25001
Labels
cli related to cli/ dir feat new feature (which has been agreed to/accepted) good first issue Good for newcomers

Comments

@marvinhagemeister
Copy link
Contributor

marvinhagemeister commented Oct 6, 2023

I find myself often ending up in a situation where I want to check if all types in a project are valid. Instinctively, I usually type deno check and then I'm getting an error that I didn't pass arguments. In my mind I'm thinking "ah right, so I want to type check everything in the current directory". This leads me to type deno check ., but this throws another error because directories are not supported. But shoot, I don't have any file which imports every other file in the project. So I'm not sure how to type check the whole project with one command.

I found a workaround though: If you have an extensive test suite, there is a high chance that all files in the project are imported at some point. If that's the case then running deno test is a better mechanism to type check a project than deno check, which seems odd.

Feature request:

  • Add support for passing directories to deno check
  • If no arguments are provided, use the current directory . as the default argument.
@nktpro
Copy link

nktpro commented Oct 7, 2023

Seconded. This was on my wishlist as well, such that it's consistent with deno test and deno lint.

Currently I'd have to remember to resort to bash expansion i.e. deno check **/*.ts, but that doesn't work in a non-shell environment (such as making it a deno task in deno.json)

In case it's helpful to deno maintainers, one more use case I've been using deno check for a lot is to quickly validate generated source files. For example, given a codegen target directory of gen, it's common to iterate by running deno check (and deno lint) against every (nested) .ts file in that directory until things are perfect.

@lino-levan
Copy link
Contributor

Currently I'd have to remember to resort to bash expansion i.e. deno check **/*.ts, but that doesn't work in a non-shell environment (such as making it a deno task in deno.json)

This is actually not the case. Part of why I love deno task so much is because it is a cross platform shell. Glob expansion is supported.

@lino-levan
Copy link
Contributor

I do support this proposal, and wanted to link #20278 as well, since it seems to be in a similar vein. deno check should act like deno fmt by default, I don't see a reason for it not to.

@nktpro
Copy link

nktpro commented Oct 8, 2023

Currently I'd have to remember to resort to bash expansion i.e. deno check **/*.ts, but that doesn't work in a non-shell environment (such as making it a deno task in deno.json)

This is actually not the case. Part of why I love deno task so much is because it is a cross platform shell. Glob expansion is supported.

It turned out you're absolutely right. That was added since Deno 1.34. I must have missed the changelog when it came out.

@ilovethensa
Copy link

Is this being worked on or should i(try to) implement this?

@zyx-db
Copy link

zyx-db commented Nov 10, 2023

Hey, if this is an issue that isn't currently being worked on, I would love to try and work on it myself! Please let me know if this sounds fine.

@harrysolovay
Copy link

@lino-levan any thoughts on how to proceed given the contribution offers?

@lino-levan
Copy link
Contributor

There's no need to ask before you work on something. Feel free to work on this if you want to!

@zyx-db
Copy link

zyx-db commented Nov 12, 2023

That's great! I will take a stab at it 😄 !

@zyx-db
Copy link

zyx-db commented Nov 13, 2023

Hey there, I was able to look through the source code and I believe I was able to find where the arguments are being parsed.

However, it seems like the functions/ methods being used to parse the arguments belong to different repositories, namely 'clap' and 'deno_core'. Would it be the best approach to raise these issues in those repositories? Or is there an alternative approach I may be able to look into? I would appreciate any feedback on how to proceed from here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir feat new feature (which has been agreed to/accepted) good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants