-
Notifications
You must be signed in to change notification settings - Fork 887
Fix #4530: no-string-throw fixer creates syntax errors #4540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start! Just a bit of cleanup to do the same thing.
@JoshuaKGoldberg finished those changes you requested. Oddly enough, I'm seeing that my implementation is failing on CircleCI, but all tests are passing locally on my end. I suspect it has to do with the fact that a Replacement fix is applied to the same position ( |
Very spooky 👻... Have you tried installing a version of TypeScript that's failing in CI, such as 2.7 or 3.0? Perhaps Alternately, you could try reordering the lines? The TSLint application of fixes is known to be not great at overlapping fixes, but that doesn't seem like it should be affecting these? |
This reverts commit 72885ee.
I have tried all versions of TypeScript that are failing on CI: |
To clarify, my workflow is this.
Am I missing something? EDIT: I was missing one crucial step, which was installing the correct node version for each test. For example, the test for [email protected] uses node 6. The tests are now failing locally, and I can debug this issue further. |
@JoshuaKGoldberg ready for your pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Looks great, thanks @rrogowski!
PR checklist
Overview of change:
Insert whitespace after throw keyword (if not present) when fixing
no-string-throw
.Input
throw('component requires CSS height property');
Fix (Before)
thrownew Error(('component requires CSS height property'));
Fix (After)
throw new Error(('component requires CSS height property'));
Is there anything you'd like reviewers to focus on?
CHANGELOG.md entry:
[bugfix]
no-string-throw
fix inserts whitespace if not present afterthrow
keyword