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

globbing support when type checking #24668

Closed
FND opened this issue Jul 22, 2024 · 9 comments · Fixed by #25001
Closed

globbing support when type checking #24668

FND opened this issue Jul 22, 2024 · 9 comments · Fixed by #25001
Labels
bug Something isn't working correctly cli related to cli/ dir good first issue Good for newcomers

Comments

@FND
Copy link

FND commented Jul 22, 2024

As far as I can tell, deno check expects a file as entry point; it does not support targeting directories (failing silently; i.e. this limitation isn't obvious). Globbing might be used instead, but appears to be unsupported - unlike with adjacent commands (cf. #19102), which seems like a confusing inconsistency.

Thus projects without an obvious entry point covering all code (e.g. libraries with independent modules) need an out-of-band solution for module discovery, often resulting in shell scripts with limited portability.

Ideally, check should work just like lint, fmt and test:

$ deno lint "./src/**/*.ts"
$ deno check "./src/**/*.ts"

Perhaps it should also support targeting directories, though that might be a separate issue.

(For additional context, I've started documenting the way I've come to appreciate Deno as general-purpose tooling even beyond Deno-as-runtime projects, notably for client-side code.)

Version: Deno 1.45.2

@lucacasonato lucacasonato added bug Something isn't working correctly cli related to cli/ dir good first issue Good for newcomers labels Aug 2, 2024
@yazan-abdalrahman
Copy link
Contributor

@lucacasonato @FND
can you explain the problem more, I'm still not sure I understand the requirement.

@marvinhagemeister
Copy link
Contributor

@yazan-abdalrahman The deno check command doesn't do glob expansion. The issue is asking for supporting glob expansion there. Right now it treats glob paths as a literal file argument, which is wrong.

deno check "**/*.ts"
error: Module not found "file:///Users/marvinh/dev/denoland/docs/**/*.ts".

Instead, it should type check all files that match the glob pattern. In this case that would be all files in the current directory and below that end with .ts.

@yazan-abdalrahman
Copy link
Contributor

yazan-abdalrahman commented Aug 12, 2024

@marvinhagemeister

ok I got it,
image

But for "lint" I think this wrong?
it's need deno.json
or it's another issue?

@marvinhagemeister
Copy link
Contributor

That's odd, I'm not getting the error for lint on my mac. Maybe it's an OS issue?

@yazan-abdalrahman
Copy link
Contributor

That's odd, I'm not getting the error for lint on my mac. Maybe it's an OS issue?

image
its needs some configuration <deno.json> ?

@yazan-abdalrahman
Copy link
Contributor

@marvinhagemeister
@lucacasonato

image

that's correct ?

@marvinhagemeister
Copy link
Contributor

Lgtm. The error is expected as using JSX is only valid inside .jsx/.tsx files.

@yazan-abdalrahman
Copy link
Contributor

Lgtm. The error is expected as using JSX is only valid inside .jsx/.tsx files.

yes
image

@FND
Copy link
Author

FND commented Aug 24, 2024

Looking good with Deno 1.46 - thank you all!

FND added a commit to FND/prepitaph that referenced this issue Oct 2, 2024
shell script for module discovery is no longer necessary, as Deno v1.46
now supports globbing when type checking:
denoland/deno#24668
FND added a commit to FND/ddrpz that referenced this issue Feb 5, 2025
we're including reusable library functionality for client apps in this
repo (limited to crypto for now), but client-side environments require
slightly different settings for testing and type checking (at least if
we wanna remain strict) - so unfortunately, we need non-trivial scripts
to make that work

in the process, simplified type checking as Deno now supports globbing
throughout (see denoland/deno#24668)
FND added a commit to FND/ddrpz that referenced this issue Feb 6, 2025
we're including reusable library functionality for client apps in this
repo (limited to crypto for now), but client-side environments require
slightly different settings for testing and type checking (at least if
we wanna remain strict) - so unfortunately, we need non-trivial scripts
to make that work

in the process, simplified type checking as Deno now supports globbing
throughout (see denoland/deno#24668)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants