Open mhegazy opened 6 years ago
I'm guessing this isn't prioritized? I'd love to be able to use checkJs
as a type lint step vs. simply IDE errors for some JS projects that can't be converted to TypeScript for organizational reasons (for now). I suppose a workaround might be to use @checkJs
directives in source files, which seems a bit cumbersome/prone to accidental exclusion.
Not sure if this is open to outside contributions, but if so, it seems like this could respect the effective include/exclude rules rather than be against node_modules
explicitly.
@apalaniuk The best contribution you could is to add to this issue. The OP is pretty detail free. I'd like to see:
If you can provide any of these, it will help move the issue along; if we can decide what to do, I think doing it will be pretty easy.
I've run into this issue and thought I could fix it with adding exclude to my jsconfig.json
+ "exclude": ["node_modules"]
I was suprised to find that tsc -p jsconfig.json
still checkes node_modules
even though exclude
is explicitely set in the jsconfig
A reproduction can be found on this commit for this git repo ( https://github.com/Raynos/fake-s3/commit/282fa39134611857759c1b6a81ccc5cf5d75ccd3 ).
Running npm run tsc
outputs 400 typescript errors for node_modules/*
but zero errors for my source code ( index.js with jsdoc ).
Any update on this?
My workaround is tsc -p jsconfig.json --maxNodeModuleJsDepth 0
.
For some reason it ignore maxNodeModuleJsDepth
in jsconfig.json but setting it 0 explicitely fixes it for me.
Thanks, do you know how to fix this through react-scripts start and build or tsconfig.json? I fixed my problem locally but my real problem is when I upload to the server
i don't compile my javascript. it's javascript, I use tsc
to "lint" my jsdoc.
My workaround is
tsc -p jsconfig.json --maxNodeModuleJsDepth 0
.
This does nothing for me. I'm guessing it's because I have directly imported a bunch of node modules with import "../node_modules/some-module/dist.js"
The --maxNodeModuleJsDepth 0
trick is what solves this issue but I think it deserves more attention.
I had a similar issue. I use the TypeScript compiler for type checking my JavaScript Project, but wanted errors in external code to be ignored, without having to modify the external files (e.g. by adding a @ts-nocheck
at the beginning).
Thanks to https://dev.to/15five/how-to-temporarily-ignore-errors-during-a-typescript-migration-doe I came across tsc-silent
(https://github.com/evolution-gaming/tsc-silent), which is a wrapper around the TypeScript compiler with a supress option.
Which in my brief test so far works for me.
Maybe that workaround is helpful for others too who find this issue.
jsconfig.json
checkJs
totrue
tsc --p ./jsconfig.json
Expected: no errors in
node_modules\*\*.js
.There is no really good fix for these issues. i would suggest not checking these files