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

feat(typescript-estree): add parserOption to turn on debug logs #1413

Merged
merged 6 commits into from Jan 13, 2020

Conversation

bradzacher
Copy link
Member

From the cli you can do DEBUG=typescript-eslint:*,eslint:* and it'll turn on all debug logging.
However, when debugging things running in an eslint IDE extension, it's hard to get debug information, which can make it really hard to trace bugs.
It's relatively easy for maintainers to go and edit the files in node_modules, but it's not really a good experience to ask issue reporters to do the same to give us logs.

This just adds the following parserOption
debugLevel?: boolean | ('typescript-eslint' | 'eslint' | 'typescript')[]
Which lets you turn on debug logging for all of the relevant modules. I opted for an array instead of a number so it's more explicit and easier to fine tune, because each of the modules can dump a tonne of logs.

@bradzacher bradzacher added the enhancement New feature or request label Jan 8, 2020
@typescript-eslint

This comment has been minimized.

Copy link
Member

@armano2 armano2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

are you planning to add some tests for this?

@bradzacher
Copy link
Member Author

The problem is that it's pretty hard to test this, as the code is buried pretty deep in the stack.
I guess I could mock the debug module and assert debug.enable is called?

@bradzacher bradzacher changed the title feat(typescript-estree): add parserOption to turn on debug logging feat(typescript-estree): add parserOption to turn on debug logs Jan 13, 2020
@bradzacher bradzacher merged commit 25092fd into master Jan 13, 2020
@bradzacher bradzacher deleted the debug-via-eslintrc branch January 13, 2020 04:57
Copy link
Member

@armano2 armano2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is few small things in doc that are no longer correct, i know that it's already merged

/*
* enable parsing JSX. For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html
/**
* The absolute path to the file being parsed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not fully true anymore, relative paths are working to they are converted to cwd + path

extraFileExtensions?: string[];

/**
* The absolute path to the file being parsed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The absolute path to the file being parsed.
* Absolute (or relative to `tsconfigRootDir`) path to the file being parsed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants