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

bradzacher commented Jan 8, 2020

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.

@typescript-eslint

This comment was marked as resolved.

Copy link

typescript-eslint bot commented Jan 8, 2020

Thanks for the PR, @bradzacher!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

bradzacher added 2 commits Jan 8, 2020
Copy link
Member

armano2 left a comment

LGTM

are you planning to add some tests for this?

@bradzacher

This comment has been minimized.

Copy link
Member Author

bradzacher commented Jan 9, 2020

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 added 3 commits Jan 13, 2020
# Conflicts:
#	packages/typescript-estree/src/create-program/shared.ts
@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
6 of 7 checks passed
6 of 7 checks passed
codecov/patch 89.47% of diff hit (target 90%)
Details
Semantic Pull Request ready to be squashed
Details
codecov/project 94.45% (-0.02%) compared to d8445d5
Details
typescript-eslint.typescript-eslint Build #20200113.9 succeeded
Details
typescript-eslint.typescript-eslint (Primary code validation and tests) Primary code validation and tests succeeded
Details
typescript-eslint.typescript-eslint (Run unit tests on other Node.js versions node_10_x) Run unit tests on other Node.js versions node_10_x succeeded
Details
typescript-eslint.typescript-eslint (Run unit tests on other Node.js versions node_8_x) Run unit tests on other Node.js versions node_8_x succeeded
Details
@bradzacher bradzacher deleted the debug-via-eslintrc branch Jan 13, 2020
Copy link
Member

armano2 left a comment

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.

This comment has been minimized.

Copy link
@armano2

armano2 Jan 13, 2020

Member

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.

This comment has been minimized.

Copy link
@armano2

armano2 Jan 13, 2020

Member
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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.