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

Use empty object for invalid package json contents instead of undefined #34906

Merged
merged 2 commits into from
Nov 4, 2019

Conversation

sheetalkamat
Copy link
Member

Fixes #34726

Copy link
Member

@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

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

This changes the (intended) behavior of auto-imports when an invalid package.json is encountered—the intention was that auto-imports would not be filtered; with this change, no auto-imports from node_modules will be offered since the package.json appears to list no dependencies.

I think that’s probably ok since this is likely a transient state, but it would be a little better to pretend the package.json didn’t exist and not filter the auto-imports. Would it be difficult to fix the stack overflow but still return undefined here?

@sheetalkamat
Copy link
Member Author

@andrewbranch changed as per your feedback

Copy link
Member

@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

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

👍👍 thanks!

@sheetalkamat sheetalkamat merged commit 47ec514 into master Nov 4, 2019
@sheetalkamat sheetalkamat deleted the packageJson branch November 4, 2019 22:32
@sheetalkamat
Copy link
Member Author

@typescript-bot cherry-pick this to release-3.7
I had posted this comment on issue instead of PR :)

@typescript-bot
Copy link
Collaborator

Hey @sheetalkamat, I've opened #35006 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Nov 8, 2019
Component commits:
dfa4bc0 Use empty object for invalid package json contents instead of undefined Fixes microsoft#34726

4d035ba Behave as if package json doesnt exist in case of invalid json in package json
sheetalkamat pushed a commit that referenced this pull request Nov 8, 2019
Component commits:
dfa4bc0 Use empty object for invalid package json contents instead of undefined Fixes #34726

4d035ba Behave as if package json doesnt exist in case of invalid json in package json
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

Successfully merging this pull request may close these issues.

TSServer maximum call stack crash
3 participants