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

fix: crash when devDependencies undefined using ts-standard #310

Merged
merged 1 commit into from
Oct 23, 2021

Conversation

Flet
Copy link
Member

@Flet Flet commented Oct 23, 2021

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[✅ ] Bug fix
[ ] New feature
[ ] Other, please explain:

What changes did you make? (Give an overview)

Problem

  • If a package.json file does not have a devDependencies property, the plugin explodes.
  • Example output when things go bad:
[Info  - 7:52:50 PM] JavaScript Standard Style server stopped.
[Info  - 7:52:51 PM] JavaScript Standard Style server is running.
(node:7171) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'ts-standard' of undefined
   at /Users/flet/.vscode/extensions/standard.vscode-standard-2.0.0/server/out/server.js:179:84
(Use `Code Helper (Renderer) --trace-warnings ...` to show where the warning was created)
(node:7171) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:7171) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:7171) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'ts-standard' of undefined
   at /Users/flet/.vscode/extensions/standard.vscode-standard-2.0.0/server/out/server.js:179:84
(node:7171) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

Fix

  • Added optional chaining operator ?. to avoid exploding when checking for ts-standard in devDependencies

Which issue (if any) does this pull request address?

  • I did not see any related open issues.

Is there anything you'd like reviewers to focus on?

  • No

@welcome
Copy link

welcome bot commented Oct 23, 2021

🙌 Thanks for opening this pull request! You're awesome.

@Flet Flet requested a review from theoludwig October 23, 2021 01:04
@theoludwig theoludwig changed the title fix crash when devDependencies does not exist fix: crash when devDependencies undefined using ts-standard Oct 23, 2021
@theoludwig theoludwig merged commit eefcc11 into master Oct 23, 2021
@theoludwig theoludwig deleted the Flet-patch-1 branch October 23, 2021 06:20
@welcome
Copy link

welcome bot commented Oct 23, 2021

🎉 Congrats on getting your first pull request landed!

@theoludwig
Copy link
Member

Thanks for your PR! @Flet 🚀

Could you review my PR for releasing 2.0.1 so we can release a new version? 😄
See: #311

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

Successfully merging this pull request may close these issues.

None yet

2 participants