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

--doctor option logs advice to help with project configuration #1203

Open
Tracked by #1504
cspotcode opened this issue Jan 28, 2021 · 2 comments
Open
Tracked by #1504

--doctor option logs advice to help with project configuration #1203

cspotcode opened this issue Jan 28, 2021 · 2 comments

Comments

@cspotcode
Copy link
Collaborator

Desired Behavior

When invoked with new --doctor / "doctor" / TS_NODE_DOCTOR option, will eagerly log verbose advice about project configuration.

For example, if using a "target" option that is (partially) incompatible with your node version, will log a block of text warning about the incompatibilities.

Can also register an error handler that augments recognized errors with additional help text. For example, can detect when errors may be fixed by --files

Can propose moving options into tsconfig file.

Can detect unrecognized tsconfig.ts-node options.

Can detect unrecognized CLI flags.

Can point out when files are being loaded as ESM and you're not using the ESM loader.

Is this request related to a problem?

User confusion. I wonder if something like this can help.

Alternatives

More docs

@cspotcode
Copy link
Collaborator Author

Could we combine this with the existing logging, perhaps have --doctor enable a subset of log messages?

The debug module supports wildcard matching of a DEBUG environment variable, so you can create namespaced categories of logging. For example

DEBUG=ts-node:* ts-node ./index.ts # enables all ts-node debug logging
DEBUG=* ts-node ./index.ts # enables all debug logging for all libraries that use the debug module
DEBUG=ts-node:doctor ts-node ./index.ts # enables only "doctor" logs

Could we do something similar, perhaps backwards-compatible with our current TS_NODE_DEBUG env var?

DEBUG=ts-node:warn-suggestions ts-node ./index.ts # enable all debug messages that warn and suggest configuration fixes

@cspotcode cspotcode changed the title --doctor option logs unsolicited advice to help with project configuration --doctor option logs advice to help with project configuration Mar 15, 2021
@cspotcode
Copy link
Collaborator Author

Dunno why I said the advice was unsolicited. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant