This repository was archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 653
fix(rome_js_syntax): Don't panic on unclosed block comment #2933
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This fixes an issue where Rome panicked when parsing suppression comments from a block comment without the closing `*/`. This PR gracefully handles the case where a block comment has no closing `*/` by trying to remove a trailing `*` or `/` at the end of the comment and otherwise take the comment as is. ## Tests I verified that running rome over rome classic no longer panics. This is an analyzer specific issue. I'm not sure how to best write a test for this issue without adding it to a specific analyzer test. Please advice ;)
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
Deploying with
|
Latest commit: |
c59b30f
|
Status: | ✅ Deploy successful! |
Preview URL: | https://05034877.tools-8rn.pages.dev |
Branch Preview URL: | https://fix-no-panic-on-unclosed-blo.tools-8rn.pages.dev |
The tests for language-specific suppression comments are embedded directly in tools/crates/rome_js_analyze/src/lib.rs Line 86 in 0e7aaa5
|
f357dfb
to
c59b30f
Compare
ematipico
approved these changes
Jul 26, 2022
leops
approved these changes
Jul 27, 2022
IWANABETHATGUY
pushed a commit
to IWANABETHATGUY/tools
that referenced
this pull request
Aug 22, 2022
* fix(rome_js_syntax): Don't panic on unclosed block comment This fixes an issue where Rome panicked when parsing suppression comments from a block comment without the closing `*/`. This PR gracefully handles the case where a block comment has no closing `*/` by trying to remove a trailing `*` or `/` at the end of the comment and otherwise take the comment as is. ## Tests I verified that running rome over rome classic no longer panics. This is an analyzer specific issue. I'm not sure how to best write a test for this issue without adding it to a specific analyzer test. Please advice ;) * add unit test
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue where Rome panicked when parsing suppression comments from a block comment without the closing
*/
.This PR gracefully handles the case where a block comment has no closing
*/
by trying to remove a trailing*
or/
at the end of the comment and otherwise take the comment as is.Tests
I verified that running rome over rome classic no longer panics and added a unit test to the suppression comment parsing.