What does deno lint do, if not type check?
Maybe I'm misunderstanding this, but I see in my IDE that there's a type problem. If I run deno lint on that directory, I'd expect it to complain about it, but it doesn't. See screenshot. Also, this is my attempt at adding Deno 2 to a project, and seenig what I can remove. I expected to be able to remove eslint and tsc type check, but doesn't seem like I can, unless I'm misunderstanding.
13 Replies
deno lint
statically analyzes the code for common problems - it's equivalent to eslint
deno check
will typecheck your code just like tsc
doesgotcha; I guess I can't easily add
deno check
to an old project due to needing imports to explicitly have ".ts"
extensions
Thanks, that helps!Try adding
deno.json
file with { "unstable": ["sloppy-imports"] }
I think it should work thenYeah that seems to work. I can't seem to get jest types working, or any node types. I copiied over some of the tsconfig to deno.json, but it's not helping:
So why wouldn’t deno check work like tsc noEmit?
Unfortunately
types
setting is currently not supported. You'll need to supply // @deno-types="npm:DefinitelyTyped/jest"
pragma comment in the relevant file
What do you mean?that seems to have worked
I only needed to add the @deno-types to one file
not all test files
the declaration files are now a bit of a problem. I think I'm going to leave them as
^ And I'll just ignore them for linting
I need it for testing, but deno lint complains with:
error[no-var]: var
keyword is not allowed.
--> /dev/typewritesomething/src/global.d.ts:5:1
|
5 | declare var process: NodeJS.Process
| ^^^^^^^
docs: https://lint.deno.land/rules/no-var
Yeah, that should do the job
Ah you can also exclude it from being linted, using
lint.exclude
propertyThanks for your help @bartlomieju !
@bartlomieju I've seen this a few times now, and I have no idea when/why it happens:
TS2304 [ERROR]: Cannot find name 'Date'.This is happening now in deno check
Ah you probably only have
dom
in libs setting right?yes
but deno check was working fine before
if I do git checkout HEAD~1, my previous commit works fine
now it's complaining:
error: TS2318 [ERROR]: Cannot find global type 'Array'.
TS2552 [ERROR]: Cannot find name 'Boolean'. Did you mean 'GLboolean'?
TS2318 [ERROR]: Cannot find global type 'CallableFunction'.
Yeah - so in
libs
setting you need to specify ["deno.ns", "dom"]
And it should work correctlynow it's complaining about:
declare var process: NodeJS.Process;
error: TS2503 [ERROR]: Cannot find namespace 'NodeJS'this was working last commit though; I may just have to try to chanage things one by one Think I resolved this with:
/// <reference types="npm:@types/node" />still weird
@dsherret is there a better way to do it?