herenickname
herenickname13mo ago

Linter does not warn about lack of constructor arguments.

The vscode shows that there are no arguments, but linter does not show it as an error:
root@instance-1:~/main# deno lint src/test.ts
Checked 1 file
root@instance-1:~/main# deno lint src/test.ts
Checked 1 file
and nothing else... deno.jsonc:
{
"imports": {
"@core/": "../core/src/",
"std/": "https://deno.land/std@0.205.0/"
},

"lint": {
"include": ["src/"],
"exclude": ["src/testdata/", "data/fixtures/**/*.ts"],
"rules": {
"tags": ["recommended"],
"include": ["ban-untagged-todo", "no-console"],
"exclude": ["no-unused-vars"]
}
}
}
{
"imports": {
"@core/": "../core/src/",
"std/": "https://deno.land/std@0.205.0/"
},

"lint": {
"include": ["src/"],
"exclude": ["src/testdata/", "data/fixtures/**/*.ts"],
"rules": {
"tags": ["recommended"],
"include": ["ban-untagged-todo", "no-console"],
"exclude": ["no-unused-vars"]
}
}
}
Help me to make a correct deno.jsonc config. Thanks!
No description
7 Replies
marvinh.
marvinh.13mo ago
That's because this is a type error not a linting error. To know how many arguments a function or a class constructor receives you need to know about its type. Knowing the type requires far more knowledge than what a linter has access to. Type checks are typically done via deno check
herenickname
herenicknameOP13mo ago
I see that deno check can only process a specific file. How to check the whole folder? Is it possible to combine lint & check output? Is there an abstraction in deno for this?
marvinh.
marvinh.13mo ago
iirc you can pass a glob like deno check **/*.ts
herenickname
herenicknameOP13mo ago
after that I found my code full of undefined errors, but runtime (deno run -A src/main.ts) does not show anything about this. How to preserve runtime to strict check code before run?
marvinh.
marvinh.13mo ago
you can pass --check to deno run
herenickname
herenicknameOP13mo ago
thank you so much!
sergees
sergees13mo ago
It looks like deno check **/*.ts doesn’t respect the "exclude" from deno config file (unlike lint and fmt). Is it something expected? In my situation I have 10 sub-folders with deno/TS code and more 5 folders. I’m wondering what’s a good way to type-check those 10 folders.

Did you find this page helpful?