Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Handle TS exceptions in no-string-based-x rules #860

Merged
merged 3 commits into from
May 17, 2019

Conversation

IllusionMH
Copy link
Contributor

@IllusionMH IllusionMH commented May 12, 2019

PR checklist

Overview of change:

This PR does two things:

  1. Defers type check to the moment when potential violation found.
  2. Wraps all calls to typeChecker.getTypeAtLocation in try..catch and restores same behavir when type checker is not available.

This PR doesn't fix root cause of #859 but at least rules won't throw an exception.

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

No unit tests for specific case because issue is noticeable in only in Vue. Should I add tests to handle this exceptional case?

@JoshuaKGoldberg JoshuaKGoldberg added the PR: Waiting for Author Changes have been requested that the pull request author should address. label May 15, 2019
@IllusionMH IllusionMH added PR: Waiting for Reviewer A repository maintainer should take a look at the pull request soon! and removed PR: Waiting for Author Changes have been requested that the pull request author should address. labels May 17, 2019
Copy link

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the extra runtime safety & source comments!

@IllusionMH
Copy link
Contributor Author

Thanks for review!

@IllusionMH IllusionMH merged commit 7ac0019 into microsoft:master May 17, 2019
@IllusionMH IllusionMH deleted the handle-exceptions-in-ts-859 branch May 17, 2019 23:47
@jwhitmarsh
Copy link

Thank you :)

@IllusionMH IllusionMH added this to the 6.2.0-beta milestone May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR: Waiting for Reviewer A repository maintainer should take a look at the pull request soon!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no-string-based-x rules throw errors in Vue SFC
3 participants