You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using commitlint which is using ts-node as a dep. Now somehow whenever I try to commit ts-node throws error TypeScriptCompileError Emit Skipped which is weird coz I compiled the project with tsc and it compiled succesfully.
I even tried it with just one file containing console.log please check the linked github repo
Search Terms
Emit Skipped
commitlint
Actual Behavior
Edit: just found that even after settings the rootdir in tsconfig ts-node still includes files outside from src directory, I think its a bug but I'm not sure.
Expected Behavior
should not throw compile error and emit skipped.
Must not include files outside of rootdir
ts-node uses typescript under the hood. We need to get output JS to give to node to execute it. TypeScript does not emit files that fall outside your rootDir. So when ts-node is asked for the JS code from a file, and typescript doesn't give it to us, you get the error.
transpileOnly mode avoids this. Or you can use compilerOptions overrides.
Activity
[-]Throws Emit Skipped[/-][+]Throws TypeError: commitlint.config.ts: Emit skipped[/+]cspotcode commentedon Jan 11, 2022
I see you have a config file written in
.ts, I assume something is trying to use ts-node to run it? And it's not included in your tsconfig?iamarpitpatidar commentedon Jan 11, 2022
yeah, that's the thing the github I linked has the exact same config with just one file that I am using.. but wierd that it throws error,.
about
something is trying to use ts-node to run itits commitlint as ofc the error only happens when husky runcommitlintas pre-commit hook@cspotcode do you think there is a way to fix this ?
cspotcode commentedon Jan 11, 2022
ts-node uses typescript under the hood. We need to get output JS to give to node to execute it. TypeScript does not emit files that fall outside your rootDir. So when ts-node is asked for the JS code from a file, and typescript doesn't give it to us, you get the error.
transpileOnlymode avoids this. Or you can usecompilerOptionsoverrides.https://typestrong.org/ts-node/docs/configuration
https://typestrong.org/ts-node/docs/options